NGROUPS_MAX

Sven Rudolph rudsve at drewag.de
Wed Sep 25 20:28:50 EST 2002


Currently openssh (3.4p1) relies on the NGROUPS_MAX define. This makes
the number of allowed simultaneous (per-user) secondary groups a
compile-time decision.

$ find . -name \*.c | xargs grep NGROUPS_MAX
./groupaccess.c:static char *groups_byname[NGROUPS_MAX + 1];    /* +1 for base/primary group */
./groupaccess.c:        gid_t groups_bygid[NGROUPS_MAX + 1];
./uidswap.c:static gid_t        saved_egroups[NGROUPS_MAX], user_groups[NGROUPS_MAX];
./uidswap.c:    saved_egroupslen = getgroups(NGROUPS_MAX, saved_egroups);
./uidswap.c:            user_groupslen = getgroups(NGROUPS_MAX, user_groups);

POSIX defined sysconf in order to avoid this.

By using sysconf(_SC_NGROUPS_MAX) this value is determined at
run-time.

	Sven



More information about the openssh-unix-dev mailing list