[BACK]Return to getgrouplist.3 CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libc / gen

Annotation of src/lib/libc/gen/getgrouplist.3, Revision 1.13

1.13    ! lukem       1: .\"    $NetBSD: getgrouplist.3,v 1.12 2004/09/28 13:59:48 wiz Exp $
        !             2: .\"
        !             3: .\" Copyright (c) 2005 The NetBSD Foundation, Inc.
        !             4: .\" All rights reserved.
        !             5: .\"
        !             6: .\" This code is derived from software contributed to The NetBSD Foundation
        !             7: .\" by Luke Mewburn.
        !             8: .\"
        !             9: .\" Redistribution and use in source and binary forms, with or without
        !            10: .\" modification, are permitted provided that the following conditions
        !            11: .\" are met:
        !            12: .\" 1. Redistributions of source code must retain the above copyright
        !            13: .\"    notice, this list of conditions and the following disclaimer.
        !            14: .\" 2. Redistributions in binary form must reproduce the above copyright
        !            15: .\"    notice, this list of conditions and the following disclaimer in the
        !            16: .\"    documentation and/or other materials provided with the distribution.
        !            17: .\" 3. All advertising materials mentioning features or use of this software
        !            18: .\"    must display the following acknowledgement:
        !            19: .\"        This product includes software developed by the NetBSD
        !            20: .\"        Foundation, Inc. and its contributors.
        !            21: .\" 4. Neither the name of The NetBSD Foundation nor the names of its
        !            22: .\"    contributors may be used to endorse or promote products derived
        !            23: .\"    from this software without specific prior written permission.
        !            24: .\"
        !            25: .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
        !            26: .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
        !            27: .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
        !            28: .\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
        !            29: .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
        !            30: .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
        !            31: .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
        !            32: .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
        !            33: .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
        !            34: .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
        !            35: .\" POSSIBILITY OF SUCH DAMAGE.
1.2       cgd        36: .\"
1.1       cgd        37: .\" Copyright (c) 1991, 1993
                     38: .\"    The Regents of the University of California.  All rights reserved.
                     39: .\"
                     40: .\" Redistribution and use in source and binary forms, with or without
                     41: .\" modification, are permitted provided that the following conditions
                     42: .\" are met:
                     43: .\" 1. Redistributions of source code must retain the above copyright
                     44: .\"    notice, this list of conditions and the following disclaimer.
                     45: .\" 2. Redistributions in binary form must reproduce the above copyright
                     46: .\"    notice, this list of conditions and the following disclaimer in the
                     47: .\"    documentation and/or other materials provided with the distribution.
1.10      agc        48: .\" 3. Neither the name of the University nor the names of its contributors
1.1       cgd        49: .\"    may be used to endorse or promote products derived from this software
                     50: .\"    without specific prior written permission.
                     51: .\"
                     52: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     53: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     54: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     55: .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     56: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     57: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     58: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     59: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     60: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     61: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     62: .\" SUCH DAMAGE.
                     63: .\"
                     64: .\"     @(#)getgrouplist.3     8.1 (Berkeley) 6/9/93
                     65: .\"
1.13    ! lukem      66: .Dd January 6, 2005
1.1       cgd        67: .Dt GETGROUPLIST 3
                     68: .Os
                     69: .Sh NAME
1.13    ! lukem      70: .Nm getgrouplist ,
        !            71: .Nm getgroupmembership ,
1.1       cgd        72: .Nd calculate group access list
1.5       perry      73: .Sh LIBRARY
                     74: .Lb libc
1.1       cgd        75: .Sh SYNOPSIS
1.9       wiz        76: .In unistd.h
1.1       cgd        77: .Ft int
1.3       jtc        78: .Fn getgrouplist "const char *name" "gid_t basegid" "gid_t *groups" "int *ngroups"
1.13    ! lukem      79: .Ft int
        !            80: .Fn getgroupmembership "const char *name" "gid_t basegid" "gid_t *groups" "int maxgrp" "int *ngroups"
1.1       cgd        81: .Sh DESCRIPTION
                     82: The
                     83: .Fn getgrouplist
1.13    ! lukem      84: and
        !            85: .Fn getgroupmembership
        !            86: functions read through the group database and calculate
1.1       cgd        87: the group access list for the user specified in
                     88: .Fa name .
                     89: The
                     90: .Fa basegid
                     91: is automatically included in the groups list.
                     92: Typically this value is given as
1.6       lukem      93: the group number from the password database.
1.1       cgd        94: .Pp
                     95: The resulting group list is returned in the integer array pointed to by
                     96: .Fa groups .
1.13    ! lukem      97: .Pp
        !            98: For
        !            99: .Fn getgrouplist ,
        !           100: the caller specifies the size of the
1.1       cgd       101: .Fa groups
                    102: array in the integer pointed to by
1.13    ! lukem     103: .Fa ngroups .
        !           104: .Pp
        !           105: For
        !           106: .Fn getgroupmembership ,
        !           107: the caller specifies the size of the
        !           108: .Fa groups
        !           109: array in
        !           110: .Fa maxgrp .
        !           111: .Pp
        !           112: The actual number of groups found is returned in
1.1       cgd       113: .Fa ngroups .
1.6       lukem     114: .Pp
                    115: Duplicate group ids will be suppressed from the result.
1.1       cgd       116: .Sh RETURN VALUES
                    117: The
                    118: .Fn getgrouplist
1.13    ! lukem     119: and
        !           120: .Fn getgroupmembership
        !           121: functions
        !           122: return 0 if successful, and
        !           123: return \-1 if the size of the group list is too small to
1.1       cgd       124: hold all the user's groups.
1.11      lukem     125: In the latter case, the
                    126: .Fa groups
                    127: array will be filled with as many groups as will fit and
                    128: .Fa ngroups
                    129: will contain the total number of groups found.
1.1       cgd       130: .Sh FILES
                    131: .Bl -tag -width /etc/group -compact
                    132: .It Pa /etc/group
                    133: group membership list
                    134: .El
                    135: .Sh SEE ALSO
                    136: .Xr setgroups 2 ,
1.11      lukem     137: .Xr initgroups 3 ,
1.12      wiz       138: .Xr group 5
1.1       cgd       139: .Sh HISTORY
                    140: The
                    141: .Fn getgrouplist
1.4       perry     142: function first appeared in
                    143: .Bx 4.4 .
1.13    ! lukem     144: The
        !           145: .Fn getgroupmembership
        !           146: function first appeared in
        !           147: .Nx 3.0
        !           148: to address an API deficiency in
        !           149: .Fn getgrouplist .
1.1       cgd       150: .Sh BUGS
                    151: The
                    152: .Fn getgrouplist
                    153: function
                    154: uses the routines based on
                    155: .Xr getgrent 3 .
                    156: If the invoking program uses any of these routines,
                    157: the group structure will
                    158: be overwritten in the call to
                    159: .Fn getgrouplist .

CVSweb <webmaster@jp.NetBSD.org>