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