summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorjlemon <jlemon@FreeBSD.org>2000-03-09 22:52:30 +0000
committerjlemon <jlemon@FreeBSD.org>2000-03-09 22:52:30 +0000
commit53f4095f26ac25a0e53c381716b295d1b5ab3c1d (patch)
treecd5d5553dfb12b93e34badce7c4e1238e29a567a /lib/libc
parent2859a2ebb1bad5fa3590094a7c7d98600781f4e6 (diff)
downloadFreeBSD-src-53f4095f26ac25a0e53c381716b295d1b5ab3c1d.zip
FreeBSD-src-53f4095f26ac25a0e53c381716b295d1b5ab3c1d.tar.gz
Add in IPV4 NIS support.
PR: 17290 (but not the same patch) Approved by: jkh
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/net/name6.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/libc/net/name6.c b/lib/libc/net/name6.c
index 31bc261..35039e0 100644
--- a/lib/libc/net/name6.c
+++ b/lib/libc/net/name6.c
@@ -116,6 +116,8 @@ static struct hostent *_files_ghbyname(const char *name, int af, int *errp);
static struct hostent *_files_ghbyaddr(const void *addr, int addrlen, int af, int *errp);
static void _files_shent(int stayopen);
static void _files_ehent(void);
+static struct hostent *_nis_ghbyname(const char *name, int af, int *errp);
+static struct hostent *_nis_ghbyaddr(const void *addr, int addrlen, int af, int *errp);
static struct hostent *_dns_ghbyname(const char *name, int af, int *errp);
static struct hostent *_dns_ghbyaddr(const void *addr, int addrlen, int af, int *errp);
static void _dns_shent(int stayopen);
@@ -186,6 +188,11 @@ _hostconf_init(void)
_hostconf[n].byaddr = _dns_ghbyaddr;
n++;
}
+ else if (strcmp(p, "nis") == 0) {
+ _hostconf[n].byname = _nis_ghbyname;
+ _hostconf[n].byaddr = _nis_ghbyaddr;
+ n++;
+ }
#ifdef ICMPNL
else if (strcmp(p, "icmp") == 0) {
_hostconf[n].byname = NULL;
@@ -825,6 +832,38 @@ _files_ghbyaddr(const void *addr, int addrlen, int af, int *errp)
return hp;
}
+/*
+ * NIS
+ *
+ * XXX actually a hack, these are INET4 specific.
+ */
+static struct hostent *
+_nis_ghbyname(const char *name, int af, int *errp)
+{
+ struct hostent *hp;
+
+ if (af == AF_INET) {
+ hp = _gethostbynisname(name, af);
+ if (hp != NULL)
+ hp = _hpcopy(hp, errp);
+ }
+ return (hp);
+
+}
+
+static struct hostent *
+_nis_ghbyaddr(const void *addr, int addrlen, int af, int *errp)
+{
+ struct hostent *hp = NULL;
+
+ if (af == AF_INET) {
+ hp = _gethostbynisaddr(addr, addrlen, af);
+ if (hp != NULL)
+ hp = _hpcopy(hp, errp);
+ }
+ return (hp);
+}
+
#ifdef DEBUG
#define DNS_ASSERT(X) if (!(X)) { fprintf(stderr, "ASSFAIL: %s %d: %s\n", __FILE__, __LINE__, #X); goto badanswer; }
#else
OpenPOWER on IntegriCloud