From 389b4c485cac5cf8deff89e381020f2a38f1ad34 Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Mon, 5 Aug 2013 23:01:51 -0400 Subject: [PATCH] Avoid crashes when handling ET_EOF for IAuth stderr before stdout. Because iauth_stderr_callback() ignores ET_DESTROY, we should destroy IAuth stderr first. Then, when iauth_sock_callback() handles ET_DESTROY for the stdout socket, it can respawn the socket without generating a second ET_DESTROY for stderr. --- ircd/s_auth.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ircd/s_auth.c b/ircd/s_auth.c index 924bd50..95e7d5c 100644 --- a/ircd/s_auth.c +++ b/ircd/s_auth.c @@ -1373,19 +1373,19 @@ static void iauth_disconnect(struct IAuth *iauth) if (iauth == NULL) return; - /* Close main socket. */ - if (s_fd(i_socket(iauth)) != -1) { - close(s_fd(i_socket(iauth))); - socket_del(i_socket(iauth)); - s_fd(i_socket(iauth)) = -1; - } - /* Close error socket. */ if (s_fd(i_stderr(iauth)) != -1) { close(s_fd(i_stderr(iauth))); socket_del(i_stderr(iauth)); s_fd(i_stderr(iauth)) = -1; } + + /* Close main socket. */ + if (s_fd(i_socket(iauth)) != -1) { + close(s_fd(i_socket(iauth))); + socket_del(i_socket(iauth)); + s_fd(i_socket(iauth)) = -1; + } } /** Close all %IAuth connections marked as closing. */ -- 2.20.1