2008-01-25 17:48:11 +00:00
|
|
|
diff -urp coreutils-6.10-orig/lib/getugroups.c coreutils-6.10/lib/getugroups.c
|
|
|
|
--- coreutils-6.10-orig/lib/getugroups.c 2007-10-17 15:47:25.000000000 +0200
|
|
|
|
+++ coreutils-6.10/lib/getugroups.c 2008-01-24 16:37:04.000000000 +0100
|
|
|
|
@@ -19,6 +19,9 @@
|
2007-01-09 19:29:30 +00:00
|
|
|
|
|
|
|
#include <config.h>
|
2004-10-05 15:45:31 +00:00
|
|
|
|
|
|
|
+/* We do not need this code if getgrouplist(3) is available. */
|
|
|
|
+#ifndef HAVE_GETGROUPLIST
|
|
|
|
+
|
2008-01-25 17:48:11 +00:00
|
|
|
#include "getugroups.h"
|
|
|
|
|
2004-10-05 15:45:31 +00:00
|
|
|
#include <stdio.h> /* grp.h on alpha OSF1 V2.0 uses "FILE *". */
|
2008-01-25 17:48:11 +00:00
|
|
|
@@ -114,3 +117,4 @@ getugroups (int maxcount, GETGROUPS_T *g
|
2004-10-05 15:45:31 +00:00
|
|
|
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
+#endif /* have getgrouplist */
|
2008-01-25 17:48:11 +00:00
|
|
|
diff -urp coreutils-6.10-orig/lib/mgetgroups.c coreutils-6.10/lib/mgetgroups.c
|
|
|
|
--- coreutils-6.10-orig/lib/mgetgroups.c 2007-11-25 14:23:31.000000000 +0100
|
|
|
|
+++ coreutils-6.10/lib/mgetgroups.c 2008-01-24 16:41:15.000000000 +0100
|
|
|
|
@@ -43,9 +43,17 @@ mgetgroups (const char *username, gid_t
|
|
|
|
int ng;
|
|
|
|
GETGROUPS_T *g;
|
|
|
|
|
|
|
|
- max_n_groups = (username
|
|
|
|
- ? getugroups (0, NULL, username, gid)
|
|
|
|
- : getgroups (0, NULL));
|
|
|
|
+ if (!username)
|
|
|
|
+ max_n_groups = getgroups(0, NULL);
|
|
|
|
+ else
|
|
|
|
+ {
|
2004-10-05 15:45:31 +00:00
|
|
|
+#ifdef HAVE_GETGROUPLIST
|
|
|
|
+ max_n_groups = 0;
|
|
|
|
+ getgrouplist (username, gid, NULL, &max_n_groups);
|
|
|
|
+#else
|
|
|
|
+ max_n_groups = getugroups (0, NULL, username, gid);
|
|
|
|
+#endif
|
2008-01-25 17:48:11 +00:00
|
|
|
+ }
|
2004-10-05 15:45:31 +00:00
|
|
|
|
2008-01-25 17:48:11 +00:00
|
|
|
/* If we failed to count groups with NULL for a buffer,
|
|
|
|
try again with a non-NULL one, just in case. */
|
|
|
|
@@ -62,9 +70,25 @@ mgetgroups (const char *username, gid_t
|
|
|
|
if (g == NULL)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
- ng = (username
|
|
|
|
- ? getugroups (max_n_groups, g, username, gid)
|
|
|
|
- : getgroups (max_n_groups, g));
|
|
|
|
+ if (!username)
|
|
|
|
+ ng = getgroups (max_n_groups, g);
|
|
|
|
+ else
|
|
|
|
+ {
|
- 5.92.
- No longer need afs, dircolors, utmp, gcc4, brokentest, dateseconds,
chown, rmaccess, copy, stale-utmp, no-sign-extend, fchown patches.
- Updated acl, dateman, pam, langinfo, i18n, getgrouplist, selinux patches.
- Dropped printf-ll, allow_old_options, jday, zh_CN patches.
- NOTE: i18n patch not ported for sort(1) yet.
2005-10-27 15:05:08 +00:00
|
|
|
+#ifdef HAVE_GETGROUPLIST
|
|
|
|
+ int e;
|
|
|
|
+ ng = max_n_groups;
|
|
|
|
+ while ((e = getgrouplist (username, gid, g, &ng)) == -1
|
|
|
|
+ && ng > max_n_groups)
|
|
|
|
+ {
|
|
|
|
+ max_n_groups = ng;
|
|
|
|
+ g = xrealloc (g, max_n_groups * sizeof (GETGROUPS_T));
|
|
|
|
+ }
|
|
|
|
+ if (e == -1)
|
|
|
|
+ ng = -1;
|
2004-10-05 15:45:31 +00:00
|
|
|
+#else
|
- 5.92.
- No longer need afs, dircolors, utmp, gcc4, brokentest, dateseconds,
chown, rmaccess, copy, stale-utmp, no-sign-extend, fchown patches.
- Updated acl, dateman, pam, langinfo, i18n, getgrouplist, selinux patches.
- Dropped printf-ll, allow_old_options, jday, zh_CN patches.
- NOTE: i18n patch not ported for sort(1) yet.
2005-10-27 15:05:08 +00:00
|
|
|
+ ng = getugroups (max_n_groups, g, username, gid);
|
2004-10-05 15:45:31 +00:00
|
|
|
+#endif
|
2008-01-25 17:48:11 +00:00
|
|
|
+ }
|
2004-10-05 15:45:31 +00:00
|
|
|
|
|
|
|
if (ng < 0)
|
2008-01-25 17:48:11 +00:00
|
|
|
{
|
|
|
|
diff -urp coreutils-6.10-orig/m4/jm-macros.m4 coreutils-6.10/m4/jm-macros.m4
|
|
|
|
--- coreutils-6.10-orig/m4/jm-macros.m4 2007-11-25 14:23:31.000000000 +0100
|
|
|
|
+++ coreutils-6.10/m4/jm-macros.m4 2008-01-24 16:42:00.000000000 +0100
|
|
|
|
@@ -52,6 +52,7 @@ AC_DEFUN([coreutils_MACROS],
|
2007-01-09 19:29:30 +00:00
|
|
|
fchown \
|
|
|
|
fchmod \
|
|
|
|
ftruncate \
|
|
|
|
+ getgrouplist \
|
|
|
|
iswspace \
|
|
|
|
mkfifo \
|
|
|
|
mbrlen \
|