X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_ident.cpp;h=d5ca208365312495cff8af9e6e4864729034cafa;hb=0740e2b8e5d619bb3babbd143e99d8a77a9062ec;hp=04ad7ba4aec9398f36efcc89f278f4d92c6b8b46;hpb=64184418d44649edb190df7c77297146bd6fc366;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 04ad7ba4a..d5ca20836 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -323,7 +323,7 @@ class ModuleIdent : public Module ModuleIdent(InspIRCd *Me) : Module(Me) { Conf = new ConfigReader(ServerInstance); - OnRehash(NULL, ""); + OnRehash(NULL); Implementation eventlist[] = { I_OnRehash, I_OnUserRegister, I_OnCheckReady, I_OnCleanup, I_OnUserDisconnect }; ServerInstance->Modules->Attach(eventlist, this, 5); } @@ -338,7 +338,7 @@ class ModuleIdent : public Module return Version("$Id$", VF_VENDOR, API_VERSION); } - virtual void OnRehash(User *user, const std::string ¶m) + virtual void OnRehash(User *user) { delete Conf; Conf = new ConfigReader(ServerInstance); @@ -372,25 +372,22 @@ class ModuleIdent : public Module user->WriteServ("NOTICE Auth :*** Looking up your ident..."); // Get the IP that the user is connected to, and bind to that for the outgoing connection - #ifndef IPV6 - sockaddr_in laddr; - #else - sockaddr_in6 laddr; - #endif + irc::sockets::sockaddrs laddr; socklen_t laddrsz = sizeof(laddr); - if (getsockname(user->GetFd(), (sockaddr*) &laddr, &laddrsz) != 0) + if (getsockname(user->GetFd(), &laddr.sa, &laddrsz) != 0) { user->WriteServ("NOTICE Auth :*** Could not find your ident, using %s instead.", user->ident.c_str()); return 0; } - #ifndef IPV6 - const char *ip = inet_ntoa(laddr.sin_addr); - #else char ip[INET6_ADDRSTRLEN + 1]; - inet_ntop(laddr.sin6_family, &laddr.sin6_addr, ip, INET6_ADDRSTRLEN); - #endif +#ifdef IPV6 + if (laddr.sa.sa_family == AF_INET6) + inet_ntop(laddr.in6.sin6_family, &laddr.in6.sin6_addr, ip, INET6_ADDRSTRLEN); + else +#endif + inet_ntop(laddr.in4.sin_family, &laddr.in4.sin_addr, ip, INET6_ADDRSTRLEN); IdentRequestSocket *isock = NULL; try @@ -455,7 +452,7 @@ class ModuleIdent : public Module user->WriteServ("NOTICE Auth :*** Could not find your ident, using %s instead.", isock->GetResult()); /* Copy the ident string to the user */ - user->ident.assign(isock->GetResult(), 0, ServerInstance->Config->Limits.IdentMax + 1); + user->ChangeIdent(isock->GetResult()); /* The user isnt actually disconnecting, we call this to clean up the user */ OnUserDisconnect(user);