1 .\" Copyright (c) 1989, 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" From: @(#)getgrent.3 8.2 (Berkeley) 4/19/94
33 .\" $FreeBSD: src/lib/libc/gen/getgrent.3,v 1.12.2.4 2003/03/15 15:11:05 trhodes Exp $
35 .Dd September 29, 1994
46 .Nd group database operations
55 .Fn getgrnam "const char *name"
57 .Fn getgrgid "gid_t gid"
59 .Fn setgroupent "int stayopen"
61 .\" .Fn setgrfile "const char *name"
67 These functions operate on the group database file
72 Each line of the database is defined by the structure
77 .Bd -literal -offset indent
79 char *gr_name; /* group name */
80 char *gr_passwd; /* group password */
81 int gr_gid; /* group id */
82 char **gr_mem; /* group members */
90 search the group database for the given group name pointed to by
92 or the group id pointed to by
94 respectively, returning the first one encountered. Identical group
95 names or group gids may result in undefined behavior.
100 sequentially reads the group database and is intended for programs
101 that wish to step through the complete list of groups.
103 All three routines will open the group file for reading, if necessary.
108 opens the file, or rewinds it if it is already open. If
110 is non-zero, file descriptors are left open, significantly speeding
111 functions subsequent calls. This functionality is unnecessary for
113 as it doesn't close its file descriptors by default. It should also
114 be noted that it is dangerous for long-running programs to use this
115 functionality as the group file may be updated.
122 with an argument of zero.
127 closes any open files.
128 .Sh YP/NIS INTERACTION
131 group database is enabled, the
135 functions use the YP maps
139 respectively, if the requested group is not found in the local
143 function will step through the YP map
145 if the entire map is enabled as described in
153 return a pointer to the group entry if successful; if end-of-file
154 is reached or an error occurs a null pointer is returned.
159 return the value 1 if successful, otherwise the value
165 have no return value.
167 .Bl -tag -width /etc/group -compact
192 The historic function
194 which allowed the specification of alternate password databases, has
195 been deprecated and is no longer available.
204 leave their results in an internal static object and return
205 a pointer to that object.
208 will modify the same object.