diff options
author | Jim Meyering <jim@meyering.net> | 2006-07-16 07:13:07 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2006-07-16 07:13:07 +0000 |
commit | c5b63944017c73f191ba8d894109a2bad2174751 (patch) | |
tree | 3b2a503d0f90b3043babeeed5ae246c45e694375 /lib/userspec.c | |
parent | 77c9d9a00952a981976e4bc929755bab61d81c68 (diff) | |
download | coreutils-c5b63944017c73f191ba8d894109a2bad2174751.tar.xz |
* userspec.c (parse_with_separator): Say "invalid spec" rather than
the sometimes erroneous "cannot get the login group of a numeric UID"
for a spec like "not-a-username:" or "1:". Reported by
suckfish@ihug.co.nz in https://bugzilla.redhat.com/bugzilla/199027.
Diffstat (limited to 'lib/userspec.c')
-rw-r--r-- | lib/userspec.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/userspec.c b/lib/userspec.c index fbdc2f9a1..fd2c941f8 100644 --- a/lib/userspec.c +++ b/lib/userspec.c @@ -1,5 +1,5 @@ /* userspec.c -- Parse a user and group string. - Copyright (C) 1989-1992, 1997-1998, 2000, 2002-2005 Free Software + Copyright (C) 1989-1992, 1997-1998, 2000, 2002-2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -109,8 +109,7 @@ parse_with_separator (char const *spec, char const *separator, { static const char *E_invalid_user = N_("invalid user"); static const char *E_invalid_group = N_("invalid group"); - static const char *E_bad_spec = - N_("cannot get the login group of a numeric UID"); + static const char *E_bad_spec = N_("invalid spec"); const char *error_msg; struct passwd *pwd; @@ -164,7 +163,11 @@ parse_with_separator (char const *spec, char const *separator, { bool use_login_group = (separator != NULL && g == NULL); if (use_login_group) - error_msg = E_bad_spec; + { + /* If there is no group, + then there may not be a trailing ":", either. */ + error_msg = E_bad_spec; + } else { unsigned long int tmp; |