From: nekral-guest Date: Sat, 17 Nov 2007 14:21:05 +0000 (+0000) Subject: Make usermod -d and -m work independant of the argument order. Thanks to X-Git-Tag: 4.1.0~115 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=71392cdc8fbaf30490317bad475d8c8b8d139c42;p=shadow Make usermod -d and -m work independant of the argument order. Thanks to Justin Pryzby for the patch. This fixes Debian's bug #451518. --- diff --git a/ChangeLog b/ChangeLog index fca0c16a..5e24ffc8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-11-17 Nicolas François + + * src/usermod.c: Make usermod -d and -m work independant of the + argument order. Thanks to Justin Pryzby + for the patch. This fixes Debian's bug #451518. + 2007-11-17 Nicolas François * NEWS, lib/nscd.c: Execute nscd -i instead of using the private diff --git a/src/usermod.c b/src/usermod.c index 916483d2..61a9acf0 100644 --- a/src/usermod.c +++ b/src/usermod.c @@ -987,9 +987,6 @@ static void process_flags (int argc, char **argv) Lflg++; break; case 'm': - if (!dflg) - usage (); - mflg++; break; case 'o': @@ -1059,6 +1056,14 @@ static void process_flags (int argc, char **argv) exit (E_USAGE); } + if (mflg && !dflg) { + fprintf (stderr, + _("%s: -m flag is ONLY allowed with the -d flag\n"), + Prog); + usage (); + exit (E_USAGE); + } + if (dflg && strcmp (user_home, user_newhome) == 0) dflg = mflg = 0;