document getgroupmembership(3)

This commit is contained in:
lukem 2005-01-06 15:29:35 +00:00
parent 709d468844
commit b351350a6f
3 changed files with 73 additions and 12 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.752 2005/01/03 06:00:13 lukem Exp $
# $NetBSD: mi,v 1.753 2005/01/06 15:30:27 lukem Exp $
./etc/mtree/set.comp comp-sys-root
./usr/bin/addr2line comp-debug-bin bfd
./usr/bin/ar comp-util-bin bfd
@ -3107,6 +3107,7 @@
./usr/share/man/cat3/getgrnam.0 comp-c-catman .cat
./usr/share/man/cat3/getgrnam_r.0 comp-c-catman .cat
./usr/share/man/cat3/getgrouplist.0 comp-c-catman .cat
./usr/share/man/cat3/getgroupmembership.0 comp-c-catman .cat
./usr/share/man/cat3/gethostbyaddr.0 comp-c-catman .cat
./usr/share/man/cat3/gethostbyname.0 comp-c-catman .cat
./usr/share/man/cat3/gethostbyname2.0 comp-c-catman .cat
@ -6942,6 +6943,7 @@
./usr/share/man/man3/getgrnam.3 comp-c-man .man
./usr/share/man/man3/getgrnam_r.3 comp-c-man .man
./usr/share/man/man3/getgrouplist.3 comp-c-man .man
./usr/share/man/man3/getgroupmembership.3 comp-c-man .man
./usr/share/man/man3/gethostbyaddr.3 comp-c-man .man
./usr/share/man/man3/gethostbyname.3 comp-c-man .man
./usr/share/man/man3/gethostbyname2.3 comp-c-man .man

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.139 2005/01/06 15:10:45 lukem Exp $
# $NetBSD: Makefile.inc,v 1.140 2005/01/06 15:29:35 lukem Exp $
# from: @(#)Makefile.inc 8.6 (Berkeley) 5/4/95
# gen sources
@ -98,6 +98,7 @@ MLINKS+=getfsent.3 endfsent.3 getfsent.3 getfsfile.3 getfsent.3 getfsspec.3 \
MLINKS+=getgrent.3 endgrent.3 getgrent.3 setgroupent.3 getgrent.3 getgrgid.3 \
getgrent.3 getgrnam.3 getgrent.3 setgrent.3
MLINKS+=getgrent.3 getgrgid_r.3 getgrent.3 getgrnam_r.3
MLINKS+=getgrouplist.3 getgroupmembership.3
MLINKS+=gethostname.3 sethostname.3
MLINKS+=getlastlogx.3 getutmp.3 getlastlogx.3 getutmpx.3
MLINKS+=getlastlogx.3 updlastlogx.3 getlastlogx.3 updwtmpx.3

View File

@ -1,4 +1,38 @@
.\" $NetBSD: getgrouplist.3,v 1.12 2004/09/28 13:59:48 wiz Exp $
.\" $NetBSD: getgrouplist.3,v 1.13 2005/01/06 15:29:35 lukem Exp $
.\"
.\" Copyright (c) 2005 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Luke Mewburn.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the NetBSD
.\" Foundation, Inc. and its contributors.
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
.\" contributors may be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.\" Copyright (c) 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -29,11 +63,12 @@
.\"
.\" @(#)getgrouplist.3 8.1 (Berkeley) 6/9/93
.\"
.Dd September 28, 2004
.Dd January 6, 2005
.Dt GETGROUPLIST 3
.Os
.Sh NAME
.Nm getgrouplist
.Nm getgrouplist ,
.Nm getgroupmembership ,
.Nd calculate group access list
.Sh LIBRARY
.Lb libc
@ -41,10 +76,14 @@
.In unistd.h
.Ft int
.Fn getgrouplist "const char *name" "gid_t basegid" "gid_t *groups" "int *ngroups"
.Ft int
.Fn getgroupmembership "const char *name" "gid_t basegid" "gid_t *groups" "int maxgrp" "int *ngroups"
.Sh DESCRIPTION
The
.Fn getgrouplist
function reads through the group database and calculates
and
.Fn getgroupmembership
functions read through the group database and calculate
the group access list for the user specified in
.Fa name .
The
@ -55,20 +94,33 @@ the group number from the password database.
.Pp
The resulting group list is returned in the integer array pointed to by
.Fa groups .
The caller specifies the size of the
.Pp
For
.Fn getgrouplist ,
the caller specifies the size of the
.Fa groups
array in the integer pointed to by
.Fa ngroups ;
the actual number of groups found is returned in
.Fa ngroups .
.Pp
For
.Fn getgroupmembership ,
the caller specifies the size of the
.Fa groups
array in
.Fa maxgrp .
.Pp
The actual number of groups found is returned in
.Fa ngroups .
.Pp
Duplicate group ids will be suppressed from the result.
.Sh RETURN VALUES
The
.Fn getgrouplist
function
returns 0 if successful, and
returns \-1 if the size of the group list is too small to
and
.Fn getgroupmembership
functions
return 0 if successful, and
return \-1 if the size of the group list is too small to
hold all the user's groups.
In the latter case, the
.Fa groups
@ -89,6 +141,12 @@ The
.Fn getgrouplist
function first appeared in
.Bx 4.4 .
The
.Fn getgroupmembership
function first appeared in
.Nx 3.0
to address an API deficiency in
.Fn getgrouplist .
.Sh BUGS
The
.Fn getgrouplist