[BACK]Return to doas.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / doas

Diff for /src/usr.bin/doas/doas.c between version 1.5 and 1.6

version 1.5, 2015/07/16 22:11:01 version 1.6, 2015/07/16 23:22:08
Line 14 
Line 14 
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF   * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.   * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */   */
   
 #include <sys/types.h>  #include <sys/types.h>
   #include <sys/stat.h>
   
 #include <limits.h>  #include <limits.h>
 #include <login_cap.h>  #include <login_cap.h>
Line 139 
Line 141 
 {  {
         extern FILE *yyfp;          extern FILE *yyfp;
         extern int yyparse(void);          extern int yyparse(void);
           struct stat sb;
   
         yyfp = fopen(filename, "r");          yyfp = fopen(filename, "r");
         if (!yyfp) {          if (!yyfp) {
                 fprintf(stderr, "doas is not enabled.\n");                  fprintf(stderr, "doas is not enabled.\n");
                 exit(1);                  exit(1);
         }          }
   
           if (fstat(fileno(yyfp), &sb) != 0)
                   err(1, "fstat(\"%s\")", filename);
           if ((sb.st_mode & (S_IWGRP|S_IWOTH)) != 0)
                   errx(1, "%s is writable by group or other", filename);
           if (sb.st_uid != 0)
                   errx(1, "%s is not owned by root", filename);
   
         yyparse();          yyparse();
         fclose(yyfp);          fclose(yyfp);
 }  }

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6