diff options
author | Ulrich Drepper <drepper@redhat.com> | 1997-03-17 03:44:01 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1997-03-17 03:44:01 +0000 |
commit | c5cb336b8785fc2d0790247aadb5e894958c3645 (patch) | |
tree | fe9216addc6c986a16f2dbe1051a14d31aa334c9 /inet | |
parent | 8d7899fbb6f71b9753726827807ff6a4f95da726 (diff) |
Use __ protected versions of non-standard functions.
(iruserok): Use euidaccess instead of half-hearted
switching of UID before opening .rhosts.
Diffstat (limited to 'inet')
-rw-r--r-- | inet/rcmd.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/inet/rcmd.c b/inet/rcmd.c index fb91f851b7..342c1c909e 100644 --- a/inet/rcmd.c +++ b/inet/rcmd.c @@ -306,7 +306,6 @@ iruserok(raddr, superuser, ruser, luser) struct stat sbuf; struct passwd pwdbuf, *pwd; FILE *hostf; - uid_t uid; int first; first = 1; @@ -326,7 +325,7 @@ again: char *buffer = __alloca (buflen); first = 0; - if (getpwnam_r (luser, &pwdbuf, buffer, buflen, &pwd) < 0) + if (__getpwnam_r (luser, &pwdbuf, buffer, buflen, &pwd) < 0) return -1; dirlen = strlen (pwd->pw_dir); @@ -339,10 +338,15 @@ 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 + { + uid_t uid = geteuid (); + seteuid (pwd->pw_uid); + hostf = fopen (pbuf, "r"); + seteuid (uid); + } if (hostf == NULL) return (-1); |