summaryrefslogtreecommitdiff
path: root/usr/src/cmd/perl
diff options
context:
space:
mode:
authorCasper H.S. Dik <Casper.Dik@Sun.COM>2009-11-20 20:58:43 +0100
committerCasper H.S. Dik <Casper.Dik@Sun.COM>2009-11-20 20:58:43 +0100
commit67dbe2be0c0f1e2eb428b89088bb5667e8f0b9f6 (patch)
treeae276da3565da2f00f984253f7b5da205d4384c5 /usr/src/cmd/perl
parentf73ae3db72a91f9f8759931a1c643c7dad785881 (diff)
downloadillumos-joyent-67dbe2be0c0f1e2eb428b89088bb5667e8f0b9f6.tar.gz
PSARC 2009/542 Increase the maximum value of NGROUPS_MAX to 1024
4088757 Customer would like to increase ngroups_max more than 32 6853435 Many files incorrectly include the private <sys/cred_impl.h>
Diffstat (limited to 'usr/src/cmd/perl')
-rw-r--r--usr/src/cmd/perl/5.8.4/distrib/doio.c20
-rw-r--r--usr/src/cmd/perl/5.8.4/distrib/mg.c22
2 files changed, 39 insertions, 3 deletions
diff --git a/usr/src/cmd/perl/5.8.4/distrib/doio.c b/usr/src/cmd/perl/5.8.4/distrib/doio.c
index e452bc3a4e..e4fdd87266 100644
--- a/usr/src/cmd/perl/5.8.4/distrib/doio.c
+++ b/usr/src/cmd/perl/5.8.4/distrib/doio.c
@@ -1,3 +1,7 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
/* doio.c
*
* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
@@ -34,6 +38,10 @@
#endif
#endif
+#if defined(HAS_GETGROUPS) && defined(__sun)
+#include <alloca.h>
+#endif
+
#ifdef I_UTIME
# if defined(_MSC_VER) || defined(__MINGW32__)
# include <sys/utime.h>
@@ -1877,13 +1885,21 @@ Perl_ingroup(pTHX_ Gid_t testgid, Uid_t effective)
return TRUE;
#ifdef HAS_GETGROUPS
#ifndef NGROUPS
-#define NGROUPS 32
+#define NGROUPS 32
#endif
{
- Groups_t gary[NGROUPS];
I32 anum;
+#ifdef __sun
+ int maxgrp = getgroups(0, NULL);
+ Groups_t *gary = alloca(maxgrp * sizeof (Groups_t));
+
+ anum = getgroups(maxgrp,gary);
+#else
+ Groups_t gary[NGROUPS];
anum = getgroups(NGROUPS,gary);
+#endif
+
while (--anum >= 0)
if (gary[anum] == testgid)
return TRUE;
diff --git a/usr/src/cmd/perl/5.8.4/distrib/mg.c b/usr/src/cmd/perl/5.8.4/distrib/mg.c
index 76ef523323..8dd7ef239c 100644
--- a/usr/src/cmd/perl/5.8.4/distrib/mg.c
+++ b/usr/src/cmd/perl/5.8.4/distrib/mg.c
@@ -1,3 +1,7 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
/* mg.c
*
* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
@@ -28,6 +32,10 @@
# ifdef I_GRP
# include <grp.h>
# endif
+#ifdef __sun
+#include <alloca.h>
+#include <unistd.h>
+#endif
#endif
#ifdef __hpux
@@ -891,8 +899,14 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
add_groups:
#ifdef HAS_GETGROUPS
{
+#ifdef __sun
+ int maxgrp = getgroups(0, NULL);
+ Groups_t *gary = alloca(maxgrp * sizeof (Groups_t));
+ i = getgroups(maxgrp,gary);
+#else
Groups_t gary[NGROUPS];
i = getgroups(NGROUPS,gary);
+#endif
while (--i >= 0)
Perl_sv_catpvf(aTHX_ sv, " %"Gid_t_f, gary[i]);
}
@@ -2368,12 +2382,18 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
#ifdef HAS_SETGROUPS
{
char *p = SvPV(sv, len);
+#ifdef _SC_NGROUPS_MAX
+ int maxgrp = sysconf(_SC_NGROUPS_MAX);
+ Groups_t *gary = alloca(maxgrp * sizeof (Groups_t));
+#else
+ int maxgrp = NGROUPS;
Groups_t gary[NGROUPS];
+#endif
while (isSPACE(*p))
++p;
PL_egid = Atol(p);
- for (i = 0; i < NGROUPS; ++i) {
+ for (i = 0; i < maxgrp; ++i) {
while (*p && !isSPACE(*p))
++p;
while (isSPACE(*p))