- OpenBSD CVS update:
   - [channels.c]
     close efd on eof
   - [clientloop.c compat.c ssh.c sshconnect.c myproposal.h]
     ssh2 client implementation, interops w/ ssh.com and lsh servers.
   - [sshconnect.c]
     missing free.
   - [authfile.c cipher.c cipher.h packet.c sshconnect.c sshd.c]
     remove unused argument, split cipher_mask()
   - [clientloop.c]
     re-order: group ssh1 vs. ssh2
 - Make Redhat spec require openssl >= 0.9.5a
diff --git a/channels.c b/channels.c
index 18f667f..f03cf92 100644
--- a/channels.c
+++ b/channels.c
@@ -17,7 +17,7 @@
  */
 
 #include "includes.h"
-RCSID("$Id: channels.c,v 1.21 2000/04/04 04:39:00 damien Exp $");
+RCSID("$Id: channels.c,v 1.22 2000/04/06 02:32:38 damien Exp $");
 
 #include "ssh.h"
 #include "packet.h"
@@ -642,6 +642,7 @@
 	char buf[16*1024];
 	int len;
 
+/** XXX handle drain efd, too */
 	if (c->efd != -1) {
 		if (c->extended_usage == CHAN_EXTENDED_WRITE &&
 		    FD_ISSET(c->efd, writeset) &&
@@ -659,7 +660,12 @@
 			len = read(c->efd, buf, sizeof(buf));
 			debug("channel %d: read %d from efd %d",
 			     c->self, len, c->efd);
-			if (len > 0)
+			if (len == 0) {
+				debug("channel %d: closing efd %d",
+				    c->self, c->efd);
+				close(c->efd);
+				c->efd = -1;
+			} else if (len > 0)
 				buffer_append(&c->extended, buf, len);
 		}
 	}