xref: /onnv-gate/usr/src/lib/libresolv2/common/irs/nul_ng.c (revision 11038:74b12212b8a2)
10Sstevel@tonic-gate /*
2*11038SRao.Shoaib@Sun.COM  * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
30Sstevel@tonic-gate  * Copyright (c) 1996,1999 by Internet Software Consortium.
40Sstevel@tonic-gate  *
50Sstevel@tonic-gate  * Permission to use, copy, modify, and distribute this software for any
60Sstevel@tonic-gate  * purpose with or without fee is hereby granted, provided that the above
70Sstevel@tonic-gate  * copyright notice and this permission notice appear in all copies.
80Sstevel@tonic-gate  *
9*11038SRao.Shoaib@Sun.COM  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
10*11038SRao.Shoaib@Sun.COM  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11*11038SRao.Shoaib@Sun.COM  * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
12*11038SRao.Shoaib@Sun.COM  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13*11038SRao.Shoaib@Sun.COM  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14*11038SRao.Shoaib@Sun.COM  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
15*11038SRao.Shoaib@Sun.COM  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
160Sstevel@tonic-gate  */
170Sstevel@tonic-gate 
180Sstevel@tonic-gate #if defined(LIBC_SCCS) && !defined(lint)
19*11038SRao.Shoaib@Sun.COM static const char rcsid[] = "$Id: nul_ng.c,v 1.3 2005/04/27 04:56:34 sra Exp $";
200Sstevel@tonic-gate #endif
210Sstevel@tonic-gate 
22*11038SRao.Shoaib@Sun.COM /*! \file
23*11038SRao.Shoaib@Sun.COM  * \brief
240Sstevel@tonic-gate  * nul_ng.c - the netgroup accessor null map
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate #include "port_before.h"
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #include <sys/types.h>
300Sstevel@tonic-gate #include <netinet/in.h>
310Sstevel@tonic-gate #include <arpa/nameser.h>
320Sstevel@tonic-gate #include <resolv.h>
330Sstevel@tonic-gate 
340Sstevel@tonic-gate #include <stdio.h>
350Sstevel@tonic-gate #include <string.h>
360Sstevel@tonic-gate #include <netdb.h>
370Sstevel@tonic-gate #include <ctype.h>
380Sstevel@tonic-gate #include <stdlib.h>
390Sstevel@tonic-gate #include <errno.h>
400Sstevel@tonic-gate 
410Sstevel@tonic-gate #include <irs.h>
420Sstevel@tonic-gate #include <isc/memcluster.h>
430Sstevel@tonic-gate 
440Sstevel@tonic-gate #include "port_after.h"
450Sstevel@tonic-gate 
460Sstevel@tonic-gate #include "irs_p.h"
470Sstevel@tonic-gate #include "hesiod.h"
480Sstevel@tonic-gate #include "dns_p.h"
490Sstevel@tonic-gate 
500Sstevel@tonic-gate /* Forward. */
510Sstevel@tonic-gate 
520Sstevel@tonic-gate static void 		ng_close(struct irs_ng *);
530Sstevel@tonic-gate static int		ng_next(struct irs_ng *, const char **,
540Sstevel@tonic-gate 				const char **, const char **);
550Sstevel@tonic-gate static int		ng_test(struct irs_ng *,
560Sstevel@tonic-gate  				const char *, const char *,
570Sstevel@tonic-gate 				const char *, const char *);
580Sstevel@tonic-gate static void		ng_rewind(struct irs_ng *, const char *);
590Sstevel@tonic-gate static void		ng_minimize(struct irs_ng *);
600Sstevel@tonic-gate 
610Sstevel@tonic-gate /* Public. */
620Sstevel@tonic-gate 
630Sstevel@tonic-gate struct irs_ng *
irs_nul_ng(struct irs_acc * this)640Sstevel@tonic-gate irs_nul_ng(struct irs_acc *this) {
650Sstevel@tonic-gate 	struct irs_ng *ng;
660Sstevel@tonic-gate 
670Sstevel@tonic-gate 	UNUSED(this);
680Sstevel@tonic-gate 
690Sstevel@tonic-gate 	if (!(ng = memget(sizeof *ng))) {
700Sstevel@tonic-gate 		errno = ENOMEM;
710Sstevel@tonic-gate 		return (NULL);
720Sstevel@tonic-gate 	}
730Sstevel@tonic-gate 	memset(ng, 0x5e, sizeof *ng);
740Sstevel@tonic-gate 	ng->private = NULL;
750Sstevel@tonic-gate 	ng->close = ng_close;
760Sstevel@tonic-gate 	ng->next = ng_next;
770Sstevel@tonic-gate 	ng->test = ng_test;
780Sstevel@tonic-gate 	ng->rewind = ng_rewind;
790Sstevel@tonic-gate 	ng->minimize = ng_minimize;
800Sstevel@tonic-gate 	return (ng);
810Sstevel@tonic-gate }
820Sstevel@tonic-gate 
830Sstevel@tonic-gate /* Methods. */
840Sstevel@tonic-gate 
850Sstevel@tonic-gate static void
ng_close(struct irs_ng * this)860Sstevel@tonic-gate ng_close(struct irs_ng *this) {
870Sstevel@tonic-gate 	memput(this, sizeof *this);
880Sstevel@tonic-gate }
890Sstevel@tonic-gate 
900Sstevel@tonic-gate /* ARGSUSED */
910Sstevel@tonic-gate static int
ng_next(struct irs_ng * this,const char ** host,const char ** user,const char ** domain)920Sstevel@tonic-gate ng_next(struct irs_ng *this, const char **host, const char **user,
930Sstevel@tonic-gate 	const char **domain)
940Sstevel@tonic-gate {
950Sstevel@tonic-gate 	UNUSED(this);
960Sstevel@tonic-gate 	UNUSED(host);
970Sstevel@tonic-gate 	UNUSED(user);
980Sstevel@tonic-gate 	UNUSED(domain);
990Sstevel@tonic-gate 	errno = ENOENT;
1000Sstevel@tonic-gate 	return (-1);
1010Sstevel@tonic-gate }
1020Sstevel@tonic-gate 
1030Sstevel@tonic-gate static int
ng_test(struct irs_ng * this,const char * name,const char * user,const char * host,const char * domain)1040Sstevel@tonic-gate ng_test(struct irs_ng *this, const char *name,
1050Sstevel@tonic-gate 	const char *user, const char *host, const char *domain)
1060Sstevel@tonic-gate {
1070Sstevel@tonic-gate 	UNUSED(this);
1080Sstevel@tonic-gate 	UNUSED(name);
1090Sstevel@tonic-gate 	UNUSED(user);
1100Sstevel@tonic-gate 	UNUSED(host);
1110Sstevel@tonic-gate 	UNUSED(domain);
1120Sstevel@tonic-gate 	errno = ENODEV;
1130Sstevel@tonic-gate 	return (-1);
1140Sstevel@tonic-gate }
1150Sstevel@tonic-gate 
1160Sstevel@tonic-gate static void
ng_rewind(struct irs_ng * this,const char * netgroup)1170Sstevel@tonic-gate ng_rewind(struct irs_ng *this, const char *netgroup) {
1180Sstevel@tonic-gate 	UNUSED(this);
1190Sstevel@tonic-gate 	UNUSED(netgroup);
1200Sstevel@tonic-gate 	/* NOOP */
1210Sstevel@tonic-gate }
1220Sstevel@tonic-gate 
1230Sstevel@tonic-gate static void
ng_minimize(struct irs_ng * this)1240Sstevel@tonic-gate ng_minimize(struct irs_ng *this) {
1250Sstevel@tonic-gate 	UNUSED(this);
1260Sstevel@tonic-gate 	/* NOOP */
1270Sstevel@tonic-gate }
128