X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/c1dfbf191b99665a833333db43e461b567452705..6a3a3fba9057be6fa8a9b678a20de0cb64f7f46a:/usr/src/lib/libc/net/rcmd.c diff --git a/usr/src/lib/libc/net/rcmd.c b/usr/src/lib/libc/net/rcmd.c index afd3af2308..2af7c4795a 100644 --- a/usr/src/lib/libc/net/rcmd.c +++ b/usr/src/lib/libc/net/rcmd.c @@ -1,5 +1,5 @@ #ifndef lint -static char sccsid[] = "@(#)rcmd.c 4.5 %G%"; +static char sccsid[] = "@(#)rcmd.c 4.8 %G%"; #endif #include @@ -68,7 +68,11 @@ retry: } listen(s2, 1); (void) sprintf(num, "%d", lport); - (void) write(s, num, strlen(num)+1); + if (write(s, num, strlen(num)+1) != strlen(num)+1) { + perror("write: setting up stderr"); + (void) close(s2); + goto bad; + } { int len = sizeof (from); s3 = accept(s2, &from, &len, 0); close(s2); @@ -138,14 +142,16 @@ rresvport(alport) } } -ruserok(rhost, ruser, luser) - char *rhost, *ruser, *luser; +ruserok(rhost, superuser, ruser, luser) + char *rhost; + int superuser; + char *ruser, *luser; { FILE *hostf; char ahost[32]; int first = 1; - hostf = fopen("/etc/hosts.equiv", "r"); + hostf = superuser ? (FILE *)0 : fopen("/etc/hosts.equiv", "r"); again: if (hostf) { while (fgets(ahost, sizeof (ahost), hostf)) { @@ -156,8 +162,10 @@ again: if (user) *user++ = 0; if (!strcmp(rhost, ahost) && - !strcmp(ruser, user ? user : luser)) - goto ok; + !strcmp(ruser, user ? user : luser)) { + (void) fclose(hostf); + return (0); + } } (void) fclose(hostf); } @@ -167,13 +175,4 @@ again: goto again; } return (-1); -ok: - (void) fclose(hostf); - return (0); -} - -socketaddr(x, y) -{ - - syscall(103,x,y); }