summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-09-10 17:18:58 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-09-10 17:18:58 +0000
commit52aec3dd2a8a30719b678ea04741c6a36ba82990 (patch)
tree6a91056bfc6f4c65a7d7b0dce91524ed7b2e3e92 /src
parentba5a5b345cdfbc73c0faf9a6cb5fd8d96474ae41 (diff)
Match IP's with klines, glines and exceptions, as well as hosts
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5201 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/users.cpp8
-rw-r--r--src/xline.cpp26
2 files changed, 17 insertions, 17 deletions
diff --git a/src/users.cpp b/src/users.cpp
index 53d46ceb8..ee348fac4 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -973,7 +973,7 @@ void userrec::AddClient(InspIRCd* Instance, int socket, int port, bool iscached,
userrec::QuitUser(Instance, _new,"Server is full");
return;
}
- char* e = Instance->XLines->matches_exception(ipaddr);
+ char* e = Instance->XLines->matches_exception(_new);
if (!e)
{
char* r = Instance->XLines->matches_zline(ipaddr);
@@ -1070,11 +1070,11 @@ void userrec::FullConnect(CullList* Goners)
char match_against[MAXBUF];
snprintf(match_against,MAXBUF,"%s@%s", this->ident, this->host);
- char* e = ServerInstance->XLines->matches_exception(match_against);
+ char* e = ServerInstance->XLines->matches_exception(this);
if (!e)
{
- char* r = ServerInstance->XLines->matches_gline(match_against);
+ char* r = ServerInstance->XLines->matches_gline(this);
if (r)
{
@@ -1084,7 +1084,7 @@ void userrec::FullConnect(CullList* Goners)
return;
}
- r = ServerInstance->XLines->matches_kline(match_against);
+ r = ServerInstance->XLines->matches_kline(this);
if (r)
{
diff --git a/src/xline.cpp b/src/xline.cpp
index 2fd36bff5..2430283ce 100644
--- a/src/xline.cpp
+++ b/src/xline.cpp
@@ -381,30 +381,30 @@ char* XLineManager::matches_qline(const char* nick)
// returns a pointer to the reason if a host matches a gline, NULL if it didnt match
-char* XLineManager::matches_gline(const char* host)
+char* XLineManager::matches_gline(userrec* user)
{
if ((glines.empty()) && (pglines.empty()))
return NULL;
for (std::vector<GLine>::iterator i = glines.begin(); i != glines.end(); i++)
- if (match(host,i->hostmask, true))
+ if (match(user->host,i->hostmask, true) || (match(user->GetIPString(),i->hostmask, true)))
return i->reason;
for (std::vector<GLine>::iterator i = pglines.begin(); i != pglines.end(); i++)
- if (match(host,i->hostmask, true))
+ if (match(user->host,i->hostmask, true) || (match(user->GetIPString(),i->hostmask, true)))
return i->reason;
return NULL;
}
-char* XLineManager::matches_exception(const char* host)
+char* XLineManager::matches_exception(userrec* user)
{
if ((elines.empty()) && (pelines.empty()))
return NULL;
char host2[MAXBUF];
- snprintf(host2,MAXBUF,"*@%s",host);
+ snprintf(host2,MAXBUF,"*@%s",user->host);
for (std::vector<ELine>::iterator i = elines.begin(); i != elines.end(); i++)
- if ((match(host,i->hostmask)) || (match(host2,i->hostmask, true)))
+ if ((match(user->host,i->hostmask)) || (match(host2,i->hostmask, true)) || (match(user->GetIPString(),i->hostmask, true)))
return i->reason;
for (std::vector<ELine>::iterator i = pelines.begin(); i != pelines.end(); i++)
- if ((match(host,i->hostmask)) || (match(host2,i->hostmask, true)))
+ if ((match(user->host,i->hostmask)) || (match(host2,i->hostmask, true)) || (match(user->GetIPString(),i->hostmask, true)))
return i->reason;
return NULL;
}
@@ -511,15 +511,15 @@ char* XLineManager::matches_zline(const char* ipaddr)
// returns a pointer to the reason if a host matches a kline, NULL if it didnt match
-char* XLineManager::matches_kline(const char* host)
+char* XLineManager::matches_kline(userrec* user)
{
if ((klines.empty()) && (pklines.empty()))
return NULL;
for (std::vector<KLine>::iterator i = klines.begin(); i != klines.end(); i++)
- if (match(host,i->hostmask, true))
+ if ((match(user->host,i->hostmask, true)) || (match(user->GetIPString(),i->hostmask, true)))
return i->reason;
for (std::vector<KLine>::iterator i = pklines.begin(); i != pklines.end(); i++)
- if (match(host,i->hostmask, true))
+ if ((match(user->host,i->hostmask, true)) || (match(user->GetIPString(),i->hostmask, true)))
return i->reason;
return NULL;
}
@@ -617,12 +617,12 @@ void XLineManager::apply_lines(const int What)
if (elines.size() || pelines.size())
{
// ignore people matching exempts
- if (matches_exception(host))
+ if (matches_exception(u))
continue;
}
if ((What & APPLY_GLINES) && (glines.size() || pglines.size()))
{
- if ((check = matches_gline(host)))
+ if ((check = matches_gline(u)))
{
snprintf(reason,MAXBUF,"G-Lined: %s",check);
Goners->AddItem(u,reason);
@@ -630,7 +630,7 @@ void XLineManager::apply_lines(const int What)
}
if ((What & APPLY_KLINES) && (klines.size() || pklines.size()))
{
- if ((check = matches_kline(host)))
+ if ((check = matches_kline(u)))
{
snprintf(reason,MAXBUF,"K-Lined: %s",check);
Goners->AddItem(u,reason);