diff options
| author | Bill Paul <wpaul@FreeBSD.org> | 1995-08-07 03:42:14 +0000 | 
|---|---|---|
| committer | Bill Paul <wpaul@FreeBSD.org> | 1995-08-07 03:42:14 +0000 | 
| commit | 1e890b056ae039be18929c22b500c718bc4d0a5c (patch) | |
| tree | 094b8300be99741448346c1cc2ce125e803fa6a3 /lib/libc/net/rcmd.c | |
| parent | 02d5c7b197ef3368fe3a04cbb43047be931bec6a (diff) | |
Notes
Diffstat (limited to 'lib/libc/net/rcmd.c')
| -rw-r--r-- | lib/libc/net/rcmd.c | 20 | 
1 files changed, 16 insertions, 4 deletions
| 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)) | 
