From 08f6f056667df63d1673bea959c73b75393113c6 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Fri, 27 Oct 2017 19:15:23 +0100 Subject: Change SetClientIP to take a C++ string instead of a char array. --- include/users.h | 4 ++-- src/modules/m_cgiirc.cpp | 2 +- src/modules/m_spanningtree/uid.cpp | 2 +- src/users.cpp | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/users.h b/include/users.h index 2fbbf31b6..03d94b28b 100644 --- a/include/users.h +++ b/include/users.h @@ -371,7 +371,7 @@ class CoreExport User : public Extensible /** Sets the client IP for this user * @return true if the conversion was successful */ - virtual bool SetClientIP(const char* sip, bool recheck_eline = true); + virtual bool SetClientIP(const std::string& address, bool recheck_eline = true); virtual void SetClientIP(const irc::sockets::sockaddrs& sa, bool recheck_eline = true); @@ -837,7 +837,7 @@ class CoreExport LocalUser : public User, public insp::intrusive_list_nodeUsers->RemoveCloneCounts(user); - user->SetClientIP(newip.c_str()); + user->SetClientIP(newip); ServerInstance->Users->AddClone(user); } diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp index 91c9f3ca8..2a17943e9 100644 --- a/src/modules/m_spanningtree/uid.cpp +++ b/src/modules/m_spanningtree/uid.cpp @@ -115,7 +115,7 @@ CmdResult CommandUID::HandleServer(TreeServer* remoteserver, std::vectorSetMode(mh, true); } - _new->SetClientIP(params[6].c_str()); + _new->SetClientIP(params[6]); ServerInstance->Users->AddClone(_new); remoteserver->UserCount++; diff --git a/src/users.cpp b/src/users.cpp index 5aede9312..9fef906d1 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -707,10 +707,10 @@ irc::sockets::cidr_mask User::GetCIDRMask() return irc::sockets::cidr_mask(client_sa, range); } -bool User::SetClientIP(const char* sip, bool recheck_eline) +bool User::SetClientIP(const std::string& address, bool recheck_eline) { this->InvalidateCache(); - return irc::sockets::aptosa(sip, 0, client_sa); + return irc::sockets::aptosa(address, 0, client_sa); } void User::SetClientIP(const irc::sockets::sockaddrs& sa, bool recheck_eline) @@ -720,10 +720,10 @@ void User::SetClientIP(const irc::sockets::sockaddrs& sa, bool recheck_eline) memcpy(&client_sa, &sa, sizeof(irc::sockets::sockaddrs)); } -bool LocalUser::SetClientIP(const char* sip, bool recheck_eline) +bool LocalUser::SetClientIP(const std::string& address, bool recheck_eline) { irc::sockets::sockaddrs sa; - if (!irc::sockets::aptosa(sip, 0, sa)) + if (!irc::sockets::aptosa(address, 0, sa)) // Invalid return false; -- cgit v1.2.3