summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2005-01-31 18:53:34 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2005-01-31 18:53:34 +0000
commitb01697208e456c3cde9d056745fef3aadc840010 (patch)
treee8dc23ecee5df30e2d7c1776c51db83220613f4d
parent29f38f656947b7ba2945a774700488b989b62931 (diff)
Warn if the user tries to use the -u option w/o running a command.
-rw-r--r--usr.bin/sudo/sudo.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/usr.bin/sudo/sudo.c b/usr.bin/sudo/sudo.c
index 09449113b71..31edb653603 100644
--- a/usr.bin/sudo/sudo.c
+++ b/usr.bin/sudo/sudo.c
@@ -837,6 +837,12 @@ parse_args(argc, argv)
NewArgv++;
}
+ if (user_runas != NULL && !ISSET(rval, (MODE_EDIT|MODE_RUN))) {
+ if (excl != '\0')
+ warnx("the `-u' and '-%c' options may not be used together", excl);
+ usage(1);
+ }
+
if ((NewArgc == 0 && (rval & MODE_EDIT)) ||
(NewArgc > 0 && !(rval & (MODE_RUN | MODE_EDIT))))
usage(1);