Package: coreutils
Version: 5.97-5.7
Severity: normal
Tags: patch

When you run id <username> it calls a built in function called getugroup which 
in turn uses getgrent.             
The getgrent function is not supported by nss hesiod which of course means id 
doesn't return the supplementary    
groups the user belongs to.                                                     
                                  
Instead getgrouplist should be used, this is a known issue, but since the 
getgrouplist function didn't work well  
with glibc 2.3.2 the change was reverted. Submitted is a patch for getugroup to 
use getgrouplist if present.      
This might also solve the > 32 groups bug though I haven't tested it. 

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 
'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.23.11mos-2 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages coreutils depends on:
ii  libacl1                      2.2.45-1    Access control list shared library
ii  libc6                        2.7-5       GNU C Library: Shared libraries
ii  libselinux1                  2.0.15-2+b1 SELinux shared libraries

coreutils recommends no packages.

-- no debconf information
diff -ru coreutils-5.97/configure.ac coreutils-5.97huji/configure.ac
--- coreutils-5.97/configure.ac	2006-05-23 23:38:46.000000000 +0300
+++ coreutils-5.97huji/configure.ac	2008-01-07 16:50:59.000000000 +0200
@@ -114,6 +114,8 @@
   done
 fi
 
+AC_CHECK_FUNCS(getgrouplist)
+
 AC_CACHE_CHECK([for 3-argument setpriority function],
   [utils_cv_func_setpriority],
   [AC_LINK_IFELSE(
diff -ru coreutils-5.97/lib/getugroups.c coreutils-5.97huji/lib/getugroups.c
--- coreutils-5.97/lib/getugroups.c	2005-09-22 09:05:39.000000000 +0300
+++ coreutils-5.97huji/lib/getugroups.c	2008-01-07 16:52:14.000000000 +0200
@@ -54,6 +54,10 @@
 int
 getugroups (int maxcount, GETGROUPS_T *grouplist, char *username, gid_t gid)
 {
+#ifdef HAVE_GETGROUPLIST
+    getgrouplist(username, gid, grouplist, &maxcount);
+    return maxcount;
+#else
   struct group *grp;
   register char **cp;
   register int count = 0;
@@ -104,4 +108,5 @@
   endgrent ();
 
   return count;
+#endif
 }

Reply via email to