111814Swpaul/* 211814Swpaul * Copyright (c) 1995 311814Swpaul * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 411814Swpaul * 511814Swpaul * Redistribution and use in source and binary forms, with or without 611814Swpaul * modification, are permitted provided that the following conditions 711814Swpaul * are met: 811814Swpaul * 1. Redistributions of source code must retain the above copyright 911814Swpaul * notice, this list of conditions and the following disclaimer. 1011814Swpaul * 2. Redistributions in binary form must reproduce the above copyright 1111814Swpaul * notice, this list of conditions and the following disclaimer in the 1211814Swpaul * documentation and/or other materials provided with the distribution. 1311814Swpaul * 3. All advertising materials mentioning features or use of this software 1411814Swpaul * must display the following acknowledgement: 1511814Swpaul * This product includes software developed by Bill Paul. 1611814Swpaul * 4. Neither the name of the author nor the names of any co-contributors 1711814Swpaul * may be used to endorse or promote products derived from this software 1811814Swpaul * without specific prior written permission. 1911814Swpaul * 2011814Swpaul * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND 2111814Swpaul * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2211814Swpaul * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2311814Swpaul * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR CONTRIBUTORS BE LIABLE 2411814Swpaul * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2511814Swpaul * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2611814Swpaul * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2711814Swpaul * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2811814Swpaul * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2911814Swpaul * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3011814Swpaul * SUCH DAMAGE. 3111814Swpaul * 3250476Speter * $FreeBSD$ 3311814Swpaul */ 3411814Swpaul 3511814Swpaul/* Groupname entry hung off a member_entry node. */ 3611814Swpaulstruct grouplist { 3711814Swpaul char *groupname; 3811814Swpaul struct grouplist *next; 3911814Swpaul}; 4011814Swpaul 4111814Swpaul/* Entry in the cooked member list hash table. */ 4211814Swpaulstruct member_entry { 4311814Swpaul char *key; 4411814Swpaul char *domain; 4511814Swpaul struct grouplist *groups; 4611814Swpaul struct member_entry *next; 4711814Swpaul}; 4811814Swpaul 4911814Swpaul/* Entry in the raw netgroup table. */ 5011814Swpaulstruct group_entry { 5111814Swpaul char *key; 5211814Swpaul char *data; 5311814Swpaul struct group_entry *next; 5411814Swpaul}; 5511814Swpaul 5611814Swpaul/* Table size (chosen arbitrarily). Not too big, not too small. */ 5711814Swpaul#define TABLESIZE 256 5811814Swpaul#define HASH_MASK 0x000000FF 5920387Swpaul 6020387Swpaul#define LINSIZ 1024 * 10 6120387Swpaul 6290377Simpextern void store(struct group_entry ** , char *, char *); 6390377Simpextern void mstore(struct member_entry ** , char *, char *, char *); 6490377Simpextern char *lookup(struct group_entry **, char *); 6590377Simpextern void __endnetgrent(void); 6690377Simpextern void __setnetgrent(char *); 6790377Simpextern int __getnetgrent(char **, char **, char **); 68