summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-08 15:51:30 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-08 15:51:30 +0000
commit4f1d3a7192ea1b081b47f2ca1899aa25061b270d (patch)
tree734eb7ecc8d5aede1dbedb6324398e8b9995ebcd
parent922d4ebf7a27a6577d6b4f91e0f42ccdfa989455 (diff)
FindMatchingLocal/FindMatchingGlobal -> userrec::LocalCloneCount(), userrec::GlobalCloneCount()
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4794 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/users.h6
-rw-r--r--src/modules/m_check.cpp2
-rw-r--r--src/users.cpp14
3 files changed, 11 insertions, 11 deletions
diff --git a/include/users.h b/include/users.h
index bfee92f83..983ae193e 100644
--- a/include/users.h
+++ b/include/users.h
@@ -449,6 +449,9 @@ class userrec : public connection
void UnOper();
+long GlobalCloneCount();
+long LocalCloneCount();
+
/** Default destructor
*/
virtual ~userrec();
@@ -483,7 +486,4 @@ bool DoType(const char* tag, char** entries, void** values, int* types);
bool DoClass(const char* tag, char** entries, void** values, int* types);
bool DoneClassesAndTypes(const char* tag);
-long FindMatchingGlobal(userrec* user);
-long FindMatchingLocal(userrec* user);
-
#endif
diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp
index a00d32b9e..0535c56ee 100644
--- a/src/modules/m_check.cpp
+++ b/src/modules/m_check.cpp
@@ -132,7 +132,7 @@ class cmd_check : public command_t
* find how many connections from this user's IP -- unlike Asuka,
* I define a clone as coming from the same host. --w00t
*/
- sprintf(ptr, "%lu ", FindMatchingGlobal(i->second));
+ sprintf(ptr, "%lu ", i->second->GlobalCloneCount());
if (flags & UCMODE_OP)
{
diff --git a/src/users.cpp b/src/users.cpp
index 61600bd04..dabbc870f 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -924,7 +924,7 @@ void AddClient(int socket, int port, bool iscached, insp_inaddr ip)
WriteServ(_new->fd,"NOTICE Auth :*** Looking up your hostname...");
}
-long FindMatchingGlobal(userrec* user)
+long userrec::GlobalCloneCount()
{
char u1[1024];
char u2[1024];
@@ -934,13 +934,13 @@ long FindMatchingGlobal(userrec* user)
/* We have to match ip's as strings - we don't know what protocol
* a remote user may be using
*/
- if (!strcasecmp(a->second->GetIPString(u1), user->GetIPString(u2)))
+ if (!strcasecmp(a->second->GetIPString(u1), this->GetIPString(u2)))
x++;
}
return x;
}
-long FindMatchingLocal(userrec* user)
+long userrec::LocalCloneCount()
{
long x = 0;
for (std::vector<userrec*>::const_iterator a = local_users.begin(); a != local_users.end(); a++)
@@ -949,12 +949,12 @@ long FindMatchingLocal(userrec* user)
#ifdef IPV6
/* I dont think theres any faster way of matching two ipv6 addresses than memcmp */
in6_addr* s1 = &(((sockaddr_in6*)comp->ip)->sin6_addr);
- in6_addr* s2 = &(((sockaddr_in6*)user->ip)->sin6_addr);
+ in6_addr* s2 = &(((sockaddr_in6*)this->ip)->sin6_addr);
if (!memcmp(s1->s6_addr, s2->s6_addr, sizeof(in6_addr)))
x++;
#else
in_addr* s1 = &((sockaddr_in*)comp->ip)->sin_addr;
- in_addr* s2 = &((sockaddr_in*)user->ip)->sin_addr;
+ in_addr* s2 = &((sockaddr_in*)this->ip)->sin_addr;
if (s1->s_addr == s2->s_addr)
x++;
#endif
@@ -981,13 +981,13 @@ void userrec::FullConnect(CullList* Goners)
return;
}
- if (FindMatchingLocal(this) > a.maxlocal)
+ if (this->LocalCloneCount() > a.maxlocal)
{
Goners->AddItem(this, "No more connections allowed from your host via this connect class (local)");
WriteOpers("*** WARNING: maximum LOCAL connections (%ld) exceeded for IP %s", a.maxlocal, this->GetIPString());
return;
}
- else if (FindMatchingGlobal(this) > a.maxglobal)
+ else if (this->GlobalCloneCount() > a.maxglobal)
{
Goners->AddItem(this, "No more connections allowed from your host via this connect class (global)");
WriteOpers("*** WARNING: maximum GLOBAL connections (%ld) exceeded for IP %s",a.maxglobal, this->GetIPString());