[1396] in Kerberos-V5-bugs
krb5.b5 loops in rlogin -x
daemon@ATHENA.MIT.EDU (Wolfgang Rupprecht)
Wed May 10 13:07:06 1995
Date: Wed, 10 May 1995 10:06:34 -0700
From: wolfgang@wsrcc.com (Wolfgang Rupprecht)
To: krb5-bugs@MIT.EDU
On SunOS 4.1.3 krb5.b5 "rlogin -x" will loop (chewing up 100% of the
cpu) when the remote side closed the connection.
In this condition the code loops over a read that perpetually returns
a 0 count. (I don't understand why the read wasn't returning -1 for
subsequent reads, as one would expect. Are we in non-blocking mode or
something like that???)
I was somewhat reluctant to put this fix in because of a cryptic
comment in v4_des_read(). This fix doesn't appear to break anything,
and one can still type ^C^C and have everything work as expected.
Note: There are several other places in the r* commands where the same
code snippet reappears. Perhaps they'll need fixing too.
cd /v/src/krb5.5/src/appl/bsd/
diff -c krlogin.c.~1~ krlogin.c
*** krlogin.c.~1~ Fri Apr 21 12:11:00 1995
--- krlogin.c Wed May 10 09:44:52 1995
***************
*** 1697,1702 ****
--- 1697,1708 ----
/* See the comment in v4_des_read. */
do {
cc = krb5_net_read(bsd_context, fd, &c, 1);
+
+ /* I added this test. This was looping forever when
+ the remote closed the connection -wolfgang */
+ if (cc == 0)
+ return 0;
+
/* we should check for non-blocking here, but we'd have
to make it save partial reads as well. */
if (cc < 0) return 0; /* read error */
-wolfgang
--
Wolfgang Rupprecht <wolfgang@wsrcc.com> <http://www.wsrcc.com/>