17c478bd9Sstevel@tonic-gate /*
2*9525b14bSRao Shoaib  * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
37c478bd9Sstevel@tonic-gate  * Copyright (c) 1996,1999 by Internet Software Consortium.
47c478bd9Sstevel@tonic-gate  *
57c478bd9Sstevel@tonic-gate  * Permission to use, copy, modify, and distribute this software for any
67c478bd9Sstevel@tonic-gate  * purpose with or without fee is hereby granted, provided that the above
77c478bd9Sstevel@tonic-gate  * copyright notice and this permission notice appear in all copies.
87c478bd9Sstevel@tonic-gate  *
9*9525b14bSRao Shoaib  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
10*9525b14bSRao Shoaib  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11*9525b14bSRao Shoaib  * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
12*9525b14bSRao Shoaib  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13*9525b14bSRao Shoaib  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14*9525b14bSRao Shoaib  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
15*9525b14bSRao Shoaib  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
167c478bd9Sstevel@tonic-gate  */
177c478bd9Sstevel@tonic-gate 
18*9525b14bSRao Shoaib /*! \file
19*9525b14bSRao Shoaib  * \brief
207c478bd9Sstevel@tonic-gate  * nul_ng.c - the netgroup accessor null map
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate 
237c478bd9Sstevel@tonic-gate #include "port_before.h"
247c478bd9Sstevel@tonic-gate 
257c478bd9Sstevel@tonic-gate #include <sys/types.h>
267c478bd9Sstevel@tonic-gate #include <netinet/in.h>
277c478bd9Sstevel@tonic-gate #include <arpa/nameser.h>
287c478bd9Sstevel@tonic-gate #include <resolv.h>
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #include <stdio.h>
317c478bd9Sstevel@tonic-gate #include <string.h>
327c478bd9Sstevel@tonic-gate #include <netdb.h>
337c478bd9Sstevel@tonic-gate #include <ctype.h>
347c478bd9Sstevel@tonic-gate #include <stdlib.h>
357c478bd9Sstevel@tonic-gate #include <errno.h>
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #include <irs.h>
387c478bd9Sstevel@tonic-gate #include <isc/memcluster.h>
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate #include "port_after.h"
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate #include "irs_p.h"
437c478bd9Sstevel@tonic-gate #include "hesiod.h"
447c478bd9Sstevel@tonic-gate #include "dns_p.h"
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate /* Forward. */
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate static void 		ng_close(struct irs_ng *);
497c478bd9Sstevel@tonic-gate static int		ng_next(struct irs_ng *, const char **,
507c478bd9Sstevel@tonic-gate 				const char **, const char **);
517c478bd9Sstevel@tonic-gate static int		ng_test(struct irs_ng *,
527c478bd9Sstevel@tonic-gate  				const char *, const char *,
537c478bd9Sstevel@tonic-gate 				const char *, const char *);
547c478bd9Sstevel@tonic-gate static void		ng_rewind(struct irs_ng *, const char *);
557c478bd9Sstevel@tonic-gate static void		ng_minimize(struct irs_ng *);
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate /* Public. */
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate struct irs_ng *
irs_nul_ng(struct irs_acc * this)607c478bd9Sstevel@tonic-gate irs_nul_ng(struct irs_acc *this) {
617c478bd9Sstevel@tonic-gate 	struct irs_ng *ng;
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate 	UNUSED(this);
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate 	if (!(ng = memget(sizeof *ng))) {
667c478bd9Sstevel@tonic-gate 		errno = ENOMEM;
677c478bd9Sstevel@tonic-gate 		return (NULL);
687c478bd9Sstevel@tonic-gate 	}
697c478bd9Sstevel@tonic-gate 	memset(ng, 0x5e, sizeof *ng);
707c478bd9Sstevel@tonic-gate 	ng->private = NULL;
717c478bd9Sstevel@tonic-gate 	ng->close = ng_close;
727c478bd9Sstevel@tonic-gate 	ng->next = ng_next;
737c478bd9Sstevel@tonic-gate 	ng->test = ng_test;
747c478bd9Sstevel@tonic-gate 	ng->rewind = ng_rewind;
757c478bd9Sstevel@tonic-gate 	ng->minimize = ng_minimize;
767c478bd9Sstevel@tonic-gate 	return (ng);
777c478bd9Sstevel@tonic-gate }
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate /* Methods. */
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate static void
ng_close(struct irs_ng * this)827c478bd9Sstevel@tonic-gate ng_close(struct irs_ng *this) {
837c478bd9Sstevel@tonic-gate 	memput(this, sizeof *this);
847c478bd9Sstevel@tonic-gate }
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate /* ARGSUSED */
877c478bd9Sstevel@tonic-gate static int
ng_next(struct irs_ng * this,const char ** host,const char ** user,const char ** domain)887c478bd9Sstevel@tonic-gate ng_next(struct irs_ng *this, const char **host, const char **user,
897c478bd9Sstevel@tonic-gate 	const char **domain)
907c478bd9Sstevel@tonic-gate {
917c478bd9Sstevel@tonic-gate 	UNUSED(this);
927c478bd9Sstevel@tonic-gate 	UNUSED(host);
937c478bd9Sstevel@tonic-gate 	UNUSED(user);
947c478bd9Sstevel@tonic-gate 	UNUSED(domain);
957c478bd9Sstevel@tonic-gate 	errno = ENOENT;
967c478bd9Sstevel@tonic-gate 	return (-1);
977c478bd9Sstevel@tonic-gate }
987c478bd9Sstevel@tonic-gate 
997c478bd9Sstevel@tonic-gate static int
ng_test(struct irs_ng * this,const char * name,const char * user,const char * host,const char * domain)1007c478bd9Sstevel@tonic-gate ng_test(struct irs_ng *this, const char *name,
1017c478bd9Sstevel@tonic-gate 	const char *user, const char *host, const char *domain)
1027c478bd9Sstevel@tonic-gate {
1037c478bd9Sstevel@tonic-gate 	UNUSED(this);
1047c478bd9Sstevel@tonic-gate 	UNUSED(name);
1057c478bd9Sstevel@tonic-gate 	UNUSED(user);
1067c478bd9Sstevel@tonic-gate 	UNUSED(host);
1077c478bd9Sstevel@tonic-gate 	UNUSED(domain);
1087c478bd9Sstevel@tonic-gate 	errno = ENODEV;
1097c478bd9Sstevel@tonic-gate 	return (-1);
1107c478bd9Sstevel@tonic-gate }
1117c478bd9Sstevel@tonic-gate 
1127c478bd9Sstevel@tonic-gate static void
ng_rewind(struct irs_ng * this,const char * netgroup)1137c478bd9Sstevel@tonic-gate ng_rewind(struct irs_ng *this, const char *netgroup) {
1147c478bd9Sstevel@tonic-gate 	UNUSED(this);
1157c478bd9Sstevel@tonic-gate 	UNUSED(netgroup);
1167c478bd9Sstevel@tonic-gate 	/* NOOP */
1177c478bd9Sstevel@tonic-gate }
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate static void
ng_minimize(struct irs_ng * this)1207c478bd9Sstevel@tonic-gate ng_minimize(struct irs_ng *this) {
1217c478bd9Sstevel@tonic-gate 	UNUSED(this);
1227c478bd9Sstevel@tonic-gate 	/* NOOP */
1237c478bd9Sstevel@tonic-gate }
124