xref: /openbsd/include/netgroup.h (revision 893695ce)
1*893695ceSjsg /*	$OpenBSD: netgroup.h,v 1.9 2023/01/04 13:00:11 jsg Exp $ */
2df930be7Sderaadt /*
3df930be7Sderaadt  * Copyright (c) 1994 Christos Zoulas
4df930be7Sderaadt  * All rights reserved.
5df930be7Sderaadt  *
6df930be7Sderaadt  * Redistribution and use in source and binary forms, with or without
7df930be7Sderaadt  * modification, are permitted provided that the following conditions
8df930be7Sderaadt  * are met:
9df930be7Sderaadt  * 1. Redistributions of source code must retain the above copyright
10df930be7Sderaadt  *    notice, this list of conditions and the following disclaimer.
11df930be7Sderaadt  * 2. Redistributions in binary form must reproduce the above copyright
12df930be7Sderaadt  *    notice, this list of conditions and the following disclaimer in the
13df930be7Sderaadt  *    documentation and/or other materials provided with the distribution.
14df930be7Sderaadt  *
15df930be7Sderaadt  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16df930be7Sderaadt  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17df930be7Sderaadt  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18df930be7Sderaadt  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19df930be7Sderaadt  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20df930be7Sderaadt  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21df930be7Sderaadt  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22df930be7Sderaadt  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23df930be7Sderaadt  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24df930be7Sderaadt  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25df930be7Sderaadt  * SUCH DAMAGE.
26df930be7Sderaadt  *
27df930be7Sderaadt  */
28df930be7Sderaadt #ifndef _NETGROUP_H_
29df930be7Sderaadt #define	_NETGROUP_H_
30df930be7Sderaadt 
31df930be7Sderaadt #define	_PATH_NETGROUP		"/etc/netgroup"
32df930be7Sderaadt 
33df930be7Sderaadt #define	_PATH_NETGROUP_DB	"/etc/netgroup.db"
34df930be7Sderaadt 
35df930be7Sderaadt #define	_PATH_NETGROUP_MKDB	"/usr/sbin/netgroup_mkdb"
36df930be7Sderaadt 
37df930be7Sderaadt #define	_NG_KEYBYNAME		'1'	/* stored by name */
38df930be7Sderaadt #define	_NG_KEYBYUSER		'2'	/* stored by user */
39df930be7Sderaadt #define	_NG_KEYBYHOST		'3'	/* stored by host */
40df930be7Sderaadt 
41df930be7Sderaadt #define _NG_ERROR	-1
42df930be7Sderaadt #define _NG_NONE	 0
43df930be7Sderaadt #define _NG_NAME	 1
44df930be7Sderaadt #define _NG_GROUP	 2
45df930be7Sderaadt 
46df930be7Sderaadt struct netgroup {
47df930be7Sderaadt 	char		*ng_host;	/* host name */
48df930be7Sderaadt 	char		*ng_user;	/* user name */
49df930be7Sderaadt 	char		*ng_domain;	/* domain name */
50df930be7Sderaadt 	struct netgroup	*ng_next;	/* thread */
51df930be7Sderaadt };
52df930be7Sderaadt 
53df930be7Sderaadt #include <sys/cdefs.h>
54df930be7Sderaadt 
55df930be7Sderaadt __BEGIN_DECLS
56c72b5b24Smillert void	setnetgrent(const char *);
57c72b5b24Smillert int	getnetgrent(const char **, const char **, const char **);
58c72b5b24Smillert void	endnetgrent(void);
59f3c3a9c6Smillert int	innetgr(const char *, const char *, const char *, const char *);
60df930be7Sderaadt __END_DECLS
61df930be7Sderaadt 
62df930be7Sderaadt #endif /* !_NETGROUP_H_ */
63