diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-09-10 17:28:03 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-09-10 17:28:03 +0000 |
commit | 7ee9ca88a8a4aa0d671d331cee7ae132c7c1e1a3 (patch) | |
tree | f9687302b070f15cb70cba34ae931e866ae5e3b7 /src | |
parent | 52aec3dd2a8a30719b678ea04741c6a36ba82990 (diff) |
Fix the new g/k/e line stuff to match ips. NOTE: this makes g/k/e much slower than z. By factors of about 3. If you want to match tons of users, as always use zline (for this and many other reasons)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5202 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/users.cpp | 2 | ||||
-rw-r--r-- | src/xline.cpp | 26 |
2 files changed, 20 insertions, 8 deletions
diff --git a/src/users.cpp b/src/users.cpp index ee348fac4..56d578687 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -1068,8 +1068,6 @@ void userrec::FullConnect(CullList* Goners) return; } - char match_against[MAXBUF]; - snprintf(match_against,MAXBUF,"%s@%s", this->ident, this->host); char* e = ServerInstance->XLines->matches_exception(this); if (!e) diff --git a/src/xline.cpp b/src/xline.cpp index 2430283ce..17dfa3f63 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -383,28 +383,38 @@ char* XLineManager::matches_qline(const char* nick) char* XLineManager::matches_gline(userrec* user) { + char match1[MAXBUF]; + char match2[MAXBUF]; + snprintf(match1, MAXBUF, "%s@%s", user->ident, user->GetIPString()); + snprintf(match2, MAXBUF, "%s@%s", user->ident, user->host); + if ((glines.empty()) && (pglines.empty())) return NULL; for (std::vector<GLine>::iterator i = glines.begin(); i != glines.end(); i++) - if (match(user->host,i->hostmask, true) || (match(user->GetIPString(),i->hostmask, true))) + if (match(match1,i->hostmask, true) || (match(match2,i->hostmask, true))) return i->reason; for (std::vector<GLine>::iterator i = pglines.begin(); i != pglines.end(); i++) - if (match(user->host,i->hostmask, true) || (match(user->GetIPString(),i->hostmask, true))) + if (match(match1,i->hostmask, true) || (match(match2,i->hostmask, true))) return i->reason; return NULL; } char* XLineManager::matches_exception(userrec* user) { + char match1[MAXBUF]; + char match2[MAXBUF]; + snprintf(match1, MAXBUF, "%s@%s", user->ident, user->GetIPString()); + snprintf(match2, MAXBUF, "%s@%s", user->ident, user->host); + if ((elines.empty()) && (pelines.empty())) return NULL; char host2[MAXBUF]; snprintf(host2,MAXBUF,"*@%s",user->host); for (std::vector<ELine>::iterator i = elines.begin(); i != elines.end(); i++) - if ((match(user->host,i->hostmask)) || (match(host2,i->hostmask, true)) || (match(user->GetIPString(),i->hostmask, true))) + if ((match(match1,i->hostmask)) || (match(host2,i->hostmask, true)) || (match(match2,i->hostmask, true))) return i->reason; for (std::vector<ELine>::iterator i = pelines.begin(); i != pelines.end(); i++) - if ((match(user->host,i->hostmask)) || (match(host2,i->hostmask, true)) || (match(user->GetIPString(),i->hostmask, true))) + if ((match(match1,i->hostmask)) || (match(host2,i->hostmask, true)) || (match(match2,i->hostmask, true))) return i->reason; return NULL; } @@ -513,13 +523,17 @@ char* XLineManager::matches_zline(const char* ipaddr) char* XLineManager::matches_kline(userrec* user) { + char match1[MAXBUF]; + char match2[MAXBUF]; + snprintf(match1, MAXBUF, "%s@%s", user->ident, user->GetIPString()); + snprintf(match2, MAXBUF, "%s@%s", user->ident, user->host); if ((klines.empty()) && (pklines.empty())) return NULL; for (std::vector<KLine>::iterator i = klines.begin(); i != klines.end(); i++) - if ((match(user->host,i->hostmask, true)) || (match(user->GetIPString(),i->hostmask, true))) + if ((match(match1,i->hostmask, true)) || (match(match2,i->hostmask, true))) return i->reason; for (std::vector<KLine>::iterator i = pklines.begin(); i != pklines.end(); i++) - if ((match(user->host,i->hostmask, true)) || (match(user->GetIPString(),i->hostmask, true))) + if ((match(match1,i->hostmask, true)) || (match(match2,i->hostmask, true))) return i->reason; return NULL; } |