summaryrefslogtreecommitdiff
path: root/src/users.cpp
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2012-11-21 02:20:23 +0100
committerattilamolnar <attilamolnar@hush.com>2012-11-29 20:26:00 +0100
commit20ea635c9fcd0d559ff6fc2863ab581591bc4ef8 (patch)
tree555cde8b1e6662f0003c48ef131c6f9e447bc128 /src/users.cpp
parentb4034e2231afcfcb5cf29156288c666d90831fed (diff)
Reorder local user initialization steps
OnSetUserIP hook now runs after the user has a connect class and the g/k/z lines were checked (ip only, no host at that point) Fixes #360 reported by @JDowny Allows #336
Diffstat (limited to 'src/users.cpp')
-rw-r--r--src/users.cpp22
1 files changed, 4 insertions, 18 deletions
diff --git a/src/users.cpp b/src/users.cpp
index 0c6204adb..92276d07c 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -225,25 +225,9 @@ LocalUser::LocalUser(int myfd, irc::sockets::sockaddrs* client, irc::sockets::so
ident = "unknown";
lastping = 0;
eh.SetFd(myfd);
+ memcpy(&client_sa, client, sizeof(irc::sockets::sockaddrs));
memcpy(&server_sa, servaddr, sizeof(irc::sockets::sockaddrs));
-
- /*
- * Initialize host and dhost here to the user's IP.
- * It is important to do this before calling SetClientIP()
- * as that passes execution to modules that expect these
- * fields to be valid.
- *
- * We cannot call GetIPString() now as that will access
- * client_sa, and that's only initialized after the first
- * SetClientIP() call.
- */
-
- int port;
- irc::sockets::satoap(*client, host, port);
- if (host[0] == ':')
- host.insert(0, 1, '0');
- dhost = host;
- SetClientIP(*client);
+ dhost = host = GetIPString();
}
User::~User()
@@ -1005,12 +989,14 @@ irc::sockets::cidr_mask User::GetCIDRMask()
bool User::SetClientIP(const char* sip)
{
cachedip.clear();
+ cached_hostip.clear();
return irc::sockets::aptosa(sip, 0, client_sa);
}
void User::SetClientIP(const irc::sockets::sockaddrs& sa)
{
cachedip.clear();
+ cached_hostip.clear();
memcpy(&client_sa, &sa, sizeof(irc::sockets::sockaddrs));
}