diff options
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 34ac18b..f0d756c 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)) |