diff options
author | special <special@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-09-29 08:13:49 +0000 |
---|---|---|
committer | special <special@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-09-29 08:13:49 +0000 |
commit | fee65af28e1db5cc431bda2dc643952b88461a74 (patch) | |
tree | 651349e4505bdac3acb39284252c231c30b7607e /src | |
parent | cbef292a6c4137bf99544e380b3a650237b2d9a7 (diff) |
Replace the IP (in addition to hostname) for CGIIRC clients; fixes glines and zlines on IPs affecting cgiirc users. Thanks to Saz|Laptop
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10607 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_cgiirc.cpp | 33 | ||||
-rw-r--r-- | src/users.cpp | 6 |
2 files changed, 13 insertions, 26 deletions
diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index 73cc95f54..3cb4da3e1 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -112,9 +112,11 @@ class CGIResolver : public Resolver them->host.assign(result,0, 64); them->dhost.assign(result, 0, 64); + if (querytype) + them->SetSockAddr(them->GetProtocolFamily(), result.c_str(), them->GetPort()); them->ident.assign("~cgiirc", 0, 8); them->InvalidateCache(); - them->CheckLines(); + them->CheckLines(true); } } @@ -268,24 +270,24 @@ public: if(iter->type == PASS) { CheckPass(user); // We do nothing if it fails so... - user->CheckLines(); + user->CheckLines(true); } else if(iter->type == PASSFIRST && !CheckPass(user)) { // If the password lookup failed, try the ident CheckIdent(user); // If this fails too, do nothing - user->CheckLines(); + user->CheckLines(true); } else if(iter->type == IDENT) { CheckIdent(user); // Nothing on failure. - user->CheckLines(); + user->CheckLines(true); } else if(iter->type == IDENTFIRST && !CheckIdent(user)) { // If the ident lookup fails, try the password. CheckPass(user); - user->CheckLines(); + user->CheckLines(true); } else if(iter->type == WEBIRC) { @@ -310,25 +312,15 @@ public: } if(user->GetExt("cgiirc_webirc_ip", webirc_ip)) { - bool valid=false; ServerInstance->Users->RemoveCloneCounts(user); -#ifdef IPV6 - valid = (inet_pton(AF_INET6, webirc_ip->c_str(), &((sockaddr_in6*)user->ip)->sin6_addr) > 0); - - if(!valid) - valid = (inet_aton(webirc_ip->c_str(), &((sockaddr_in*)user->ip)->sin_addr)); -#else - if (inet_aton(webirc_ip->c_str(), &((sockaddr_in*)user->ip)->sin_addr)) - valid = true; -#endif - + user->SetSockAddr(user->GetProtocolFamily(), webirc_ip->c_str(), user->GetPort()); delete webirc_ip; user->InvalidateCache(); user->Shrink("cgiirc_webirc_ip"); ServerInstance->Users->AddLocalClone(user); ServerInstance->Users->AddGlobalClone(user); user->CheckClass(); - user->CheckLines(); + user->CheckLines(true); } } @@ -410,12 +402,7 @@ public: user->Extend("cgiirc_realhost", new std::string(user->host)); user->Extend("cgiirc_realip", new std::string(user->GetIPString())); ServerInstance->Users->RemoveCloneCounts(user); -#ifdef IPV6 - if (user->GetProtocolFamily() == AF_INET6) - inet_pton(AF_INET6, newip, &((sockaddr_in6*)user->ip)->sin6_addr); - else -#endif - inet_aton(newip, &((sockaddr_in*)user->ip)->sin_addr); + user->SetSockAddr(user->GetProtocolFamily(), newip, user->GetPort()); ServerInstance->Users->AddLocalClone(user); ServerInstance->Users->AddGlobalClone(user); user->CheckClass(); diff --git a/src/users.cpp b/src/users.cpp index 9f9d34fa4..33b8cdc7c 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -842,10 +842,10 @@ void User::CheckClass() this->nping = ServerInstance->Time() + a->GetPingTime() + ServerInstance->Config->dns_timeout; } -bool User::CheckLines() +bool User::CheckLines(bool doZline) { - const char* check[] = { "G" , "K", NULL }; - + const char* check[] = { "G" , "K", (doZline) ? "Z" : NULL, NULL }; + if (!this->exempt) { for (int n = 0; check[n]; ++n) |