From 279a040bf3bf98a81502410dd71ccdc630683233 Mon Sep 17 00:00:00 2001 From: Greg Hudson <ghudson@mit.edu> Date: Thu, 1 Sep 2011 03:36:29 +0000 Subject: [PATCH] Fix connection termination bug in sendto_kdc When terminating a connection, close and invalidate conn->fd so that we don't look for it in selstate on the next select or poll invocation. Looking for such an fd is harmless when using select, but results in an assertion failure when using poll. ticket: 6951 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25120 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/os/sendto_kdc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/krb5/os/sendto_kdc.c b/src/lib/krb5/os/sendto_kdc.c index 541598787..2856c09a7 100644 --- a/src/lib/krb5/os/sendto_kdc.c +++ b/src/lib/krb5/os/sendto_kdc.c @@ -913,12 +913,12 @@ maybe_send(krb5_context context, struct conn_state *conn, static void kill_conn(struct conn_state *conn, struct select_state *selstate, int err) { + dprint("abandoning connection %d: %m\n", conn->fd, err); + cm_remove_fd(selstate, conn->fd); + closesocket(conn->fd); + conn->fd = INVALID_SOCKET; conn->state = FAILED; conn->err = err; - shutdown(conn->fd, SHUTDOWN_BOTH); - cm_remove_fd(selstate, conn->fd); - dprint("abandoning connection %d: %m\n", conn->fd, err); - /* Fix up max fd for next select call. */ } /* Check socket for error. */ -- 2.26.2