diff options
Diffstat (limited to 'lib/libc/net')
| -rw-r--r-- | lib/libc/net/ether_addr.c | 31 | ||||
| -rw-r--r-- | lib/libc/net/rcmd.c | 20 |
2 files changed, 24 insertions, 27 deletions
diff --git a/lib/libc/net/ether_addr.c b/lib/libc/net/ether_addr.c index c6288261ebe9..711bb7d93a05 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)) { diff --git a/lib/libc/net/rcmd.c b/lib/libc/net/rcmd.c index 34ac18bf9f2f..f0d756ceeb78 100644 --- a/lib/libc/net/rcmd.c +++ b/lib/libc/net/rcmd.c @@ -51,6 +51,11 @@ static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94"; #include <stdio.h> #include <ctype.h> #include <string.h> +#ifdef YP +#include <rpc/rpc.h> +#include <rpcsvc/yp_prot.h> +#include <rpcsvc/ypclnt.h> +#endif #define max(a, b) ((a > b) ? a : b) @@ -359,7 +364,14 @@ __ivaliduser(hostf, raddr, luser, ruser) struct hostent *hp; /* Presumed guilty until proven innocent. */ int userok = 0, hostok = 0; +#ifdef YP + char *ypdomain; + if (yp_get_default_domain(&ypdomain)) + ypdomain = NULL; +#else +#define ypdomain NULL +#endif /* We need to get the damn hostname back for netgroup matching. */ if ((hp = gethostbyaddr((char *)&raddr, sizeof(u_long), AF_INET)) == NULL) @@ -403,14 +415,14 @@ __ivaliduser(hostf, raddr, luser, ruser) } if (buf[1] == '@') /* match a host by netgroup */ hostok = innetgr((char *)&buf[2], hp->h_name, - NULL, NULL); + NULL, ypdomain); else /* match a host by addr */ hostok = __icheckhost(raddr,(char *)&buf[1]); break; case '-': /* reject '-' hosts and all their users */ if (buf[1] == '@') { if (innetgr((char *)&buf[2], - hp->h_name, NULL, NULL)) + hp->h_name, NULL, ypdomain)) return(-1); } else { if (__icheckhost(raddr,(char *)&buf[1])) @@ -428,7 +440,7 @@ __ivaliduser(hostf, raddr, luser, ruser) break; } if (*(user+1) == '@') /* match a user by netgroup */ - userok = innetgr(user+2, NULL, ruser, NULL); + userok = innetgr(user+2, NULL, ruser, ypdomain); else /* match a user by direct specification */ userok = !(strcmp(ruser, user+1)); break; @@ -438,7 +450,7 @@ __ivaliduser(hostf, raddr, luser, ruser) return(-1); if (*(user+1) == '@') { if (innetgr(user+2, NULL, - ruser, NULL)) + ruser, ypdomain)) return(-1); } else { if (!strcmp(ruser, user+1)) |
