diff --git a/ChangeLog b/ChangeLog index 4afdc7c7..9383a67a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-12-22 Nicolas François + + * src/gpasswd.c: Fix the support for usernames with arbitrary + length. + 2008-12-22 Nicolas François * src/groupadd.c, src/groupdel.c, src/groupmod.c: Re-indent. diff --git a/src/gpasswd.c b/src/gpasswd.c index 926e41dc..d1b68468 100644 --- a/src/gpasswd.c +++ b/src/gpasswd.c @@ -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; }