summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc')
-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);
}