diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-02-07 19:39:42 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-02-07 19:39:42 +0000 |
commit | 7ac4fbe33b35cf42fbded97a2fdb4a5d9163f04b (patch) | |
tree | 993ff893fca40496107d940f9051b4339d2c140c /src | |
parent | 2b14136d017948d8fecff5de3c9c267a63f977eb (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_cgiirc.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
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) |