xref: /netbsd/include/netgroup.h (revision 550147bd)
1*550147bdSsnj /*	$NetBSD: netgroup.h,v 1.10 2009/10/21 01:07:45 snj Exp $	*/
29c7d50a4Sthorpej 
3d89a7256Schristos /*
4d89a7256Schristos  * Copyright (c) 1994 Christos Zoulas
5d89a7256Schristos  * All rights reserved.
6d89a7256Schristos  *
7d89a7256Schristos  * Redistribution and use in source and binary forms, with or without
8d89a7256Schristos  * modification, are permitted provided that the following conditions
9d89a7256Schristos  * are met:
10d89a7256Schristos  * 1. Redistributions of source code must retain the above copyright
11d89a7256Schristos  *    notice, this list of conditions and the following disclaimer.
12d89a7256Schristos  * 2. Redistributions in binary form must reproduce the above copyright
13d89a7256Schristos  *    notice, this list of conditions and the following disclaimer in the
14d89a7256Schristos  *    documentation and/or other materials provided with the distribution.
15d89a7256Schristos  *
16d89a7256Schristos  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
17d89a7256Schristos  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18d89a7256Schristos  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19d89a7256Schristos  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
20d89a7256Schristos  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21d89a7256Schristos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22d89a7256Schristos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23d89a7256Schristos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24d89a7256Schristos  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25d89a7256Schristos  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26d89a7256Schristos  * SUCH DAMAGE.
27d89a7256Schristos  */
289c7d50a4Sthorpej 
29d89a7256Schristos #ifndef _NETGROUP_H_
30d89a7256Schristos #define	_NETGROUP_H_
31d89a7256Schristos 
32633b8f45Smycroft #include <sys/cdefs.h>
33633b8f45Smycroft 
34d89a7256Schristos #define	_PATH_NETGROUP		"/etc/netgroup"
35d89a7256Schristos 
362f776ce0Schristos #define	_PATH_NETGROUP_DB	"/var/db/netgroup.db"
37d89a7256Schristos 
38d89a7256Schristos #define	_PATH_NETGROUP_MKDB	"/usr/sbin/netgroup_mkdb"
39d89a7256Schristos 
40d89a7256Schristos #define	_NG_KEYBYNAME		'1'	/* stored by name */
41d89a7256Schristos #define	_NG_KEYBYUSER		'2'	/* stored by user */
42d89a7256Schristos #define	_NG_KEYBYHOST		'3'	/* stored by host */
43d89a7256Schristos 
44d89a7256Schristos #define _NG_ERROR	-1
45d89a7256Schristos #define _NG_NONE	 0
46d89a7256Schristos #define _NG_NAME	 1
47d89a7256Schristos #define _NG_GROUP	 2
48d89a7256Schristos 
49d89a7256Schristos struct netgroup {
50633b8f45Smycroft 	__aconst char *ng_host;		/* host name */
51633b8f45Smycroft 	__aconst char *ng_user;		/* user name */
52633b8f45Smycroft 	__aconst char *ng_domain;	/* domain name */
53d89a7256Schristos 	struct	netgroup *ng_next;	/* thread */
54d89a7256Schristos };
55d89a7256Schristos 
56d89a7256Schristos __BEGIN_DECLS
5719b7469aSperry void	setnetgrent	(const char *);
5819b7469aSperry int	getnetgrent	(const char **, const char **, const char **);
5919b7469aSperry void	endnetgrent	(void);
6019b7469aSperry int	innetgr		(const char *, const char *, const char *,
6119b7469aSperry 			     const char *);
6200fd3c5cSchristos #ifdef _NETGROUP_PRIVATE
6319b7469aSperry char    *_ng_makekey(const char *, const char *, size_t);
6419b7469aSperry int	_ng_parse(char **, char **, struct netgroup **);
6519b7469aSperry void	_ng_print(char *, size_t, const struct netgroup *);
6620248fa8Schristos void	_ng_cycle(const char *, const StringList *);
6700fd3c5cSchristos #endif /* _NETGROUP_PRIVATE */
6800fd3c5cSchristos 
69d89a7256Schristos __END_DECLS
70d89a7256Schristos 
71d89a7256Schristos #endif /* !_NETGROUP_H_ */
72