diff options
Diffstat (limited to 'inet/rcmd.c')
-rw-r--r-- | inet/rcmd.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/inet/rcmd.c b/inet/rcmd.c index f13a2e6..354ff35 100644 --- a/inet/rcmd.c +++ b/inet/rcmd.c @@ -339,10 +339,10 @@ again: * reading an NFS mounted file system, can't read files that * are protected read/write owner only. */ - uid = geteuid(); - (void)seteuid(pwd->pw_uid); - hostf = fopen(pbuf, "r"); - (void)seteuid(uid); + if (euidaccess (pbuf, R_OK) != 0) + hostf = NULL; + else + hostf = fopen(pbuf, "r"); if (hostf == NULL) return (-1); @@ -390,7 +390,7 @@ __ivaliduser(hostf, raddr, luser, ruser) size_t bufsize = 0; ssize_t nread; - while ((nread = getline (&buf, &bufsize, hostf)) > 0) { + while ((nread = __getline (&buf, &bufsize, hostf)) > 0) { buf[bufsize - 1] = '\0'; /* Make sure it's terminated. */ p = buf; while (*p != '\n' && *p != ' ' && *p != '\t' && *p != '\0') { |