|
|
| version 1.1.1.2, 2012/05/29 12:26:49 | version 1.1.1.3, 2012/10/09 09:29:52 |
|---|---|
| Line 188 main(int argc, char *argv[]) | Line 188 main(int argc, char *argv[]) |
| (void) printf(_("%s grammar version %d\n"), getprogname(), SUDOERS_GRAMMAR_VERSION); | (void) printf(_("%s grammar version %d\n"), getprogname(), SUDOERS_GRAMMAR_VERSION); |
| goto done; | goto done; |
| case 'c': | case 'c': |
| checkonly++; /* check mode */ | checkonly = true; /* check mode */ |
| break; | break; |
| case 'f': | case 'f': |
| sudoers_path = optarg; /* sudoers file path */ | sudoers_path = optarg; /* sudoers file path */ |
| Line 198 main(int argc, char *argv[]) | Line 198 main(int argc, char *argv[]) |
| help(); | help(); |
| break; | break; |
| case 's': | case 's': |
| strict++; /* strict mode */ | strict = true; /* strict mode */ |
| break; | break; |
| case 'q': | case 'q': |
| quiet++; /* quiet mode */ | quiet = false; /* quiet mode */ |
| break; | break; |
| default: | default: |
| usage(1); | usage(1); |
| Line 235 main(int argc, char *argv[]) | Line 235 main(int argc, char *argv[]) |
| if ((yyin = open_sudoers(sudoers_path, true, NULL)) == NULL) { | if ((yyin = open_sudoers(sudoers_path, true, NULL)) == NULL) { |
| error(1, "%s", sudoers_path); | error(1, "%s", sudoers_path); |
| } | } |
| init_parser(sudoers_path, 0); | init_parser(sudoers_path, false); |
| yyparse(); | yyparse(); |
| (void) update_defaults(SETDEF_GENERIC|SETDEF_HOST|SETDEF_USER); | (void) update_defaults(SETDEF_GENERIC|SETDEF_HOST|SETDEF_USER); |
| Line 472 reparse_sudoers(char *editor, char *args, bool strict, | Line 472 reparse_sudoers(char *editor, char *args, bool strict, |
| int ch; | int ch; |
| debug_decl(reparse_sudoers, SUDO_DEBUG_UTIL) | debug_decl(reparse_sudoers, SUDO_DEBUG_UTIL) |
| if (tq_empty(&sudoerslist)) | |
| debug_return; | |
| /* | /* |
| * Parse the edited sudoers files and do sanity checking | * Parse the edited sudoers files and do sanity checking |
| */ | */ |
| Line 497 reparse_sudoers(char *editor, char *args, bool strict, | Line 500 reparse_sudoers(char *editor, char *args, bool strict, |
| } | } |
| fclose(yyin); | fclose(yyin); |
| if (!parse_error) { | if (!parse_error) { |
| if (!update_defaults(SETDEF_GENERIC|SETDEF_HOST|SETDEF_USER) || | if (!check_defaults(SETDEF_ALL, quiet) || |
| check_aliases(strict, quiet) != 0) { | check_aliases(strict, quiet) != 0) { |
| parse_error = true; | parse_error = true; |
| errorfile = sp->path; | errorfile = NULL; |
| } | } |
| } | } |
| Line 524 reparse_sudoers(char *editor, char *args, bool strict, | Line 527 reparse_sudoers(char *editor, char *args, bool strict, |
| tq_foreach_fwd(&sudoerslist, sp) { | tq_foreach_fwd(&sudoerslist, sp) { |
| if (errorfile == NULL || strcmp(sp->path, errorfile) == 0) { | if (errorfile == NULL || strcmp(sp->path, errorfile) == 0) { |
| edit_sudoers(sp, editor, args, errorlineno); | edit_sudoers(sp, editor, args, errorlineno); |
| break; | if (errorfile != NULL) |
| break; | |
| } | } |
| } | } |
| if (sp == NULL) { | if (errorfile != NULL && sp == NULL) { |
| errorx(1, _("internal error, unable to find %s in list!"), | errorx(1, _("internal error, unable to find %s in list!"), |
| sudoers); | sudoers); |
| } | } |
| Line 822 check_syntax(char *sudoers_path, bool quiet, bool stri | Line 826 check_syntax(char *sudoers_path, bool quiet, bool stri |
| parse_error = true; | parse_error = true; |
| errorfile = sudoers_path; | errorfile = sudoers_path; |
| } | } |
| if (!parse_error && check_aliases(strict, quiet) != 0) { | if (!parse_error) { |
| parse_error = true; | if (!check_defaults(SETDEF_ALL, quiet) || |
| errorfile = sudoers_path; | check_aliases(strict, quiet) != 0) { |
| parse_error = true; | |
| errorfile = NULL; | |
| } | |
| } | } |
| ok = !parse_error; | ok = !parse_error; |