Репозитории ALT
S: | 0.17-alt5.1 |
4.1: | 0.17-alt2 |
4.0: | 0.17-ipl9mdk |
3.0: | 0.17-ipl9mdk |
Группа :: Сети/Удалённый доступ
Пакет: rsh
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: netkit-rsh-0.16-jbj2.patch
Скачать
Скачать
--- netkit-rsh-0.16/rshd/rshd.c.jbj2 Mon Jan 10 11:23:21 2000
+++ netkit-rsh-0.16/rshd/rshd.c Mon Jan 10 13:34:44 2000
@@ -43,7 +43,7 @@
* From: @(#)rshd.c 5.38 (Berkeley) 3/2/91
*/
char rcsid[] =
- "$Id: rshd.c,v 1.22 1999/10/02 21:45:08 dholland Exp $";
+ "$Id: rshd.c,v 1.23 1999/12/17 14:57:09 dholland Exp $";
#include "../version.h"
/*
@@ -171,7 +171,7 @@
fd_set ready, readfrom;
char buf[BUFSIZ], sig;
int one = 1;
- int nfd, cc, done=0;
+ int nfd, cc, guys=2;
ioctl(pype, FIONBIO, (char *)&one);
/* should set s nbio! */
@@ -182,24 +182,28 @@
if (pype > sock) nfd = pype+1;
else nfd = sock+1;
- while (!done) {
+ while (guys > 0) {
ready = readfrom;
- if (select(nfd, &ready, NULL, NULL, NULL) < 0 && errno != EINTR) {
- break;
+ if (select(nfd, &ready, NULL, NULL, NULL) < 0) {
+ if (errno != EINTR) {
+ break;
+ }
+ continue;
}
- done = 1;
if (FD_ISSET(sock, &ready)) {
- done = 0;
cc = read(sock, &sig, 1);
- if (cc <= 0) FD_CLR(sock, &readfrom);
+ if (cc <= 0) {
+ FD_CLR(sock, &readfrom);
+ guys--;
+ }
else killpg(pid, sig);
}
if (FD_ISSET(pype, &ready)) {
- done = 0;
cc = read(pype, buf, sizeof(buf));
if (cc <= 0) {
shutdown(sock, 2);
FD_CLR(pype, &readfrom);
+ guys--;
}
else write(sock, buf, cc);
}
@@ -209,6 +213,8 @@
/*
* This does not strike me as the right place for this; this is
* in a child process... what does this need to accomplish?
+ *
+ * No, it's not the child process, the code is just confusing.
*/
pam_close_session(pamh, 0);
pam_end(pamh, PAM_SUCCESS);
@@ -513,7 +519,7 @@
ipproto = ip->p_proto;
else
ipproto = IPPROTO_IP;
- if (!getsockopt(0, ipproto, IP_OPTIONS, (char *)optbuf, &optsize) &&
+ if (!getsockopt(fd, ipproto, IP_OPTIONS, (char *)optbuf, &optsize) &&
optsize != 0) {
lp = lbuf;
@@ -530,7 +536,7 @@
" (ignored): %s",
inet_ntoa(fromp->sin_addr), lbuf);
- if (setsockopt(0, ipproto, IP_OPTIONS, NULL, optsize) != 0) {
+ if (setsockopt(fd, ipproto, IP_OPTIONS, NULL, optsize) != 0) {
syslog(LOG_ERR, "setsockopt IP_OPTIONS NULL: %m");
exit(1);
}