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