summaryrefslogtreecommitdiffstats
path: root/lib/libc/net/getnetbynis.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1996-08-29 20:08:19 +0000
committerpeter <peter@FreeBSD.org>1996-08-29 20:08:19 +0000
commit1f1fd8028fddf809ce8077697ffa07cb30a1e5d2 (patch)
tree2cf4d77f1b2f64006b349d61712604ce2acf338e /lib/libc/net/getnetbynis.c
parentd971f8ba30d6c175abff84fb92fc284744fa18ac (diff)
downloadFreeBSD-src-1f1fd8028fddf809ce8077697ffa07cb30a1e5d2.zip
FreeBSD-src-1f1fd8028fddf809ce8077697ffa07cb30a1e5d2.tar.gz
Merge in bind-4.9.4-P1 resolver...
Diffstat (limited to 'lib/libc/net/getnetbynis.c')
-rw-r--r--lib/libc/net/getnetbynis.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/lib/libc/net/getnetbynis.c b/lib/libc/net/getnetbynis.c
index ac11aa3..7c256e0 100644
--- a/lib/libc/net/getnetbynis.c
+++ b/lib/libc/net/getnetbynis.c
@@ -24,8 +24,8 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)$Id: getnetbynis.c,v 1.4 1995/10/22 14:39:06 phk Exp $";
-static char rcsid[] = "$Id: getnetbynis.c,v 1.4 1995/10/22 14:39:06 phk Exp $";
+static char sccsid[] = "@(#)$Id: getnetbynis.c,v 1.5 1996/03/23 22:16:22 wpaul Exp $";
+static char rcsid[] = "$Id: getnetbynis.c,v 1.5 1996/03/23 22:16:22 wpaul Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -53,8 +53,10 @@ static char *host_aliases[MAXALIASES];
#endif /* YP */
static struct netent *
-_getnetbynis(name, map)
- char *name, *map;
+_getnetbynis(name, map, af)
+ const char *name;
+ char *map;
+ int af;
{
#ifdef YP
register char *cp, **q;
@@ -64,6 +66,15 @@ _getnetbynis(name, map)
static char *domain = (char *)NULL;
static char ypbuf[YPMAXRECORD];
+ switch(af) {
+ case AF_INET:
+ break;
+ default:
+ case AF_INET6:
+ errno = EAFNOSUPPORT;
+ return NULL;
+ }
+
if (domain == (char *)NULL)
if (yp_get_default_domain (&domain))
return (NULL);
@@ -112,15 +123,15 @@ _getnetbynis(name, map)
struct netent *
_getnetbynisname(name)
- char *name;
+ const char *name;
{
return _getnetbynis(name, "networks.byname");
}
struct netent *
-_getnetbynisaddr(addr, type)
- long addr;
- int type;
+_getnetbynisaddr(addr, af)
+ unsigned long addr;
+ int af;
{
char *str, *cp;
unsigned long net2;
@@ -128,8 +139,10 @@ _getnetbynisaddr(addr, type)
unsigned int netbr[4];
char buf[MAXDNAME];
- if (type != AF_INET)
+ if (af != AF_INET) {
+ errno = EAFNOSUPPORT;
return (NULL);
+ }
for (nn = 4, net2 = addr; net2; net2 >>= 8) {
netbr[--nn] = net2 & 0xff;
@@ -159,5 +172,5 @@ _getnetbynisaddr(addr, type)
cp = str + (strlen(str) - 2);
}
- return _getnetbynis(str, "networks.byaddr");
+ return _getnetbynis(str, "networks.byaddr", af);
}
OpenPOWER on IntegriCloud