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