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 *);
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;
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
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;
/* 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"),
}
}
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);