[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#267546: marked as done (libc6: fix getent when uid/gid starts with a digit)



Your message dated Thu, 6 Apr 2006 21:07:31 +0200
with message-id <20060406190729.GA23415@bode.aurel32.net>
and subject line bug#267546: libc6: fix getent when uid/gid starts with a digit
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
Package: libc6
Version: 2.3.2.ds1-13
Severity: minor
Tags: patch

Hi,
attached patch fixes a problem in getent that shows when searching for
uids/gids like:

getent passwd 1abc

where getent assumes the argument passed is a number, because it starts
with a digit. This patch has been applied to upstream CVS already.
Cheers,
 -- Guido

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: powerpc (ppc)
Kernel: Linux 2.6.8-albook12
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8

Versions of packages libc6 depends on:
ii  libdb1-compat                 2.1.3-7    The Berkeley database routines [gl

-- no debconf information
--- nss/getent.c.orig	2004-08-06 12:24:22.000000000 +0200
+++ nss/getent.c	2004-08-06 12:25:48.000000000 +0200
@@ -206,17 +206,14 @@
 
   for (i = 0; i < number; ++i)
     {
-      if (isdigit (key[i][0]))
-	{
+      errno = 0;
            char *ep;
            gid_t arg_gid = strtoul (key[i], &ep, 10);
 
-           if (*key[i] != '\0' && *ep == '\0')  /* valid numeric uid */
+      if (errno != EINVAL && *key[i] != '\0' && *ep == '\0')
+	/* Valid numeric gid.  */
              grp = getgrgid (arg_gid);
            else
-             grp = NULL;
-	}
-      else
 	grp = getgrnam (key[i]);
 
       if (grp == NULL)
@@ -481,17 +478,14 @@
 
   for (i = 0; i < number; ++i)
     {
-      if (isdigit (key[i][0]))
-        {
+      errno = 0;
 	   char *ep;
 	   uid_t arg_uid = strtoul (key[i], &ep, 10);
 
-           if (*key[i] != '\0' && *ep == '\0')  /* valid numeric uid */
+      if (errno != EINVAL && *key[i] != '\0' && *ep == '\0')
+	/* Valid numeric uid.  */
 	     pwd = getpwuid (arg_uid);
            else
-             pwd = NULL;
-        }
-      else
 	pwd = getpwnam (key[i]);
 
       if (pwd == NULL)

--- End Message ---
--- Begin Message ---
This bug is not present in the current glibc (2.3.6-5), closing the bug.


-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net

--- End Message ---

Reply to: