aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libc/net/name6.c
diff options
context:
space:
mode:
authorJonathan Lemon <jlemon@FreeBSD.org>2000-03-09 22:52:30 +0000
committerJonathan Lemon <jlemon@FreeBSD.org>2000-03-09 22:52:30 +0000
commit638580129da3e9ef5fc4abce957530184068416a (patch)
tree99873796f33537edb545847114f511bf02ff175d /lib/libc/net/name6.c
parent5a5368a86cfee9ae3adddbe2129c9f0e696b0eec (diff)
downloadsrc-638580129da3e9ef5fc4abce957530184068416a.tar.gz
src-638580129da3e9ef5fc4abce957530184068416a.zip
Add in IPV4 NIS support.
PR: 17290 (but not the same patch) Approved by: jkh
Notes
Notes: svn path=/head/; revision=57878
Diffstat (limited to 'lib/libc/net/name6.c')
-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 31bc26127366..35039e0beb69 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