[Pkg-shadow-commits] r1361 - in upstream/trunk: . src

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Sat Nov 17 14:33:27 UTC 2007


Author: nekral-guest
Date: 2007-11-17 14:33:26 +0000 (Sat, 17 Nov 2007)
New Revision: 1361

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/src/usermod.c
Log:
Validate that two of the -L, -p, and -U options are not used at the same
time after the parsing of options. -U used to be allowed after -p or -L,
but not before.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2007-11-17 14:21:05 UTC (rev 1360)
+++ upstream/trunk/ChangeLog	2007-11-17 14:33:26 UTC (rev 1361)
@@ -1,6 +1,12 @@
 2007-11-17  Nicolas François  <nicolas.francois at centraliens.net>
 
-	* src/usermod.c: Make usermod -d and -m work independant of the
+	* src/usermod.c: Validate that two of the -L, -p, and -U options
+	are not used at the same time after the parsing of options. -U
+	used to be allowed after -p or -L, but not before.
+
+2007-11-17  Nicolas François  <nicolas.francois at centraliens.net>
+
+	* src/usermod.c: Make usermod -d and -m work independent of the
 	argument order. Thanks to Justin Pryzby <jpryzby+d at quoininc.com>
 	for the patch. This fixes Debian's bug #451518.
 

Modified: upstream/trunk/src/usermod.c
===================================================================
--- upstream/trunk/src/usermod.c	2007-11-17 14:21:05 UTC (rev 1360)
+++ upstream/trunk/src/usermod.c	2007-11-17 14:33:26 UTC (rev 1361)
@@ -981,9 +981,6 @@
 				user_newname = optarg;
 				break;
 			case 'L':
-				if (Uflg || pflg)
-					usage ();
-
 				Lflg++;
 				break;
 			case 'm':
@@ -996,9 +993,6 @@
 				oflg++;
 				break;
 			case 'p':
-				if (Lflg || Uflg)
-					usage ();
-
 				user_pass = optarg;
 				pflg++;
 				break;
@@ -1021,9 +1015,6 @@
 				uflg++;
 				break;
 			case 'U':
-				if (Lflg && pflg)
-					usage ();
-
 				Uflg++;
 				break;
 			default:
@@ -1056,6 +1047,14 @@
 		exit (E_USAGE);
 	}
 
+	if ((Lflg && (pflg || Uflg)) || (pflg && Uflg)) {
+		fprintf (stderr,
+			 _("%s: the -L, -p, and -U flags are exclusive\n"),
+			 Prog);
+		usage ();
+		exit (E_USAGE);
+	}
+
 	if (mflg && !dflg) {
 		fprintf (stderr,
 			 _("%s: -m flag is ONLY allowed with the -d flag\n"),




More information about the Pkg-shadow-commits mailing list