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

Nicolas FRANÇOIS nekral-guest at alioth.debian.org
Mon May 18 18:37:16 UTC 2009


Author: nekral-guest
Date: 2009-05-18 18:37:16 +0000 (Mon, 18 May 2009)
New Revision: 2936

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/NEWS
   upstream/trunk/src/usermod.c
Log:
	* NEWS, src/usermod.c: Check if the user is busy when the user's
	UID, name or home directory is changed.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2009-05-18 18:32:17 UTC (rev 2935)
+++ upstream/trunk/ChangeLog	2009-05-18 18:37:16 UTC (rev 2936)
@@ -1,5 +1,10 @@
 2009-05-18  Nicolas François  <nicolas.francois at centraliens.net>
 
+	* NEWS, src/usermod.c: Check if the user is busy when the user's
+	UID, name or home directory is changed.
+
+2009-05-18  Nicolas François  <nicolas.francois at centraliens.net>
+
 	* src/userdel.c, libmisc/user_busy.c, libmisc/Makefile.am,
 	lib/prototypes.h: Move user_busy() to libmisc/user_busy.c.
 	* NEWS, libmisc/user_busy.c: On Linux, do not check if an user is

Modified: upstream/trunk/NEWS
===================================================================
--- upstream/trunk/NEWS	2009-05-18 18:32:17 UTC (rev 2935)
+++ upstream/trunk/NEWS	2009-05-18 18:37:16 UTC (rev 2936)
@@ -10,6 +10,9 @@
     the user is running some processes.
   * If not on Linux, continue to search for an utmp record, but make sure
     the process recorded in the utmp entry is still running.
+- usermod
+  * Check if the user is busy when the user's UID, name or home directory
+    is changed.
 
 shadow-4.1.3.1 -> shadow-4.1.4						2009-05-10
 

Modified: upstream/trunk/src/usermod.c
===================================================================
--- upstream/trunk/src/usermod.c	2009-05-18 18:32:17 UTC (rev 2935)
+++ upstream/trunk/src/usermod.c	2009-05-18 18:37:16 UTC (rev 2936)
@@ -1715,6 +1715,18 @@
 
 	process_flags (argc, argv);
 
+	/*
+	 * The home directory, the username and the user's UID should not
+	 * be changed while the user is logged in.
+	 */
+	if (   (uflg || lflg || dflg)
+	    && (user_busy (user_name, user_id) != 0)) {
+		fprintf (stderr,
+		         _("%s: user %s is currently logged in\n"),
+		         Prog, user_name);
+		exit (E_USER_BUSY);
+	}
+
 #ifdef ACCT_TOOLS_SETUID
 #ifdef USE_PAM
 	{




More information about the Pkg-shadow-commits mailing list