[29751] in CVS-changelog-for-Kerberos-V5
krb5 commit [krb5-1.14]: Properly handle EOF condition on libkrad
daemon@ATHENA.MIT.EDU (Tom Yu)
Mon Oct 24 16:02:37 2016
Date: Mon, 24 Oct 2016 15:57:53 -0400
From: Tom Yu <tlyu@mit.edu>
Message-Id: <201610241957.u9OJvrTM015111@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu
https://github.com/krb5/krb5/commit/10d20626a327213f05578d7dffb4d02ddfce5b0f
commit 10d20626a327213f05578d7dffb4d02ddfce5b0f
Author: Nathaniel McCallum <npmccallum@redhat.com>
Date: Fri Sep 30 10:03:33 2016 -0400
Properly handle EOF condition on libkrad sockets
In the previous code, when the remote peer performed an orderly shutdown
on the socket, libkrad would enter a state in which all future requests
timed out. Instead, if the peer shuts down its socket, we need to
attempt to reopen it.
(cherry picked from commit 248497427d5a45225817b6c22e9224e8ad969872)
ticket: 8504
version_fixed: 1.14.5
src/lib/krad/remote.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/src/lib/krad/remote.c b/src/lib/krad/remote.c
index df3de3a..68cd16f 100644
--- a/src/lib/krad/remote.c
+++ b/src/lib/krad/remote.c
@@ -329,16 +329,15 @@ on_io_read(krad_remote *rr)
/* Read the packet. */
i = recv(verto_get_fd(rr->io), rr->buffer.data + rr->buffer.length,
pktlen, 0);
- if (i < 0) {
- /* Should we try again? */
- if (errno == EWOULDBLOCK || errno == EAGAIN || errno == EINTR)
- return;
- /* The socket is unrecoverable. */
+ /* On these errors, try again. */
+ if (i < 0 && (errno == EWOULDBLOCK || errno == EAGAIN || errno == EINTR))
+ return;
+
+ /* On any other errors or on EOF, the socket is unrecoverable. */
+ if (i <= 0) {
remote_shutdown(rr);
return;
- } else if (i == 0) {
- remote_del_flags(rr, FLAGS_READ);
}
/* If we have a partial read or just the header, try again. */
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5