xref: /csrg-svn/lib/libc/gen/initgroups.3 (revision 61111)
1*61111Sbostic.\" Copyright (c) 1983, 1991, 1993
2*61111Sbostic.\"	The Regents of the University of California.  All rights reserved.
320542Smckusick.\"
448352Scael.\" %sccs.include.redist.man%
520542Smckusick.\"
6*61111Sbostic.\"     @(#)initgroups.3	8.1 (Berkeley) 06/04/93
748352Scael.\"
848352Scael.Dd
948352Scael.Dt INITGROUPS 3
1048352Scael.Os BSD 4.2
1148352Scael.Sh NAME
1248352Scael.Nm initgroups
1348352Scael.Nd initialize group access list
1448352Scael.Sh SYNOPSIS
1548352Scael.Fd #include <unistd.h>
1648352Scael.Ft int
1748352Scael.Fn initgroups "const char *name" "int basegid"
1848352Scael.Sh DESCRIPTION
1948352ScaelThe
2048352Scael.Fn initgroups
2148352Scaelfunction
2251664Smckusickuses the
2351664Smckusick.Xr getgrouplist 3
2451664Smckusickfunction to calculate the group access list for the user
2520542Smckusickspecified in
2648352Scael.Fa name .
2751664SmckusickThis group list is then setup for the current process using
2851664Smckusick.Xr setgroups 2 .
2920542SmckusickThe
3048352Scael.Fa basegid
3120542Smckusickis automatically included in the groups list.
3220542SmckusickTypically this value is given as
3320542Smckusickthe group number from the password file.
3448352Scael.Sh RETURN VALUES
3548352ScaelThe
3648352Scael.Fn initgroups
3748352Scaelfunction
3820542Smckusickreturns \-1 if it was not invoked by the super-user.
3948352Scael.Sh SEE ALSO
4048352Scael.Xr setgroups 2 ,
4151664Smckusick.Xr getgrouplist 3
4248352Scael.Sh HISTORY
4348352ScaelThe
4448352Scael.Nm
4548352Scaelfunction appeared in
4648352Scael.Bx 4.2 .
4748352Scael.Sh BUGS
4848352ScaelThe
4951664Smckusick.Fn getgrouplist
5051664Smckusickfunction called by
5151664Smckusick.Nm
5220542Smckusickuses the routines based on
5348352Scael.Xr getgrent 3 .
5420542SmckusickIf the invoking program uses any of these routines,
5520542Smckusickthe group structure will
5620542Smckusickbe overwritten in the call to
5748352Scael.Fn initgroups .
58