From 66c9a837d530926d00ac6abc5a444a9fa345d59c Mon Sep 17 00:00:00 2001 From: lukem Date: Tue, 19 Jan 1999 08:01:12 +0000 Subject: [PATCH] convert to new nsdispatch(3). lookup defaults back to "dns files" --- lib/libc/net/gethnamaddr.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/lib/libc/net/gethnamaddr.c b/lib/libc/net/gethnamaddr.c index 95d28b2f9dc6..3ff5483f6c2a 100644 --- a/lib/libc/net/gethnamaddr.c +++ b/lib/libc/net/gethnamaddr.c @@ -1,4 +1,4 @@ -/* $NetBSD: gethnamaddr.c,v 1.10 1999/01/18 05:26:08 lukem Exp $ */ +/* $NetBSD: gethnamaddr.c,v 1.11 1999/01/19 08:01:12 lukem Exp $ */ /* * ++Copyright++ 1985, 1988, 1993 @@ -61,7 +61,7 @@ static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93"; static char rcsid[] = "Id: gethnamaddr.c,v 8.21 1997/06/01 20:34:37 vixie Exp "; #else -__RCSID("$NetBSD: gethnamaddr.c,v 1.10 1999/01/18 05:26:08 lukem Exp $"); +__RCSID("$NetBSD: gethnamaddr.c,v 1.11 1999/01/19 08:01:12 lukem Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -176,6 +176,12 @@ int _yp_gethtbyaddr __P((void *, void *, va_list)); int _yp_gethtbyname __P((void *, void *, va_list)); #endif +static ns_src default_dns_files[] = { + { NSSRC_DNS, NS_SUCCESS }, + { NSSRC_FILES, NS_SUCCESS }, + { 0 } +}; + #ifdef DEBUG static void @@ -496,10 +502,10 @@ gethostbyname2(name, af) int size, len; struct hostent *hp; static ns_dtab dtab[] = { - NS_FILES_CB(_gethtbyname, NULL), + NS_FILES_CB(_gethtbyname, NULL) { NSSRC_DNS, _dns_gethtbyname, NULL }, /* force -DHESIOD */ - NS_NIS_CB(_yp_gethtbyname, NULL), - { NULL, NULL, NULL } + NS_NIS_CB(_yp_gethtbyname, NULL) + { 0 } }; switch (af) { @@ -596,7 +602,8 @@ gethostbyname2(name, af) hp = (struct hostent *)NULL; h_errno = NETDB_INTERNAL; - if (nsdispatch(&hp, dtab, NSDB_HOSTS, name, len, af) != NS_SUCCESS) + if (nsdispatch(&hp, dtab, NSDB_HOSTS, "gethostbyname", + default_dns_files, name, len, af) != NS_SUCCESS) return (struct hostent *)NULL; h_errno = NETDB_SUCCESS; return (hp); @@ -613,10 +620,10 @@ gethostbyaddr(addr, len, af) int size; struct hostent *hp; static ns_dtab dtab[] = { - NS_FILES_CB(_gethtbyaddr, NULL), + NS_FILES_CB(_gethtbyaddr, NULL) { NSSRC_DNS, _dns_gethtbyaddr, NULL }, /* force -DHESIOD */ - NS_NIS_CB(_yp_gethtbyaddr, NULL), - { NULL, NULL, NULL } + NS_NIS_CB(_yp_gethtbyaddr, NULL) + { 0 } }; if (af == AF_INET6 && len == IN6ADDRSZ && @@ -647,7 +654,8 @@ gethostbyaddr(addr, len, af) } hp = (struct hostent *)NULL; h_errno = NETDB_INTERNAL; - if (nsdispatch(&hp, dtab, NSDB_HOSTS, uaddr, len, af) != NS_SUCCESS) + if (nsdispatch(&hp, dtab, NSDB_HOSTS, "gethostbyaddr", + default_dns_files, uaddr, len, af) != NS_SUCCESS) return (struct hostent *)NULL; h_errno = NETDB_SUCCESS; return (hp);