diff options
-rw-r--r-- | gnu/usr.bin/sudo/sudo/parse.yacc | 6 | ||||
-rw-r--r-- | gnu/usr.bin/sudo/sudo/sudo.c | 42 |
2 files changed, 35 insertions, 13 deletions
diff --git a/gnu/usr.bin/sudo/sudo/parse.yacc b/gnu/usr.bin/sudo/sudo/parse.yacc index 80d6c98024f..f15303b9e22 100644 --- a/gnu/usr.bin/sudo/sudo/parse.yacc +++ b/gnu/usr.bin/sudo/sudo/parse.yacc @@ -1,5 +1,5 @@ %{ -/* $OpenBSD: parse.yacc,v 1.13 1999/03/29 20:29:05 millert Exp $ */ +/* $OpenBSD: parse.yacc,v 1.14 1999/03/30 06:25:26 millert Exp $ */ /* * CU sudo version 1.5.9 @@ -64,7 +64,7 @@ #endif /* !HAVE_STRCASECMP */ #ifndef lint -static const char rcsid[] = "$Sudo: parse.yacc,v 1.133 1999/03/29 04:31:15 millert Exp $"; +static const char rcsid[] = "$Sudo: parse.yacc,v 1.134 1999/03/30 06:03:38 millert Exp $"; #endif /* lint */ /* @@ -269,7 +269,7 @@ cmndspeclist : cmndspec cmndspec : { /* Push a new entry onto the stack if needed */ if (user_matches == TRUE && host_matches == TRUE && - cmnd_matches == TRUE && runas_matches == TRUE) { + cmnd_matches != -1 && runas_matches == TRUE) { push; user_matches = TRUE; host_matches = TRUE; diff --git a/gnu/usr.bin/sudo/sudo/sudo.c b/gnu/usr.bin/sudo/sudo/sudo.c index 403a453d498..2edf4d00310 100644 --- a/gnu/usr.bin/sudo/sudo/sudo.c +++ b/gnu/usr.bin/sudo/sudo/sudo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sudo.c,v 1.13 1999/03/29 20:29:06 millert Exp $ */ +/* $OpenBSD: sudo.c,v 1.14 1999/03/30 06:25:25 millert Exp $ */ /* * CU sudo version 1.5.9 (based on Root Group sudo version 1.1) @@ -93,7 +93,7 @@ extern char *getenv __P((char *)); #endif /* STDC_HEADERS */ #ifndef lint -static const char rcsid[] = "$Sudo: sudo.c,v 1.222 1999/03/29 04:05:12 millert Exp $"; +static const char rcsid[] = "$Sudo: sudo.c,v 1.223 1999/03/30 06:01:46 millert Exp $"; #endif /* lint */ @@ -111,6 +111,7 @@ struct env_table { */ static int parse_args __P((void)); static void usage __P((int)); +static void usage_excl __P((int)); static void load_globals __P((int)); static int check_sudoers __P((void)); static int load_cmnd __P((int)); @@ -596,9 +597,6 @@ static int parse_args() usage(1); } - if (excl) - usage(1); /* only one -? option allowed */ - switch (NewArgv[0][1]) { #ifdef HAVE_KERB5 case 'r': @@ -641,23 +639,33 @@ static int parse_args() break; case 'v': ret = MODE_VALIDATE; - excl++; + if (excl && excl != 'v') + usage_excl(1); + excl = 'v'; break; case 'k': ret = MODE_KILL; - excl++; + if (excl && excl != 'k') + usage_excl(1); + excl = 'k'; break; case 'l': ret = MODE_LIST; - excl++; + if (excl && excl != 'l') + usage_excl(1); + excl = 'l'; break; case 'V': ret = MODE_VERSION; - excl++; + if (excl && excl != 'V') + usage_excl(1); + excl = 'V'; break; case 'h': ret = MODE_HELP; - excl++; + if (excl && excl != 'h') + usage_excl(1); + excl = 'h'; break; case 's': ret |= MODE_SHELL; @@ -700,6 +708,20 @@ static int parse_args() /********************************************************************** * + * usage_excl() + * + * Tell which options are mutually exclusive and exit + */ + +static void usage_excl(exit_val) + int exit_val; +{ + (void) fprintf(stderr, "Only one of the -v, -k, -l, -V and -h options may be used\n"); + usage(exit_val); +} + +/********************************************************************** + * * usage() * * this function just gives you instructions and exits |