Error message after upgraing the openssh 4.6P1

Darren Tucker dtucker at zip.com.au
Tue Apr 10 19:22:19 EST 2007


On Tue, Apr 10, 2007 at 12:45:46PM +0400, ESQUIRE Sithesvaran wrote:
> Is it final fix or it is just workaround? Because I need to implement it
> in PROD environment.

I would consider the patch in the previous mail to be experimental.
For production use , the safest thing to do would be to revert the change.

The attached patch is against 4.6p1 and does that.  To use, save
the attachment to /tmp, change to a freshly unpacked openssh-4.6p1
directory, do "patch -p0 </tmp/openssh-4.6p1-chan_read_failed.patch"
and then rebuild.

-- 
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4  37C9 C982 80C7 8FF4 FA69
    Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.
-------------- next part --------------
Index: channels.c
===================================================================
RCS file: /usr/local/src/security/openssh/cvs/openssh/channels.c,v
retrieving revision 1.251
diff -u -p -r1.251 channels.c
--- channels.c	28 Jan 2007 23:16:28 -0000	1.251
+++ channels.c	10 Apr 2007 08:58:39 -0000
@@ -1449,11 +1449,10 @@ channel_handle_rfd(Channel *c, fd_set *r
 	int len;
 
 	if (c->rfd != -1 &&
-	    (c->detach_close || FD_ISSET(c->rfd, readset))) {
+	    FD_ISSET(c->rfd, readset)) {
 		errno = 0;
 		len = read(c->rfd, buf, sizeof(buf));
-		if (len < 0 && (errno == EINTR ||
-		    (errno == EAGAIN && !(c->isatty && c->detach_close))))
+		if (len < 0 && (errno == EINTR || errno == EAGAIN))
 			return 1;
 #ifndef PTY_ZEROREAD
 		if (len <= 0) {
@@ -1605,12 +1604,11 @@ channel_handle_efd(Channel *c, fd_set *r
 				c->local_consumed += len;
 			}
 		} else if (c->extended_usage == CHAN_EXTENDED_READ &&
-		    (c->detach_close || FD_ISSET(c->efd, readset))) {
+		    FD_ISSET(c->efd, readset)) {
 			len = read(c->efd, buf, sizeof(buf));
 			debug2("channel %d: read %d from efd %d",
 			    c->self, len, c->efd);
-			if (len < 0 && (errno == EINTR ||
-			    (errno == EAGAIN && !c->detach_close)))
+			if (len < 0 && (errno == EINTR || errno == EAGAIN))
 				return 1;
 			if (len <= 0) {
 				debug2("channel %d: closing read-efd %d",
Index: serverloop.c
===================================================================
RCS file: /usr/local/src/security/openssh/cvs/openssh/serverloop.c,v
retrieving revision 1.151
diff -u -p -r1.151 serverloop.c
--- serverloop.c	28 Jan 2007 23:16:28 -0000	1.151
+++ serverloop.c	10 Apr 2007 08:58:39 -0000
@@ -280,7 +280,6 @@ wait_until_can_do_something(fd_set **rea
 	struct timeval tv, *tvp;
 	int ret;
 	int client_alive_scheduled = 0;
-	int program_alive_scheduled = 0;
 
 	/*
 	 * if using client_alive, set the max timeout accordingly,
@@ -318,7 +317,6 @@ wait_until_can_do_something(fd_set **rea
 		 * the client, try to get some more data from the program.
 		 */
 		if (packet_not_very_much_data_to_write()) {
-			program_alive_scheduled = child_terminated;
 			if (!fdout_eof)
 				FD_SET(fdout, *readsetp);
 			if (!fderr_eof)
@@ -364,16 +362,8 @@ wait_until_can_do_something(fd_set **rea
 		memset(*writesetp, 0, *nallocp);
 		if (errno != EINTR)
 			error("select: %.100s", strerror(errno));
-	} else {
-		if (ret == 0 && client_alive_scheduled)
-			client_alive_check();
-		if (!compat20 && program_alive_scheduled && fdin_is_tty) {
-			if (!fdout_eof)
-				FD_SET(fdout, *readsetp);
-			if (!fderr_eof)
-				FD_SET(fderr, *readsetp);
-		}
-	}
+	} else if (ret == 0 && client_alive_scheduled)
+		client_alive_check();
 
 	notify_done(*readsetp);
 }
@@ -417,8 +407,7 @@ process_input(fd_set *readset)
 	if (!fdout_eof && FD_ISSET(fdout, readset)) {
 		errno = 0;
 		len = read(fdout, buf, sizeof(buf));
-		if (len < 0 && (errno == EINTR ||
-		    (errno == EAGAIN && !child_terminated))) {
+		if (len < 0 && (errno == EINTR || errno == EAGAIN)) {
 			/* do nothing */
 #ifndef PTY_ZEROREAD
 		} else if (len <= 0) {
@@ -436,8 +425,7 @@ process_input(fd_set *readset)
 	if (!fderr_eof && FD_ISSET(fderr, readset)) {
 		errno = 0;
 		len = read(fderr, buf, sizeof(buf));
-		if (len < 0 && (errno == EINTR ||
-		    (errno == EAGAIN && !child_terminated))) {
+		if (len < 0 && (errno == EINTR || errno == EAGAIN)) {
 			/* do nothing */
 #ifndef PTY_ZEROREAD
 		} else if (len <= 0) {


More information about the openssh-unix-dev mailing list