summaryrefslogtreecommitdiffstats
path: root/lib/libc/net/getnetbyht.c
diff options
context:
space:
mode:
authornectar <nectar@FreeBSD.org>2000-09-06 18:16:48 +0000
committernectar <nectar@FreeBSD.org>2000-09-06 18:16:48 +0000
commit748554442d0ac4467fdac2ce9d42006588fd4481 (patch)
treeaed2ddbcac97f46f60ee9c2063a3345553f6a1ee /lib/libc/net/getnetbyht.c
parent59ffb36b778f8e629622726f6bd32dfa4fda7e35 (diff)
downloadFreeBSD-src-748554442d0ac4467fdac2ce9d42006588fd4481.zip
FreeBSD-src-748554442d0ac4467fdac2ce9d42006588fd4481.tar.gz
Add nsswitch support. By creating an /etc/nsswitch.conf file, you can
configure FreeBSD so that various databases such as passwd and group can be looked up using flat files, NIS, or Hesiod. = Hesiod has been added to libc (see hesiod(3)). = A library routine for parsing nsswitch.conf and invoking callback functions as specified has been added to libc (see nsdispatch(3)). = The following C library functions have been modified to use nsdispatch: . getgrent, getgrnam, getgrgid . getpwent, getpwnam, getpwuid . getusershell . getaddrinfo . gethostbyname, gethostbyname2, gethostbyaddr . getnetbyname, getnetbyaddr . getipnodebyname, getipnodebyaddr, getnodebyname, getnodebyaddr = host.conf has been removed from src/etc. rc.network has been modified to warn that host.conf is no longer used at boot time. In addition, if there is a host.conf but no nsswitch.conf, the latter is created at boot time from the former. Obtained from: NetBSD
Diffstat (limited to 'lib/libc/net/getnetbyht.c')
-rw-r--r--lib/libc/net/getnetbyht.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/lib/libc/net/getnetbyht.c b/lib/libc/net/getnetbyht.c
index ab164b1..b5f73be 100644
--- a/lib/libc/net/getnetbyht.c
+++ b/lib/libc/net/getnetbyht.c
@@ -55,6 +55,8 @@ static chat rcsid[] = "$FreeBSD$";
#include <netdb.h>
#include <stdio.h>
#include <string.h>
+#include <stdarg.h>
+#include <nsswitch.h>
#define MAXALIASES 35
@@ -135,13 +137,15 @@ again:
return (&net);
}
-struct netent *
-_getnetbyhtname(name)
- register const char *name;
+int
+_ht_getnetbyname(void *rval, void *cb_data, va_list ap)
{
+ const char *name;
register struct netent *p;
register char **cp;
+ name = va_arg(ap, const char *);
+
setnetent(_net_stayopen);
while ( (p = getnetent()) ) {
if (strcasecmp(p->n_name, name) == 0)
@@ -153,21 +157,26 @@ _getnetbyhtname(name)
found:
if (!_net_stayopen)
endnetent();
- return (p);
+ *(struct netent **)rval = p;
+ return (p != NULL) ? NS_SUCCESS : NS_NOTFOUND;
}
-struct netent *
-_getnetbyhtaddr(net, type)
- register unsigned long net;
- register int type;
+int
+_ht_getnetbyaddr(void *rval, void *cb_data, va_list ap)
{
+ unsigned long net;
+ int type;
register struct netent *p;
+ net = va_arg(ap, unsigned long);
+ type = va_arg(ap, int);
+
setnetent(_net_stayopen);
while ( (p = getnetent()) )
if (p->n_addrtype == type && p->n_net == net)
break;
if (!_net_stayopen)
endnetent();
- return (p);
+ *(struct netent **)rval = p;
+ return (p != NULL) ? NS_SUCCESS : NS_NOTFOUND;
}
OpenPOWER on IntegriCloud