1.\" $OpenBSD: revnetgroup.8,v 1.14 2019/03/20 04:52:28 schwarze 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.\" $FreeBSD: revnetgroup.8,v 1.4 1997/02/22 14:22:03 peter Exp $ 34.\" 35.Dd $Mdocdate: March 20 2019 $ 36.Dt REVNETGROUP 8 37.Os 38.Sh NAME 39.Nm revnetgroup 40.Nd generate reverse netgroup data 41.Sh SYNOPSIS 42.Nm revnetgroup 43.Fl h | u 44.Op Fl f Ar netgroup_file 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. 52That is, where the original file shows 53netgroup memberships in terms of which members reside in a particular 54group, the reverse netgroup format specifies what groups are associated 55with a particular member. 56This information is used to generate the 57.Pa netgroup.byuser 58and 59.Pa netgroup.byhosts 60YP maps. 61These 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. 69Here, the netgroup is considered the 70.Pa key 71and the member names are the 72.Pa 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. 78Separate databases are created to hold information pertaining 79to users and hosts; this allows netgroup username lookups 80and netgroup hostname lookups to be performed using independent keyspaces. 81.Pp 82By constructing these reverse netgroup databases (and the corresponding 83YP maps) in advance, the 84.Xr getnetgrent 3 85library functions are spared from having to work out the dependencies 86themselves on the fly. 87This is important on networks with large numbers 88of users and hosts, since it can take a considerable amount of time 89to process very large netgroup databases. 90.Pp 91The 92.Nm 93command prints its results on the standard output. 94It is usually called only by 95.Pa /var/yp/<domain>/Makefile 96when rebuilding the YP netgroup maps. 97.Pp 98The options are as follows: 99.Bl -tag -width Ds 100.It Fl f Ar netgroup_file 101The 102.Nm 103command uses 104.Pa /etc/netgroup 105as its default input file. 106The 107.Fl f 108flag allows the user to specify an alternate input file. 109Specifying 110.Dq - 111as the input file causes 112.Nm 113to read from the standard input. 114.It Fl h 115Generate netgroup.byhost output; only hostname information in the 116original netgroup file is processed. 117.It Fl u 118Generate netgroup.byuser output; only username information in the 119original netgroup file is processed. 120.El 121.Sh FILES 122.Bl -tag -width xxxxxxxxxxxxxxxxxxxxxxxx -compact 123.It Pa /var/yp/<domain>/Makefile 124The Makefile that calls 125.Xr makedbm 8 126and 127.Nm 128to build the YP databases. 129.It Pa /etc/netgroup 130The default netgroup database file. 131This file is most often found only on the YP master server. 132.El 133.Sh SEE ALSO 134.Xr getnetgrent 3 , 135.Xr netgroup 5 , 136.Xr makedbm 8 , 137.Xr yp 8 138.Sh AUTHORS 139.An Bill Paul Aq Mt wpaul@ctr.columbia.edu 140