From: Serge Hallyn Date: Fri, 30 Mar 2018 06:10:51 +0000 (-0700) Subject: Merge pull request #103 from HarmtH/be-predictable X-Git-Tag: 4.6~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=164dcfe65b7e81ce908121711754497c6f05a4f3;p=shadow Merge pull request #103 from HarmtH/be-predictable su.c: be more predictable --- 164dcfe65b7e81ce908121711754497c6f05a4f3 diff --cc src/su.c index 0e5dd6fd,8a5371f7..685f7bb0 --- a/src/su.c +++ b/src/su.c @@@ -809,16 -810,17 +810,10 @@@ static void process_flags (int argc, ch if ((optind < argc) && (strcmp (argv[optind], "-") == 0)) { fakelogin = true; optind++; - if ( (optind < argc) - && (strcmp (argv[optind], "--") == 0)) { - optind++; - } } - /* - * The next argument must be either a user ID, or some flag to a - * subshell. Pretty sticky since you can't have an argument which - * doesn't start with a "-" unless you specify the new user name. - * Any remaining arguments will be passed to the user's login shell. - */ - if ((optind < argc) && ('-' != argv[optind][0])) { + if (optind < argc) { STRFCPY (name, argv[optind++]); /* use this login id */ - if ((optind < argc) && (strcmp (argv[optind], "--") == 0)) { - optind++; - } } if ('\0' == name[0]) { /* use default user */ struct passwd *root_pw = getpwnam ("root");