xref: /original-bsd/lib/libc/gen/getnetgrent.3 (revision c3e32dec)
1.\" Copyright (c) 1992, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)getnetgrent.3	8.1 (Berkeley) 06/04/93
7.\"
8.Dd
9.Dt GETNETGRENT 3
10.Os
11.Sh NAME
12.Nm getnetgrent ,
13.Nm innetgr ,
14.Nm setnetgrent ,
15.Nm endnetgrent
16.Nd netgroup database operations
17.Sh SYNOPSIS
18.Ft int
19.Fn getnetgrent "char **host, char **user, char **domain"
20.Ft int
21.Fn innetgr "const char *netgroup, const char *host, const char *user, const char *domain"
22.Ft void
23.Fn setnetgrent "const char *netgroup"
24.Ft void
25.Fn endnetgrent void
26.Sh DESCRIPTION
27These functions operate on the netgroup database file
28.Pa /etc/netgroup
29which is described
30in
31.Xr netgroup 5 .
32The database defines a set of netgroups, each made up of one or more triples:
33.Bd -literal -offset indent
34(host, user, domain)
35.Ed
36that defines a combination of host, user and domain.
37Any of the three fields may be specified as ``wildcards'' that match any
38string.
39.Pp
40The function
41.Fn getnetgrent
42sets the three pointer arguments to the strings of the next member of the
43current netgroup.
44If any of the string pointers are
45.Sy (char *)0
46that field is considered a wildcard.
47.Pp
48The functions
49.Fn setnetgrent
50and
51.Fn endnetgrent
52set the current netgroup and terminate the current netgroup respectively.
53If
54.Fn setnetgrent
55is called with a different netgroup than the previous call, an implicit
56.Fn endnetgrent
57is implied.
58.Fn Setnetgrent
59also sets the offset to the first member of the netgroup.
60.Pp
61The function
62.Fn innetgr
63searches for a match of all fields within the specified group.
64If any of the
65.Sy host ,
66.Sy user ,
67or
68.Sy domain
69arguments are
70.Sy (char *)0
71those fields will match any string value in the netgroup member.
72.Sh RETURN VALUES
73The function
74.Fn getnetgrent
75returns 0 for ``no more netgroup members'' and 1 otherwise.
76The function
77.Fn innetgr
78returns 1 for a successful match and 0 otherwise.
79The functions
80.Fn setnetgrent
81and
82.Fn endnetgrent
83have no return value.
84.Sh FILES
85.Bl -tag -width /etc/netgroup -compact
86.It Pa /etc/netgroup
87netgroup database file
88.El
89.Sh SEE ALSO
90.Fn netgroup 5
91.Sh COMPATIBILITY
92The netgroup members have three string fields to maintain compatibility
93with other vendor implementations, however it is not obvious what use the
94.Sy domain
95string has within BSD.
96.Sh BUGS
97The function
98.Fn getnetgrent
99returns pointers to dynamically allocated data areas that are free'd when
100the function
101.Fn endnetgrent
102is called.
103