]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Return server port in GetPort rather than the arbitrary client port
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Tue, 1 Sep 2009 15:07:19 +0000 (15:07 +0000)
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Tue, 1 Sep 2009 15:07:19 +0000 (15:07 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11576 e03df62e-2008-0410-955e-edbf42e46eb7

src/usermanager.cpp

index 14f0229724467180aa6ba873af3c0793a4d315bc..5dd9cb054041eedf4901e5bca3fd195e3fc92588 100644 (file)
@@ -37,6 +37,12 @@ void UserManager::AddUser(InspIRCd* Instance, int socket, int port, bool iscache
 
        New->SetFd(socket);
        memcpy(&New->ip, ip, sizeof(*ip));
+       // change the port number of their stored sockaddr to be the server port rather than the client port
+       if (New->ip.sa.sa_family == AF_INET6)
+               New->ip.in6.sin6_port = port;
+       else
+               New->ip.in4.sin_port = port;
+
 
        /* Give each of the modules an attempt to hook the user for I/O */
        FOREACH_MOD_I(Instance, I_OnHookUserIO, OnHookUserIO(New, targetip));