summaryrefslogtreecommitdiff
path: root/lib/libc/net/rcmd.c
diff options
context:
space:
mode:
authorBill Paul <wpaul@FreeBSD.org>1995-08-14 23:52:49 +0000
committerBill Paul <wpaul@FreeBSD.org>1995-08-14 23:52:49 +0000
commit97cb50947e77564730bebe701f302fd63b768ec9 (patch)
tree4881c6a03aa0594e9a9fa4389f0f7962eef5ccac /lib/libc/net/rcmd.c
parent0699090b6a4116e3cc55b20d33548f9866c5ff1d (diff)
Notes
Diffstat (limited to 'lib/libc/net/rcmd.c')
-rw-r--r--lib/libc/net/rcmd.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libc/net/rcmd.c b/lib/libc/net/rcmd.c
index f0d756ceeb78..405dd8ec4d1e 100644
--- a/lib/libc/net/rcmd.c
+++ b/lib/libc/net/rcmd.c
@@ -361,6 +361,7 @@ __ivaliduser(hostf, raddr, luser, ruser)
register char *user, *p;
int ch;
char buf[MAXHOSTNAMELEN + 128]; /* host + login */
+ char hname[MAXHOSTNAMELEN];
struct hostent *hp;
/* Presumed guilty until proven innocent. */
int userok = 0, hostok = 0;
@@ -376,6 +377,7 @@ __ivaliduser(hostf, raddr, luser, ruser)
if ((hp = gethostbyaddr((char *)&raddr, sizeof(u_long),
AF_INET)) == NULL)
return (-1);
+ strcpy(hname, hp->h_name);
while (fgets(buf, sizeof(buf), hostf)) {
p = buf;
@@ -414,15 +416,15 @@ __ivaliduser(hostf, raddr, luser, ruser)
break;
}
if (buf[1] == '@') /* match a host by netgroup */
- hostok = innetgr((char *)&buf[2], hp->h_name,
- NULL, ypdomain);
+ hostok = innetgr((char *)&buf[2],
+ (char *)&hname, 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, ypdomain))
+ (char *)&hname, NULL, ypdomain))
return(-1);
} else {
if (__icheckhost(raddr,(char *)&buf[1]))