summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
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