summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1999-03-29 21:27:32 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1999-03-29 21:27:32 +0000
commitb25a9227e193b4bbc5fa6a2920cd924fe5a9bc7d (patch)
tree4de0e539f608153e1c9891dc5af86a480a005cb1
parent9a04a43e3ffadee008b420b016c890d76fbcd289 (diff)
initgroups(3) should not spew to stderr; giles@nemeton.com.au
Also document the NGROUPS limit.
-rw-r--r--lib/libc/gen/initgroups.310
-rw-r--r--lib/libc/gen/initgroups.c10
2 files changed, 12 insertions, 8 deletions
diff --git a/lib/libc/gen/initgroups.3 b/lib/libc/gen/initgroups.3
index 8dc8d96e391..f4372d11ff3 100644
--- a/lib/libc/gen/initgroups.3
+++ b/lib/libc/gen/initgroups.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: initgroups.3,v 1.3 1996/08/19 08:24:22 tholo Exp $
+.\" $OpenBSD: initgroups.3,v 1.4 1999/03/29 21:27:30 millert Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -57,6 +57,14 @@ The
is automatically included in the group list.
Typically this value is given as
the group number from the password file.
+.Pp
+If the groups database lists more than
+.Ev NGROUPS
+groups for
+.Fa name
+(including one for
+.Fa basegid ) ,
+the later groups are ignored.
.Sh RETURN VALUES
The
.Fn initgroups
diff --git a/lib/libc/gen/initgroups.c b/lib/libc/gen/initgroups.c
index 179781e8726..8ded71188c5 100644
--- a/lib/libc/gen/initgroups.c
+++ b/lib/libc/gen/initgroups.c
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: initgroups.c,v 1.4 1997/08/24 21:25:46 millert Exp $";
+static char rcsid[] = "$OpenBSD: initgroups.c,v 1.5 1999/03/29 21:27:31 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -50,12 +50,8 @@ initgroups(uname, agroup)
int ngroups;
ngroups = NGROUPS;
- if (getgrouplist(uname, agroup, groups, &ngroups) < 0)
- _warnx("%s is in too many groups, using first %d",
- uname, ngroups);
- if (setgroups(ngroups, groups) < 0) {
- _warn("setgroups");
+ (void) getgrouplist(uname, agroup, groups, &ngroups);
+ if (setgroups(ngroups, groups) < 0)
return (-1);
- }
return (0);
}