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 /*! \file
19 * \brief
20 * nul_ng.c - the netgroup accessor null map
21 */
22
23 #include "port_before.h"
24
25 #include <sys/types.h>
26 #include <netinet/in.h>
27 #include <arpa/nameser.h>
28 #include <resolv.h>
29
30 #include <stdio.h>
31 #include <string.h>
32 #include <netdb.h>
33 #include <ctype.h>
34 #include <stdlib.h>
35 #include <errno.h>
36
37 #include <irs.h>
38 #include <isc/memcluster.h>
39
40 #include "port_after.h"
41
42 #include "irs_p.h"
43 #include "hesiod.h"
44 #include "dns_p.h"
45
46 /* Forward. */
47
48 static void ng_close(struct irs_ng *);
49 static int ng_next(struct irs_ng *, const char **,
50 const char **, const char **);
51 static int ng_test(struct irs_ng *,
52 const char *, const char *,
53 const char *, const char *);
54 static void ng_rewind(struct irs_ng *, const char *);
55 static void ng_minimize(struct irs_ng *);
56
57 /* Public. */
58
59 struct irs_ng *
irs_nul_ng(struct irs_acc * this)60 irs_nul_ng(struct irs_acc *this) {
61 struct irs_ng *ng;
62
63 UNUSED(this);
64
65 if (!(ng = memget(sizeof *ng))) {
66 errno = ENOMEM;
67 return (NULL);
68 }
69 memset(ng, 0x5e, sizeof *ng);
70 ng->private = NULL;
71 ng->close = ng_close;
72 ng->next = ng_next;
73 ng->test = ng_test;
74 ng->rewind = ng_rewind;
75 ng->minimize = ng_minimize;
76 return (ng);
77 }
78
79 /* Methods. */
80
81 static void
ng_close(struct irs_ng * this)82 ng_close(struct irs_ng *this) {
83 memput(this, sizeof *this);
84 }
85
86 /* ARGSUSED */
87 static int
ng_next(struct irs_ng * this,const char ** host,const char ** user,const char ** domain)88 ng_next(struct irs_ng *this, const char **host, const char **user,
89 const char **domain)
90 {
91 UNUSED(this);
92 UNUSED(host);
93 UNUSED(user);
94 UNUSED(domain);
95 errno = ENOENT;
96 return (-1);
97 }
98
99 static int
ng_test(struct irs_ng * this,const char * name,const char * user,const char * host,const char * domain)100 ng_test(struct irs_ng *this, const char *name,
101 const char *user, const char *host, const char *domain)
102 {
103 UNUSED(this);
104 UNUSED(name);
105 UNUSED(user);
106 UNUSED(host);
107 UNUSED(domain);
108 errno = ENODEV;
109 return (-1);
110 }
111
112 static void
ng_rewind(struct irs_ng * this,const char * netgroup)113 ng_rewind(struct irs_ng *this, const char *netgroup) {
114 UNUSED(this);
115 UNUSED(netgroup);
116 /* NOOP */
117 }
118
119 static void
ng_minimize(struct irs_ng * this)120 ng_minimize(struct irs_ng *this) {
121 UNUSED(this);
122 /* NOOP */
123 }
124