From: Todd C. Miller Date: Wed, 23 May 2012 16:50:37 +0000 (-0400) Subject: Allow the -k flag to be used along with the -i and -s flags. X-Git-Tag: SUDO_1_7_10~95 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=756396e3b1aabfda562fd3636f1ecd6e6c605ec3;p=sudo Allow the -k flag to be used along with the -i and -s flags. --HG-- branch : 1.7 --- diff --git a/parse_args.c b/parse_args.c index d6fa8426f..33412f978 100644 --- a/parse_args.c +++ b/parse_args.c @@ -251,13 +251,15 @@ parse_args(argc, argv) if (!mode) { /* Defer -k mode setting until we know whether it is a flag or not */ - if (ISSET(flags, MODE_INVALIDATE) && NewArgc == 0) { - mode = MODE_INVALIDATE; /* -k by itself */ - CLR(flags, MODE_INVALIDATE); - valid_flags = 0; - } else { - mode = MODE_RUN; /* running a command */ + if (ISSET(flags, MODE_INVALIDATE)) { + if (NewArgc == 0 && !(flags & (MODE_SHELL|MODE_LOGIN_SHELL))) { + mode = MODE_INVALIDATE; /* -k by itself */ + CLR(flags, MODE_INVALIDATE); + valid_flags = 0; + } } + if (!mode) + mode = MODE_RUN; /* running a command */ } if (NewArgc > 0 && mode == MODE_LIST)