]> granicus.if.org Git - shadow/commitdiff
* NEWS, src/usermod.c: Check if the user is busy when the user's
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Mon, 18 May 2009 18:37:16 +0000 (18:37 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Mon, 18 May 2009 18:37:16 +0000 (18:37 +0000)
UID, name or home directory is changed.

ChangeLog
NEWS
src/usermod.c

index 7328c6aa37cf0a13039f1beef37d1d411aa03229..0462d7f9046bb99947f946fc4cb6d369b8a5d4fb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-05-18  Nicolas François  <nicolas.francois@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@centraliens.net>
 
        * src/userdel.c, libmisc/user_busy.c, libmisc/Makefile.am,
diff --git a/NEWS b/NEWS
index ff110f96f8a4cc81533effa2a7f63c42848c5c6f..f6c74220f8376677d493f6d3bfa69aac4c2df83f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,9 @@ shadow-4.1.4 -> shadow-4.1.4.1                                                UNRELEASED
     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
 
index 4c87f1539bb7b7148c728a66fc13f48f035d3bc4..f178a152fac2524b68df5fe66c43c62472a49dba 100644 (file)
@@ -1715,6 +1715,18 @@ int main (int argc, char **argv)
 
        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
        {