summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/ChangeLog7
-rw-r--r--lib/userspec.c11
2 files changed, 14 insertions, 4 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog
index 5d114117d..774159fbd 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,10 @@
+2006-07-16 Jim Meyering <jim@meyering.net>
+
+ * 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.
+
2006-07-10 Derek R. Price <derek@ximbiot.com>
* backupfile.c, dirfd.h, fts.c, getcwd.c:
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;