projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
purge socketaddr call in favor of getsockname
[unix-history]
/
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
afd3af2
..
2af7c47
100644
(file)
--- a/
usr/src/lib/libc/net/rcmd.c
+++ b/
usr/src/lib/libc/net/rcmd.c
@@
-1,5
+1,5
@@
#ifndef lint
#ifndef lint
-static char sccsid[] = "@(#)rcmd.c 4.
5
%G%";
+static char sccsid[] = "@(#)rcmd.c 4.
8
%G%";
#endif
#include <stdio.h>
#endif
#include <stdio.h>
@@
-68,7
+68,11
@@
retry:
}
listen(s2, 1);
(void) sprintf(num, "%d", lport);
}
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);
{ 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;
{
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)) {
again:
if (hostf) {
while (fgets(ahost, sizeof (ahost), hostf)) {
@@
-156,8
+162,10
@@
again:
if (user)
*user++ = 0;
if (!strcmp(rhost, ahost) &&
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);
}
}
(void) fclose(hostf);
}
@@
-167,13
+175,4
@@
again:
goto again;
}
return (-1);
goto again;
}
return (-1);
-ok:
- (void) fclose(hostf);
- return (0);
-}
-
-socketaddr(x, y)
-{
-
- syscall(103,x,y);
}
}