From: Michael Poole Date: Tue, 6 Aug 2013 03:01:51 +0000 (-0400) Subject: Avoid crashes when handling ET_EOF for IAuth stderr before stdout. X-Git-Url: http://git.pk910.de/?p=ircu2.10.12-pk.git;a=commitdiff_plain;h=389b4c485cac5cf8deff89e381020f2a38f1ad34 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. --- 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. */