diff options
-rw-r--r-- | src/modules/m_ident.cpp | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index f522f6719..6f0f3b557 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -277,27 +277,39 @@ class ModuleIdent : public Module if (user->GetExt("ident_socket", isock)) { int *fd; - if (user->GetExt("ident_socket_fd", fd) && (ServerInstance->SE->GetRef(*fd) == isock)) + if (user->GetExt("ident_socket_fd", fd)) { - user->Shrink("ident_socket_fd"); - delete fd; - isock->Close(); + if (ServerInstance->SE->GetRef(*fd) == isock) + isock->Close(); + + /* Check again, isock->Close() can confuse us */ + if (user->GetExt("ident_socket_fd", fd)) + { + user->Shrink("ident_socket_fd"); + delete fd; + } } } } } - + virtual void OnUserDisconnect(userrec *user) { IdentRequestSocket *isock; if (user->GetExt("ident_socket", isock)) { int *fd; - if (user->GetExt("ident_socket_fd", fd) && (ServerInstance->SE->GetRef(*fd) == isock)) + if (user->GetExt("ident_socket_fd", fd)) { - user->Shrink("ident_socket_fd"); - delete fd; - isock->Close(); + if (ServerInstance->SE->GetRef(*fd) == isock) + isock->Close(); + + /* Check again, isock->Close() can confuse us */ + if (user->GetExt("ident_socket_fd", fd)) + { + user->Shrink("ident_socket_fd"); + delete fd; + } } } } |