From 7ac4fbe33b35cf42fbded97a2fdb4a5d9163f04b Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 7 Feb 2007 19:39:42 +0000 Subject: Make this work when we have both ipv6 and ipv4 connections at once git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6538 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_cgiirc.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index 30147c4cb..7e471652d 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -65,6 +65,7 @@ class CGIResolver : public Resolver strlcpy(them->host, result.c_str(), 63); strlcpy(them->dhost, result.c_str(), 63); strlcpy(them->ident, "~cgiirc", 8); + them->InvalidateCache(); } } @@ -231,12 +232,19 @@ public: user->Extend("cgiirc_realip", new std::string(user->GetIPString())); strlcpy(user->host, user->password, 64); strlcpy(user->dhost, user->password, 64); - + user->InvalidateCache(); + + bool valid = false; #ifdef IPV6 - if (insp_aton(user->password, (insp_inaddr*)&((sockaddr_in6*)&user->ip)->sin6_addr)) + if (strchr(user->password,':')) + valid = (inet_pton(user->password, &((sockaddr_in6*)&user->ip)->sin6_addr)); + else + valid = (inet_aton(user->password, &((sockaddr_in*)&user->ip)->sin_addr)); #else - if (insp_aton(user->password, (insp_inaddr*)&((sockaddr_in*)&user->ip)->sin_addr)) + if (inet_aton(user->password, &((sockaddr_in*)&user->ip)->sin_addr)) + valid = true; #endif + if (valid) { /* We were given a IP in the password, we don't do DNS so they get this is as their host as well. */ if(NotifyOpers) -- cgit v1.2.3