diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/extra/m_ssl_gnutls.cpp | 4 | ||||
-rw-r--r-- | src/modules/extra/m_ssl_openssl.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_cgiirc.cpp | 26 | ||||
-rw-r--r-- | src/modules/m_check.cpp | 37 | ||||
-rw-r--r-- | src/modules/m_ident.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree.cpp | 12 | ||||
-rw-r--r-- | src/modules/m_userip.cpp | 2 |
7 files changed, 41 insertions, 46 deletions
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 2ab89533c..ce9099d53 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -203,7 +203,7 @@ class ModuleSSLGnuTLS : public Module { userrec* user = (userrec*)item; - if(user->GetExt("ssl", dummy) && isin(user->port, listenports)) + if(user->GetExt("ssl", dummy) && isin(user->GetPort(), listenports)) { // User is using SSL, they're a local user, and they're using one of *our* SSL ports. // Potentially there could be multiple SSL modules loaded at once on different ports. @@ -461,7 +461,7 @@ class ModuleSSLGnuTLS : public Module virtual void OnWhois(userrec* source, userrec* dest) { // Bugfix, only send this numeric for *our* SSL users - if(dest->GetExt("ssl", dummy) || (IS_LOCAL(dest) && isin(dest->port, listenports))) + if(dest->GetExt("ssl", dummy) || (IS_LOCAL(dest) && isin(dest->GetPort(), listenports))) { WriteServ(source->fd, "320 %s %s :is using a secure connection", source->nick, dest->nick); } diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 031df5c71..c9b9d42aa 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -227,7 +227,7 @@ class ModuleSSLOpenSSL : public Module { userrec* user = (userrec*)item; - if(user->GetExt("ssl", dummy) && IS_LOCAL(user) && isin(user->port, listenports)) + if(user->GetExt("ssl", dummy) && IS_LOCAL(user) && isin(user->GetPort(), listenports)) { // User is using SSL, they're a local user, and they're using one of *our* SSL ports. // Potentially there could be multiple SSL modules loaded at once on different ports. @@ -533,7 +533,7 @@ class ModuleSSLOpenSSL : public Module virtual void OnWhois(userrec* source, userrec* dest) { // Bugfix, only send this numeric for *our* SSL users - if(dest->GetExt("ssl", dummy) || (IS_LOCAL(dest) && isin(dest->port, listenports))) + if(dest->GetExt("ssl", dummy) || (IS_LOCAL(dest) && isin(dest->GetPort(), listenports))) { WriteServ(source->fd, "320 %s %s :is using a secure connection", source->nick, dest->nick); } diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index a063a0849..dea13d114 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -198,16 +198,16 @@ public: virtual void OnUserRegister(userrec* user) { - log(DEBUG, "m_cgiirc.so: User %s registering, %s %s", user->nick,user->host,insp_ntoa(user->ip4)); + log(DEBUG, "m_cgiirc.so: User %s registering, %s %s", user->nick,user->host,user->GetIPString()); for(CGIHostlist::iterator iter = Hosts.begin(); iter != Hosts.end(); iter++) { - log(DEBUG, "m_cgiirc.so: Matching %s against (%s or %s)", iter->hostmask.c_str(), user->host, insp_ntoa(user->ip4)); + log(DEBUG, "m_cgiirc.so: Matching %s against (%s or %s)", iter->hostmask.c_str(), user->host, user->GetIPString()); - if(Srv->MatchText(user->host, iter->hostmask) || Srv->MatchText(insp_ntoa(user->ip4), iter->hostmask)) + if(Srv->MatchText(user->host, iter->hostmask) || Srv->MatchText(user->GetIPString(), iter->hostmask)) { // Deal with it... - log(DEBUG, "m_cgiirc.so: Handling CGI:IRC user: %s (%s) matched %s", user->GetFullRealHost(), insp_ntoa(user->ip4), iter->hostmask.c_str()); + log(DEBUG, "m_cgiirc.so: Handling CGI:IRC user: %s (%s) matched %s", user->GetFullRealHost(), user->GetIPString(), iter->hostmask.c_str()); if(iter->type == PASS) { @@ -240,11 +240,15 @@ public: if(IsValidHost(user->password)) { user->Extend("cgiirc_realhost", new std::string(user->host)); - user->Extend("cgiirc_realip", new std::string(insp_ntoa(user->ip4))); + user->Extend("cgiirc_realip", new std::string(user->GetIPString())); strlcpy(user->host, user->password, 64); strlcpy(user->dhost, user->password, 64); - if(insp_aton(user->password, &user->ip4)) +#ifdef IPV6 + if (insp_aton(user->password, (insp_inaddr*)&((sockaddr_in*)&user->ip)->sin6_addr)) +#else + if (insp_aton(user->password, (insp_inaddr*)&((sockaddr_in*)&user->ip)->sin_addr)) +#endif { /* We were given a IP in the password, we don't do DNS so they get this is as their host as well. */ log(DEBUG, "m_cgiirc.so: Got an IP in the user's password"); @@ -305,9 +309,13 @@ public: snprintf(newip, 16, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); user->Extend("cgiirc_realhost", new std::string(user->host)); - user->Extend("cgiirc_realip", new std::string(insp_ntoa(user->ip4))); - insp_aton(newip, &user->ip4); - + user->Extend("cgiirc_realip", new std::string(user->GetIPString())); +#ifdef IPV6 + insp_aton(newip, (insp_inaddr*)&((sockaddr_in*)&user->ip)->sin6_addr); +#else + insp_aton(newip, (insp_inaddr*)&((sockaddr_in*)&user->ip)->sin_addr); +#endif + try { log(DEBUG,"MAKE RESOLVER: %s %d %s",newip, user->fd, "IDENT"); diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index 70c17ba1b..a00d32b9e 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -86,7 +86,7 @@ class cmd_check : public command_t if (IS_LOCAL(targuser)) { /* port information is only held for a local user! */ - Srv->SendTo(NULL, user, checkstr + " onport " + ConvToStr(targuser->port)); + Srv->SendTo(NULL, user, checkstr + " onport " + ConvToStr(targuser->GetPort())); } chliststr = chlist(targuser, targuser); @@ -158,38 +158,21 @@ class cmd_check : public command_t else { /* /check on an IP address, or something that doesn't exist */ - insp_sockaddr addr; long x = 0; -#ifdef IPV6 - if (insp_aton(parameters[0], &addr.sin6_addr) == 0) -#else - if (insp_aton(parameters[0], &addr.sin_addr) == 0) -#endif + + /* hostname or other */ + for (user_hash::const_iterator a = clientlist.begin(); a != clientlist.end(); a++) { - /* hostname or other */ - for (user_hash::const_iterator a = clientlist.begin(); a != clientlist.end(); a++) + if (match(a->second->host, parameters[0]) || match(a->second->dhost, parameters[0])) { - if (match(a->second->host, parameters[0]) || match(a->second->dhost, parameters[0])) - { - /* host or vhost matches mask */ - Srv->SendTo(NULL, user, checkstr + " match " + ConvToStr(++x) + " " + a->second->GetFullRealHost()); - } + /* host or vhost matches mask */ + Srv->SendTo(NULL, user, checkstr + " match " + ConvToStr(++x) + " " + a->second->GetFullRealHost()); } - } - else - { /* IP address */ - for (user_hash::const_iterator a = clientlist.begin(); a != clientlist.end(); a++) + else if (match(a->second->GetIPString(), parameters[0])) { -#ifdef IPV6 - if (!memcmp(addr.sin6_addr.s6_addr, a->second->ip4.s6_addr, sizeof(in6_addr))) -#else - if (addr.sin_addr.s_addr == a->second->ip4.s_addr) -#endif - { - /* same IP. */ - Srv->SendTo(NULL, user, checkstr + " match " + ConvToStr(++x) + " " + a->second->GetFullRealHost()); - } + /* same IP. */ + Srv->SendTo(NULL, user, checkstr + " match " + ConvToStr(++x) + " " + a->second->GetFullRealHost()); } } diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 76518d5c1..fe697e4b7 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -43,7 +43,7 @@ class RFC1413 : public InspSocket userrec* u; // user record that the lookup is associated with int ufd; - RFC1413(userrec* user, int maxtime, Server* S) : InspSocket((char*)insp_ntoa(user->ip4), 113, false, maxtime), Srv(S), u(user), ufd(user->fd) + RFC1413(userrec* user, int maxtime, Server* S) : InspSocket(user->GetIPString(), 113, false, maxtime), Srv(S), u(user), ufd(user->fd) { Srv->Log(DEBUG,"Ident: associated."); } diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index f64f24013..071da8ac3 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -1563,9 +1563,13 @@ class TreeSocket : public InspSocket { clientlist[tempnick]->modes[(*v)-65] = 1; } - insp_aton(params[6].c_str(),&clientlist[tempnick]->ip4); - WriteOpers("*** Client connecting at %s: %s!%s@%s [%s]",clientlist[tempnick]->server,clientlist[tempnick]->nick,clientlist[tempnick]->ident,clientlist[tempnick]->host, insp_ntoa(clientlist[tempnick]->ip4)); + if (params[6].find_first_of(":") != std::string::npos) + clientlist[tempnick]->SetSockAddr(AF_INET6, params[6].c_str(), 0); + else + clientlist[tempnick]->SetSockAddr(AF_INET, params[6].c_str(), 0); + + WriteOpers("*** Client connecting at %s: %s!%s@%s [%s]",clientlist[tempnick]->server,clientlist[tempnick]->nick,clientlist[tempnick]->ident,clientlist[tempnick]->host, clientlist[tempnick]->GetIPString()); params[7] = ":" + params[7]; DoOneToAllButSender(source,"NICK",params,source); @@ -1770,7 +1774,7 @@ class TreeSocket : public InspSocket { if (u->second->registered == REG_ALL) { - snprintf(data,MAXBUF,":%s NICK %lu %s %s %s %s +%s %s :%s",u->second->server,(unsigned long)u->second->age,u->second->nick,u->second->host,u->second->dhost,u->second->ident,u->second->FormatModes(),insp_ntoa(u->second->ip4),u->second->fullname); + snprintf(data,MAXBUF,":%s NICK %lu %s %s %s %s +%s %s :%s",u->second->server,(unsigned long)u->second->age,u->second->nick,u->second->host,u->second->dhost,u->second->ident,u->second->FormatModes(),u->second->GetIPString(),u->second->fullname); this->WriteLine(data); if (*u->second->oper) { @@ -4167,7 +4171,7 @@ class ModuleSpanningTree : public Module params.push_back(user->dhost); params.push_back(user->ident); params.push_back("+"+std::string(user->FormatModes())); - params.push_back((char*)insp_ntoa(user->ip4)); + params.push_back(user->GetIPString()); params.push_back(":"+std::string(user->fullname)); DoOneToMany(Srv->GetServerName(),"NICK",params); diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp index d7126684d..df633af80 100644 --- a/src/modules/m_userip.cpp +++ b/src/modules/m_userip.cpp @@ -45,7 +45,7 @@ class cmd_userip : public command_t userrec *u = Find(parameters[i]); if (u) { - snprintf(junk,MAXBUF,"%s%s=+%s@%s ",u->nick,*u->oper ? "*" : "",u->ident,(char*)insp_ntoa(u->ip4)); + snprintf(junk,MAXBUF,"%s%s=+%s@%s ",u->nick,*u->oper ? "*" : "",u->ident,u->GetIPString()); strlcat(Return,junk,MAXBUF); } } |