1.\" $NetBSD: revnetgroup.8,v 1.14 2017/07/03 21:35:32 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 February 26, 2005 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 hu 42.Op Fl f Ar netgroup_file 43.Sh DESCRIPTION 44.Nm 45processes the contents of a file in 46.Xr netgroup 5 47format into what is called 48.Pa reverse netgroup 49form. That is, where the original file shows 50netgroup memberships in terms of which members reside in a particular 51group, the reverse netgroup format specifies what groups are associated 52with a particular member. This information is used to generate the 53.Pa netgroup.byuser 54and 55.Pa netgroup.byhosts 56.Tn NIS 57maps. These reverse netgroup maps are used to help speed up 58netgroup lookups, particularly for the 59.Fn innetgr 60library function. 61.Pp 62For example, the standard 63.Pa /etc/netgroup 64file may list a netgroup and a list of its members. Here, the 65netgroup is considered the 66.Pa key 67and the member names are the 68.Pa data . 69By contrast, the reverse 70.Pa netgroup.byusers 71database lists each unique 72member as the key and the netgroups to which the members belong become 73the data. Separate databases are created to hold information pertaining 74to users and hosts; this allows netgroup username lookups 75and netgroup hostname lookups to be performed using independent keyspaces. 76.Pp 77By constructing these reverse netgroup databases (and the corresponding 78.Tn NIS 79maps) in advance, the 80.Xr getnetgrent 3 81library functions are spared from having to work out the dependencies 82themselves on the fly. This is important on networks with large numbers 83of users and hosts, since it can take a considerable amount of time 84to process very large netgroup databases. 85.Pp 86The 87.Nm 88command prints its results on the standard output. It is usually called 89only by 90.Pa /var/yp/<domain>/Makefile 91when rebuilding the 92.Tn NIS 93netgroup maps. 94.Sh OPTIONS 95The 96.Nm 97command supports the following options: 98.Bl -tag -width flag 99.It Fl u 100Generate netgroup.byuser output; only username information in the 101original netgroup file is processed. 102.It Fl h 103Generate netgroup.byhost output; only hostname information in the 104original netgroup file is processed. (Note at least one of the 105.Fl u 106or 107.Fl h 108flags must be specified.) 109.It Op Fl f Ar netgroup_file 110The 111.Nm 112command uses 113.Pa /etc/netgroup 114as its default input file. The 115.Fl f 116flag allows the user to specify an alternate input file. Specifying ``-'' 117as the input file causes 118.Nm 119to read from the standard input. 120.El 121.Sh FILES 122.Bl -tag -width Pa -compact 123.It Pa /var/yp/<domain>/Makefile 124The Makefile that calls 125.Nm makedbm 126and 127.Nm revnetgroup 128to build the 129.Tn NIS 130databases. 131.It Pa /etc/netgroup 132The default netgroup database file. This file is most often found 133only on the 134.Tn NIS 135master server. 136.El 137.Sh SEE ALSO 138.Xr getnetgrent 3 , 139.Xr netgroup 5 , 140.Xr makedbm 8 , 141.Xr nis 8 142.Sh AUTHORS 143.An Bill Paul Aq Mt wpaul@ctr.columbia.edu 144