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