krb5 commit [krb5-1.11]: Fix spin loop reading from KDC TCP socket
Tom Yu
tlyu at MIT.EDU
Mon Jul 1 15:55:50 EDT 2013
https://github.com/krb5/krb5/commit/a68c4fb6c498d2507a060db1deb44e0a5a42cd31
commit a68c4fb6c498d2507a060db1deb44e0a5a42cd31
Author: Tom Yu <tlyu at mit.edu>
Date: Mon Jul 1 15:18:33 2013 -0400
Fix spin loop reading from KDC TCP socket
In the k5_sendto code for reading from a TCP socket, detect
end-of-stream when reading the length. Otherwise we can get stuck in
an infinite loop of poll() and read().
[ghudson at mit.edu: commit message]
(back ported from commit 53e5c850e05f011e9e7f25c2032aec51d8b352a9)
ticket: 7508
version_fixed: 1.11.4
status: resolved
src/lib/krb5/os/sendto_kdc.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/lib/krb5/os/sendto_kdc.c b/src/lib/krb5/os/sendto_kdc.c
index 96991de..cc7b86f 100644
--- a/src/lib/krb5/os/sendto_kdc.c
+++ b/src/lib/krb5/os/sendto_kdc.c
@@ -1090,9 +1090,9 @@ service_tcp_fd(krb5_context context, struct conn_state *conn,
nread = SOCKET_READ(conn->fd,
conn->x.in.bufsizebytes + conn->x.in.bufsizebytes_read,
4 - conn->x.in.bufsizebytes_read);
- if (nread < 0) {
+ if (nread <= 0) {
+ e = nread ? SOCKET_ERRNO : ECONNRESET;
TRACE_SENDTO_KDC_TCP_ERROR_RECV_LEN(context, conn, e);
- e = SOCKET_ERRNO;
goto kill_conn;
}
conn->x.in.bufsizebytes_read += nread;
More information about the cvs-krb5
mailing list