diff options
author | special <special@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-04-01 20:30:17 +0000 |
---|---|---|
committer | special <special@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-04-01 20:30:17 +0000 |
commit | 64184418d44649edb190df7c77297146bd6fc366 (patch) | |
tree | 3f3460a2cd1099d8b378998899c5a916f2965609 | |
parent | 05c0944bc22f16e24943a209429651e6226cc12c (diff) |
Partial revert of r11274 (m_ident binding, bug #815); the meaning of this segment of code was completely reversed and broke ident binding alltogether. This part of the code may need other changes to make a full fix to #815. Remember - we're in feature freeze. Try to keep things focused on fixing the bugs, not cleaning up and refactoring code.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11275 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/modules/m_ident.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index a5f81c6f4..04ad7ba4a 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -372,7 +372,25 @@ class ModuleIdent : public Module user->WriteServ("NOTICE Auth :*** Looking up your ident..."); // Get the IP that the user is connected to, and bind to that for the outgoing connection - const char *ip = user->GetIPString(); + #ifndef IPV6 + sockaddr_in laddr; + #else + sockaddr_in6 laddr; + #endif + socklen_t laddrsz = sizeof(laddr); + + if (getsockname(user->GetFd(), (sockaddr*) &laddr, &laddrsz) != 0) + { + user->WriteServ("NOTICE Auth :*** Could not find your ident, using %s instead.", user->ident.c_str()); + return 0; + } + + #ifndef IPV6 + const char *ip = inet_ntoa(laddr.sin_addr); + #else + char ip[INET6_ADDRSTRLEN + 1]; + inet_ntop(laddr.sin6_family, &laddr.sin6_addr, ip, INET6_ADDRSTRLEN); + #endif IdentRequestSocket *isock = NULL; try |