* src/gpasswd.c: Fix the support for usernames with arbitrary

length.
This commit is contained in:
nekral-guest 2008-12-22 22:13:23 +00:00
parent 6405b58a98
commit 0bd396011a
2 changed files with 12 additions and 2 deletions

View File

@ -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> 2008-12-22 Nicolas François <nicolas.francois@centraliens.net>
* src/groupadd.c, src/groupdel.c, src/groupmod.c: Re-indent. * src/groupadd.c, src/groupdel.c, src/groupmod.c: Re-indent.

View File

@ -211,14 +211,16 @@ static void fail_exit (int status)
*/ */
static bool is_valid_user_list (const char *users) static bool is_valid_user_list (const char *users)
{ {
const char *username, *end; char *username, *end;
bool is_valid = true; bool is_valid = true;
char *tmpusers = xstrdup (users);
for (username = users; for (username = tmpusers;
(NULL != username) && ('\0' != *username); (NULL != username) && ('\0' != *username);
username = end) { username = end) {
end = strchr (username, ','); end = strchr (username, ',');
if (NULL != end) { if (NULL != end) {
*end = '\0';
end++; end++;
} }
@ -233,6 +235,9 @@ static bool is_valid_user_list (const char *users)
is_valid = false; is_valid = false;
} }
} }
free (tmpusers);
return is_valid; return is_valid;
} }