From 5f4095e595fe36c6f83df96b7c59cb459b966ed3 Mon Sep 17 00:00:00 2001 From: danieldg Date: Tue, 1 Sep 2009 15:07:11 +0000 Subject: Change IP address storage in User to use more IPv4/IPv6 common code git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11575 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_cgiirc.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/modules/m_cgiirc.cpp') diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index 580060464..048f8bde0 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -117,7 +117,7 @@ class CGIResolver : public Resolver them->host.assign(result,0, 64); them->dhost.assign(result, 0, 64); if (querytype) - them->SetSockAddr(them->GetProtocolFamily(), result.c_str(), them->GetPort()); + them->SetSockAddr(result.c_str(), them->GetPort()); them->ident.assign("~cgiirc", 0, 8); them->InvalidateCache(); them->CheckLines(true); @@ -318,7 +318,7 @@ public: if(user->GetExt("cgiirc_webirc_ip", webirc_ip)) { ServerInstance->Users->RemoveCloneCounts(user); - user->SetSockAddr(user->GetProtocolFamily(), webirc_ip->c_str(), user->GetPort()); + user->SetSockAddr(webirc_ip->c_str(), user->GetPort()); delete webirc_ip; user->InvalidateCache(); user->Shrink("cgiirc_webirc_ip"); @@ -342,10 +342,10 @@ public: bool valid = false; ServerInstance->Users->RemoveCloneCounts(user); #ifdef IPV6 - if (user->GetProtocolFamily() == AF_INET6) - valid = (inet_pton(AF_INET6, user->password.c_str(), &((sockaddr_in6*)user->ip)->sin6_addr) > 0); + if (user->ip.sa.sa_family == AF_INET6) + valid = (inet_pton(AF_INET6, user->password.c_str(), &user->ip.in6.sin6_addr) > 0); else - valid = (inet_aton(user->password.c_str(), &((sockaddr_in*)user->ip)->sin_addr)); + valid = (inet_aton(user->password.c_str(), &user->ip.in4.sin_addr)); #else if (inet_aton(user->password.c_str(), &((sockaddr_in*)user->ip)->sin_addr)) valid = true; @@ -407,7 +407,7 @@ public: user->Extend("cgiirc_realhost", new std::string(user->host)); user->Extend("cgiirc_realip", new std::string(user->GetIPString())); ServerInstance->Users->RemoveCloneCounts(user); - user->SetSockAddr(user->GetProtocolFamily(), newip, user->GetPort()); + user->SetSockAddr(newip, user->GetPort()); ServerInstance->Users->AddLocalClone(user); ServerInstance->Users->AddGlobalClone(user); user->CheckClass(); -- cgit v1.2.3