From: Todd C. Miller Date: Wed, 4 Jan 2012 20:45:27 +0000 (-0500) Subject: parse_error is now bool, not int X-Git-Tag: SUDO_1_8_4~92^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=47bcaf57bcc5ac8e83d4220ee006ec6b875d8376;p=sudo parse_error is now bool, not int --- diff --git a/plugins/sudoers/parse.c b/plugins/sudoers/parse.c index ad1ad70db..76d62cb13 100644 --- a/plugins/sudoers/parse.c +++ b/plugins/sudoers/parse.c @@ -70,7 +70,8 @@ struct sudo_nss sudo_nss_file = { */ extern FILE *yyin; extern char *errorfile; -extern int errorlineno, parse_error; +extern int errorlineno; +extern bool parse_error; /* * Local prototypes. diff --git a/plugins/sudoers/testsudoers.c b/plugins/sudoers/testsudoers.c index 67a139c0b..cdc60abe6 100644 --- a/plugins/sudoers/testsudoers.c +++ b/plugins/sudoers/testsudoers.c @@ -109,7 +109,8 @@ struct interface *interfaces; struct sudo_user sudo_user; struct passwd *list_pw; static char *runas_group, *runas_user; -extern int errorlineno, parse_error; +extern int errorlineno; +extern bool parse_error; extern char *errorfile; sudo_printf_t sudo_printf = testsudoers_printf; sudo_conv_t sudo_conv; /* NULL in non-plugin */ diff --git a/plugins/sudoers/visudo.c b/plugins/sudoers/visudo.c index 4d82fc12d..2fb0601a4 100644 --- a/plugins/sudoers/visudo.c +++ b/plugins/sudoers/visudo.c @@ -106,7 +106,7 @@ static char *get_editor(char **); static void get_hostname(void); static char whatnow(void); static int check_aliases(bool, bool); -static int check_syntax(char *, bool, bool); +static bool check_syntax(char *, bool, bool); static bool edit_sudoers(struct sudoersfile *, char *, char *, int); static bool install_sudoers(struct sudoersfile *, bool); static int print_unused(void *, void *); @@ -128,7 +128,8 @@ extern void yyrestart(FILE *); extern struct rbtree *aliases; extern FILE *yyin; extern char *sudoers, *errorfile; -extern int errorlineno, parse_error; +extern int errorlineno; +extern bool parse_error; /* For getopt(3) */ extern char *optarg; extern int optind; @@ -217,7 +218,7 @@ main(int argc, char *argv[]) init_defaults(); if (checkonly) - exit(check_syntax(sudoers_path, quiet, strict)); + exit(check_syntax(sudoers_path, quiet, strict) ? 1 : 0); /* * Parse the existing sudoers file(s) in quiet mode to highlight any @@ -746,11 +747,11 @@ run_command(char *path, char **argv) return WEXITSTATUS(status); } -static int +static bool check_syntax(char *sudoers_path, bool quiet, bool strict) { struct stat sb; - int rval; + bool rval; if (strcmp(sudoers_path, "-") == 0) { yyin = stdin; @@ -786,7 +787,7 @@ check_syntax(char *sudoers_path, bool quiet, bool strict) /* Check mode and owner in strict mode. */ if (strict && yyin != stdin && fstat(fileno(yyin), &sb) == 0) { if (sb.st_uid != SUDOERS_UID || sb.st_gid != SUDOERS_GID) { - rval = 1; + rval = true; if (!quiet) { fprintf(stderr, _("%s: wrong owner (uid, gid) should be (%u, %u)\n"), @@ -794,7 +795,7 @@ check_syntax(char *sudoers_path, bool quiet, bool strict) } } if ((sb.st_mode & 07777) != SUDOERS_MODE) { - rval = 1; + rval = true; if (!quiet) { fprintf(stderr, _("%s: bad permissions, should be mode 0%o\n"), sudoers_path, SUDOERS_MODE);