summaryrefslogtreecommitdiff
path: root/src/users.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/users.cpp')
-rw-r--r--src/users.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/users.cpp b/src/users.cpp
index 2ee389c86..39be81272 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -224,7 +224,8 @@ LocalUser::LocalUser(int myfd, irc::sockets::sockaddrs* client, irc::sockets::so
{
lastping = 0;
eh.SetFd(myfd);
- memcpy(&client_sa, client, sizeof(irc::sockets::sockaddrs));
+
+ SetClientIP(client);
memcpy(&server_sa, servaddr, sizeof(irc::sockets::sockaddrs));
}
@@ -841,7 +842,7 @@ void LocalUser::FullConnect()
FOREACH_MOD(I_OnPostConnect,OnPostConnect(this));
- ServerInstance->SNO->WriteToSnoMask('c',"Client connecting on port %d (class %s): %s!%s@%s [%s] [%s]",
+ ServerInstance->SNO->WriteToSnoMask('c',"Client connecting on port %d (class %s): %s!%s@%s (%s) [%s]",
this->GetServerPort(), this->MyClass->name.c_str(), this->nick.c_str(), this->ident.c_str(), this->host.c_str(), this->GetIPString(), this->fullname.c_str());
ServerInstance->Logs->Log("BANCACHE", DEBUG, "BanCache: Adding NEGATIVE hit for %s", this->GetIPString());
ServerInstance->BanCache->AddHit(this->GetIPString(), "", "");
@@ -1008,10 +1009,24 @@ irc::sockets::cidr_mask User::GetCIDRMask()
return irc::sockets::cidr_mask(client_sa, range);
}
+bool User::SetClientIP(irc::sockets::sockaddrs *sa)
+{
+ memcpy(&client_sa, sa, sizeof(irc::sockets::sockaddrs));
+
+ FOREACH_MOD(I_OnSetClientIP, OnSetClientIP(this));
+
+ return true;
+}
+
bool User::SetClientIP(const char* sip)
{
+ irc::sockets::sockaddrs sa;
+
this->cachedip = "";
- return irc::sockets::aptosa(sip, 0, client_sa);
+ if (!irc::sockets::aptosa(sip, 0, sa))
+ return false;
+
+ return SetClientIP(&sa);
}
static std::string wide_newline("\r\n");