xref: /netbsd/external/bsd/libbind/dist/irs/nul_ng.c (revision 6550d01e)
1 /*	$NetBSD: nul_ng.c,v 1.1.1.1 2009/04/12 15:33:37 christos Exp $	*/
2 
3 /*
4  * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
5  * Copyright (c) 1996,1999 by Internet Software Consortium.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
17  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #if defined(LIBC_SCCS) && !defined(lint)
21 static const char rcsid[] = "Id: nul_ng.c,v 1.3 2005/04/27 04:56:34 sra Exp";
22 #endif
23 
24 /*! \file
25  * \brief
26  * nul_ng.c - the netgroup accessor null map
27  */
28 
29 #include "port_before.h"
30 
31 #include <sys/types.h>
32 #include <netinet/in.h>
33 #include <arpa/nameser.h>
34 #include <resolv.h>
35 
36 #include <stdio.h>
37 #include <string.h>
38 #include <netdb.h>
39 #include <ctype.h>
40 #include <stdlib.h>
41 #include <errno.h>
42 
43 #include <irs.h>
44 #include <isc/memcluster.h>
45 
46 #include "port_after.h"
47 
48 #include "irs_p.h"
49 #include "hesiod.h"
50 #include "dns_p.h"
51 
52 /* Forward. */
53 
54 static void 		ng_close(struct irs_ng *);
55 static int		ng_next(struct irs_ng *, const char **,
56 				const char **, const char **);
57 static int		ng_test(struct irs_ng *,
58  				const char *, const char *,
59 				const char *, const char *);
60 static void		ng_rewind(struct irs_ng *, const char *);
61 static void		ng_minimize(struct irs_ng *);
62 
63 /* Public. */
64 
65 struct irs_ng *
66 irs_nul_ng(struct irs_acc *this) {
67 	struct irs_ng *ng;
68 
69 	UNUSED(this);
70 
71 	if (!(ng = memget(sizeof *ng))) {
72 		errno = ENOMEM;
73 		return (NULL);
74 	}
75 	memset(ng, 0x5e, sizeof *ng);
76 	ng->private = NULL;
77 	ng->close = ng_close;
78 	ng->next = ng_next;
79 	ng->test = ng_test;
80 	ng->rewind = ng_rewind;
81 	ng->minimize = ng_minimize;
82 	return (ng);
83 }
84 
85 /* Methods. */
86 
87 static void
88 ng_close(struct irs_ng *this) {
89 	memput(this, sizeof *this);
90 }
91 
92 /* ARGSUSED */
93 static int
94 ng_next(struct irs_ng *this, const char **host, const char **user,
95 	const char **domain)
96 {
97 	UNUSED(this);
98 	UNUSED(host);
99 	UNUSED(user);
100 	UNUSED(domain);
101 	errno = ENOENT;
102 	return (-1);
103 }
104 
105 static int
106 ng_test(struct irs_ng *this, const char *name,
107 	const char *user, const char *host, const char *domain)
108 {
109 	UNUSED(this);
110 	UNUSED(name);
111 	UNUSED(user);
112 	UNUSED(host);
113 	UNUSED(domain);
114 	errno = ENODEV;
115 	return (-1);
116 }
117 
118 static void
119 ng_rewind(struct irs_ng *this, const char *netgroup) {
120 	UNUSED(this);
121 	UNUSED(netgroup);
122 	/* NOOP */
123 }
124 
125 static void
126 ng_minimize(struct irs_ng *this) {
127 	UNUSED(this);
128 	/* NOOP */
129 }
130