summaryrefslogtreecommitdiffstats
path: root/lib/libc/net/ether_addr.c
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>1995-08-07 03:42:14 +0000
committerwpaul <wpaul@FreeBSD.org>1995-08-07 03:42:14 +0000
commitd9b109975827973dc12bcc88eff6356d6dd941a6 (patch)
tree094b8300be99741448346c1cc2ce125e803fa6a3 /lib/libc/net/ether_addr.c
parentf0b49bdd9e4c38d2f87ac4bff85ea99d0377c3e1 (diff)
downloadFreeBSD-src-d9b109975827973dc12bcc88eff6356d6dd941a6.zip
FreeBSD-src-d9b109975827973dc12bcc88eff6356d6dd941a6.tar.gz
Just when you thought it was safe...
- getnetgrent.c: address some NIS compatibility problems. We really need to use the netgroup.byuser and netgroup.byhost maps to speed up innetgr() when using NIS. Also, change the NIS interaction in the following way: If /etc/netgroup does not exist or is empty (or contains only the NIS '+' token), we now use NIS exclusively. This lets us use the 'reverse netgroup' maps and is more or less the behavior of other platforms. If /etc/netgroup exists and contains local netgroup data (but no '+'). we use only lthe local stuff and ignore NIS. If /etc/netgroup exists and contains both local data and the '+', we use the local data nd the netgroup map as a single combined database (which, unfortunately, can be slow when the netgroup database is large). This is what we have been doing up until now. Head off a potential NULL pointer dereference in the old innetgr() matching code. Also fix the way the NIS netgroup map is incorporated into things: adding the '+' is supposed to make it seem as though the netgroup database is 'inserted' wherever the '+' is placed. We didn't quite do it that way before. (The NetBSD people apparently use a real, honest-to-gosh, netgroup.db database that works just like the password database. This is actually a neat idea since netgroups is the sort of thing that can really benefit from having multi-key search capability, particularly since reverse lookups require more than a trivial amount of processing. Should we do something like this too?) - netgroup.5: document all this stuff. - rcmd.c: some sleuthing with some test programs linked with my own version of innetgr() has revealed that SunOS always passes the NIS domain name to innetgr() in the 'domain' argument. We might as well do the same (if YP is defined). - ether_addr.c: also fix the NIS interaction so that placing the '+' token in the /etc/ethers file makes it seem like the NIS ethers data is 'inserted' at that point. (Chances are nobody will notice the effect of this change, which is just te way I like it. :)
Diffstat (limited to 'lib/libc/net/ether_addr.c')
-rw-r--r--lib/libc/net/ether_addr.c31
1 files changed, 8 insertions, 23 deletions
diff --git a/lib/libc/net/ether_addr.c b/lib/libc/net/ether_addr.c
index c628826..711bb7d 100644
--- a/lib/libc/net/ether_addr.c
+++ b/lib/libc/net/ether_addr.c
@@ -35,7 +35,7 @@
* Center for Telecommunications Research
* Columbia University, New York City
*
- * $Id: ether_addr.c,v 1.5 1995/03/26 02:37:00 wpaul Exp $
+ * $Id: ether_addr.c,v 1.1 1995/04/02 01:31:17 wpaul Exp $
*/
@@ -142,23 +142,16 @@ int ether_ntohost(hostname, e)
continue;
#ifdef YP
if (buf[0] == '+') {
- fclose(fp); /* Can ignore /etc/ethers from here on. */
if (yp_get_default_domain(&yp_domain))
- return(1);
+ continue;
ether_a = ether_ntoa(e);
if (yp_match(yp_domain, "ethers.byaddr", ether_a,
strlen(ether_a), &result, &resultlen)) {
free(result);
- return(1);
+ continue;
}
- if (!ether_line(result, &local_ether, &local_host)) {
- strcpy(hostname, (char *)&local_host);
- free(result);
- return(0);
- } else {
+ strncpy((char *)&buf, result, resultlen);
free(result);
- return(1);
- }
}
#endif
if (!ether_line(&buf, &local_ether, &local_host)) {
@@ -200,23 +193,15 @@ int ether_hostton(hostname, e)
continue;
#ifdef YP
if (buf[0] == '+') {
- fclose(fp); /* Can ignore /etc/ethers from here on. */
if (yp_get_default_domain(&yp_domain))
- return(1);
+ continue;
if (yp_match(yp_domain, "ethers.byname", hostname,
strlen(hostname), &result, &resultlen)) {
free(result);
- return(1);
- }
- if (!ether_line(result, &local_ether, &local_host)) {
- bcopy((char *)&local_ether.octet[0],
- (char *)&e->octet[0], 6);
- free(result);
- return(0);
- } else {
- free(result);
- return(1);
+ continue;
}
+ strncpy((char *)&buf, result, resultlen);
+ free(result);
}
#endif
if (!ether_line(&buf, &local_ether, &local_host)) {
OpenPOWER on IntegriCloud