svn commit: r192083 - in projects/ngroups: lib/libc/rpc
usr.sbin/mountd
Brooks Davis
brooks at FreeBSD.org
Thu May 14 03:51:55 UTC 2009
Author: brooks
Date: Thu May 14 03:51:53 2009
New Revision: 192083
URL: http://svn.freebsd.org/changeset/base/192083
Log:
Switch a couple instances of NGROUPS to NGRPS where the use case is RPC
credentials.
Modified:
projects/ngroups/lib/libc/rpc/netnamer.c
projects/ngroups/usr.sbin/mountd/mountd.c
Modified: projects/ngroups/lib/libc/rpc/netnamer.c
==============================================================================
--- projects/ngroups/lib/libc/rpc/netnamer.c Thu May 14 03:42:58 2009 (r192082)
+++ projects/ngroups/lib/libc/rpc/netnamer.c Thu May 14 03:51:53 2009 (r192083)
@@ -66,10 +66,6 @@ static char *NETIDFILE = "/etc/netid"
static int getnetid( char *, char * );
static int _getgroups( char *, gid_t * );
-#ifndef NGROUPS
-#define NGROUPS 16
-#endif
-
/*
* Convert network-name into unix credential
*/
@@ -104,7 +100,7 @@ netname2user(netname, uidp, gidp, gidlen
return (0);
}
*gidp = (gid_t) atol(p);
- for (gidlen = 0; gidlen < NGROUPS; gidlen++) {
+ for (gidlen = 0; gidlen < NGRPS; gidlen++) {
p = strsep(&res, "\n,");
if (p == NULL)
break;
@@ -157,7 +153,7 @@ netname2user(netname, uidp, gidp, gidlen
static int
_getgroups(uname, groups)
char *uname;
- gid_t groups[NGROUPS];
+ gid_t groups[NGRPS];
{
gid_t ngroups = 0;
struct group *grp;
@@ -169,7 +165,7 @@ _getgroups(uname, groups)
while ((grp = getgrent())) {
for (i = 0; grp->gr_mem[i]; i++)
if (!strcmp(grp->gr_mem[i], uname)) {
- if (ngroups == NGROUPS) {
+ if (ngroups == NGRPS) {
#ifdef DEBUG
fprintf(stderr,
"initgroups: %s is in too many groups\n", uname);
Modified: projects/ngroups/usr.sbin/mountd/mountd.c
==============================================================================
--- projects/ngroups/usr.sbin/mountd/mountd.c Thu May 14 03:42:58 2009 (r192082)
+++ projects/ngroups/usr.sbin/mountd/mountd.c Thu May 14 03:51:53 2009 (r192083)
@@ -2473,7 +2473,7 @@ parsecred(namelist, cr)
char *names;
struct passwd *pw;
struct group *gr;
- gid_t groups[NGROUPS + 1];
+ gid_t groups[NGRPS + 1];
int ngroups;
cr->cr_version = XUCRED_VERSION;
@@ -2501,7 +2501,7 @@ parsecred(namelist, cr)
return;
}
cr->cr_uid = pw->pw_uid;
- ngroups = NGROUPS + 1;
+ ngroups = NGRPS + 1;
if (getgrouplist(pw->pw_name, pw->pw_gid, groups, &ngroups))
syslog(LOG_ERR, "too many groups");
/*
@@ -2526,7 +2526,7 @@ parsecred(namelist, cr)
return;
}
cr->cr_ngroups = 0;
- while (names != NULL && *names != '\0' && cr->cr_ngroups < NGROUPS) {
+ while (names != NULL && *names != '\0' && cr->cr_ngroups < NGRPS) {
name = strsep(&names, ":");
if (isdigit(*name) || *name == '-') {
cr->cr_groups[cr->cr_ngroups++] = atoi(name);
@@ -2538,7 +2538,7 @@ parsecred(namelist, cr)
cr->cr_groups[cr->cr_ngroups++] = gr->gr_gid;
}
}
- if (names != NULL && *names != '\0' && cr->cr_ngroups == NGROUPS)
+ if (names != NULL && *names != '\0' && cr->cr_ngroups == NGRPS)
syslog(LOG_ERR, "too many groups");
}
More information about the svn-src-projects
mailing list