1.\"	$NetBSD: revnetgroup.8,v 1.7 2002/02/11 10:44:38 wiz Exp $
2.\"
3.\" Copyright (c) 1995
4.\"	Bill Paul <wpaul@ctr.columbia.edu>.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. All advertising materials mentioning features or use of this software
15.\"    must display the following acknowledgement:
16.\"	This product includes software developed by Bill Paul.
17.\" 4. Neither the name of the University nor the names of its contributors
18.\"    may be used to endorse or promote products derived from this software
19.\"    without specific prior written permission.
20.\"
21.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
22.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24.\" ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR CONTRIBUTORS BE LIABLE
25.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31.\" SUCH DAMAGE.
32.\"
33.Dd October 24, 1995
34.Dt REVNETGROUP 8
35.Os
36.Sh NAME
37.Nm revnetgroup
38.Nd generate reverse netgroup data
39.Sh SYNOPSIS
40.Nm ""
41.Op Fl uh
42.Bk -words
43.Op Fl f Ar netgroup_file
44.Ek
45.Sh DESCRIPTION
46.Nm
47processes the contents of a file in
48.Xr netgroup 5
49format into what is called
50.Pa reverse netgroup
51form. That is, where the original file shows
52netgroup memberships in terms of which members reside in a particular
53group, the reverse netgroup format specifies what groups are associated
54with a particular member. This information is used to generate the
55.Pa netgroup.byuser
56and
57.Pa netgroup.byhosts
58.Tn YP
59maps. These reverse netgroup maps are used to help speed up
60netgroup lookups, particularly for the
61.Fn innetgr
62library function.
63.Pp
64For example, the standard
65.Pa /etc/netgroup
66file may list a netgroup and a list of its members. Here, the
67netgroup is considered the
68.Pa key
69and the member names are the
70.Pa data .
71By contrast, the reverse
72.Pa netgroup.byusers
73database lists each unique
74member as the key and the netgroups to which the members belong become
75the data. Separate databases are created to hold information pertaining
76to users and hosts; this allows netgroup username lookups
77and netgroup hostname lookups to be performed using independent keyspaces.
78.Pp
79By constructing these reverse netgroup databases (and the corresponding
80.Tn YP
81maps) in advance, the
82.Xr getnetgrent 3
83library functions are spared from having to work out the dependencies
84themselves on the fly. This is important on networks with large numbers
85of users and hosts, since it can take a considerable amount of time
86to process very large netgroup databases.
87.Pp
88The
89.Nm
90command prints its results on the standard output. It is usually called
91only by
92.Pa /var/yp/\*[Lt]domain\*[Gt]/Makefile
93when rebuilding the
94.Tn YP
95netgroup maps.
96.Sh OPTIONS
97The
98.Nm
99command supports the following options:
100.Bl -tag -width flag
101.It Fl u
102Generate netgroup.byuser output; only username information in the
103original netgroup file is processed.
104.It Fl h
105Generate netgroup.byhost output; only hostname information in the
106original netgroup file is processed. (Note at least one of the
107.Fl u
108or
109.Fl h
110flags must be specified.)
111.It Op Fl f Ar netgroup_file
112The
113.Nm
114command uses
115.Pa /etc/netgroup
116as its default input file. The
117.Fl f
118flag allows the user to specify an alternate input file. Specifying ``-''
119as the input file causes
120.Nm
121to read from the standard input.
122.El
123.Sh FILES
124.Bl -tag -width Pa -compact
125.It Pa /var/yp/\*[Lt]domain\*[Gt]/Makefile
126The Makefile that calls
127.Nm makedbm
128and
129.Nm revnetgroup
130to build the
131.Tn YP
132databases.
133.It Pa /etc/netgroup
134The default netgroup database file. This file is most often found
135only on the
136.Tn YP
137master server.
138.El
139.Sh SEE ALSO
140.Xr getnetgrent 3 ,
141.Xr netgroup 5 ,
142.Xr makedbm 8 ,
143.Xr yp 8
144.Sh AUTHORS
145.An Bill Paul Aq wpaul@ctr.columbia.edu
146