]> granicus.if.org Git - shadow/commitdiff
Fix the handling of -a when a user is being renamed (with -l). The new
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 10 Feb 2008 20:25:39 +0000 (20:25 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 10 Feb 2008 20:25:39 +0000 (20:25 +0000)
name of the user was used for the new supplementary groups, but not in the
existing ones.

ChangeLog
NEWS
src/usermod.c

index 56c2ecb2839aa5f63aae8eaa5869320d330d1a11..5d5929bde1429a72793d45f2bb5fa7e07605228e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-02-10  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * NEWS, src/usermod.c: Fix the handling of -a when a user is being
+       renamed (with -l). The new name of the user was used for the new
+       supplementary groups, but not in the existing ones.
+
 2008-02-10  Nicolas François  <nicolas.francois@centraliens.net>
 
        * src/newusers.c: Set the shadow's password instead of the
diff --git a/NEWS b/NEWS
index 0d853b998454d7f8cf5779674962ac1229739ed1..1aad29845f3eeb92df34048d6f1d3c4610d62d48 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -65,6 +65,7 @@ shadow-4.1.0 -> shadow-4.1.1                                          UNRELEASED
     one, no changes will be performed for that field. If no fields are
     changed, usermod will exist successfully with a warning. This avoids
     logging changes to syslog when there are actually no changes.
+  * Fix the handling of -a when a user is being renamed (with -l)
 - vipw/vigr
   * Recommend editing the shadowed (resp. regular) file if the regular (resp.
     shadowed) file was edited.
index 5246650a051364f5c0b9548cc0b56fd23736b0f2..1ff4fc8682004bcf385267d5770ad4f56de04742 100644 (file)
@@ -533,7 +533,8 @@ static void update_group (void)
                 * concurrent groups.
                 */
                was_member = is_on_list (grp->gr_mem, user_name);
-               is_member = Gflg && is_on_list (user_groups, grp->gr_name);
+               is_member = Gflg && (   (was_member && aflg)
+                                    || is_on_list (user_groups, grp->gr_name));
 
                if (!was_member && !is_member)
                        continue;
@@ -629,6 +630,8 @@ static void update_gshadow (void)
                 * concurrent groups.
                 */
                is_member = Gflg && is_on_list (user_groups, sgrp->sg_name);
+               is_member = Gflg && (   (was_member && aflg)
+                                    || is_on_list (user_groups, sgrp->sg_name));
 
                if (!was_member && !was_admin && !is_member)
                        continue;