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