summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2012-10-03 19:53:46 +0200
committerattilamolnar <attilamolnar@hush.com>2012-10-03 20:36:20 +0200
commit4f9cc281d5f12ff1fdebc733b641c5e25cb460f9 (patch)
tree6112d10629e365f226bef6c606dacb0c065b5533
parent13b7084eae707af1066a72fff9d5b2b91534dd20 (diff)
Fix (d)host starting with ':' for some IPv6 clients
-rw-r--r--src/users.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/users.cpp b/src/users.cpp
index 29c670a66..eeb80ccc9 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -230,12 +230,18 @@ LocalUser::LocalUser(int myfd, irc::sockets::sockaddrs* client, irc::sockets::so
/*
* Initialize host and dhost here to the user's IP.
* It is important to do this before calling SetClientIP()
- * as that can pass execution to modules that expect these
+ * 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);
}