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