From b8af948ecd74a924d5d490aedbb35d49c1b242cd Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 7 Feb 2007 19:41:42 +0000 Subject: Add InvalidateCache() calls and fix a ton of ass-u-me :/ git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6539 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_cgiirc.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index 7e471652d..f7d14ecc7 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -237,7 +237,7 @@ public: bool valid = false; #ifdef IPV6 if (strchr(user->password,':')) - valid = (inet_pton(user->password, &((sockaddr_in6*)&user->ip)->sin6_addr)); + valid = (inet_pton(user->password, &((sockaddr_in6*)&user->ip)->sin6_addr) > 0); else valid = (inet_aton(user->password, &((sockaddr_in*)&user->ip)->sin_addr)); #else @@ -300,10 +300,14 @@ public: user->Extend("cgiirc_realhost", new std::string(user->host)); user->Extend("cgiirc_realip", new std::string(user->GetIPString())); #ifdef IPV6 - insp_aton(newip, (insp_inaddr*)&((sockaddr_in6*)&user->ip)->sin6_addr); + if (strchr(user->password,':')) + inet_pton(newip, &((sockaddr_in6*)&user->ip)->sin6_addr); + else + inet_aton(newip, &((sockaddr_in*)&user->ip)->sin_addr); #else - insp_aton(newip, (insp_inaddr*)&((sockaddr_in*)&user->ip)->sin_addr); + inet_aton(newip, &((sockaddr_in*)&user->ip)->sin_addr); #endif + try { @@ -316,6 +320,7 @@ public: strlcpy(user->host, newip, 16); strlcpy(user->dhost, newip, 16); strlcpy(user->ident, "~cgiirc", 8); + user->InvalidateCache(); if(NotifyOpers) ServerInstance->WriteOpers("*** Connecting user %s detected as using CGI:IRC (%s), but i could not resolve their hostname!", user->nick, user->host); -- cgit v1.2.3