]> granicus.if.org Git - shadow/commitdiff
* src/gpasswd.c: Fix the support for usernames with arbitrary
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Mon, 22 Dec 2008 22:13:23 +0000 (22:13 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Mon, 22 Dec 2008 22:13:23 +0000 (22:13 +0000)
length.

ChangeLog
src/gpasswd.c

index 4afdc7c72587fa4bb8492d953e2741933785dca0..9383a67a4c68f8d2dd82d0620ad9eca1b5c2a9b6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-12-22  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * src/gpasswd.c: Fix the support for usernames with arbitrary
+       length.
+
 2008-12-22  Nicolas François  <nicolas.francois@centraliens.net>
 
        * src/groupadd.c, src/groupdel.c, src/groupmod.c: Re-indent.
index 926e41dc1df0897e9e900e3e492b7de4c6cbf3d6..d1b6846854d52b66a15a315b6d51f5603198903d 100644 (file)
@@ -211,14 +211,16 @@ static void fail_exit (int status)
  */
 static bool is_valid_user_list (const char *users)
 {
-       const char *username, *end;
+       char *username, *end;
        bool is_valid = true;
+       char *tmpusers = xstrdup (users);
 
-       for (username = users;
+       for (username = tmpusers;
             (NULL != username) && ('\0' != *username);
             username = end) {
                end = strchr (username, ',');
                if (NULL != end) {
+                       *end = '\0';
                        end++;
                }
 
@@ -233,6 +235,9 @@ static bool is_valid_user_list (const char *users)
                        is_valid = false;
                }
        }
+
+       free (tmpusers);
+
        return is_valid;
 }