]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_dnsbl.cpp
Silence some GCC warnings.
[user/henk/code/inspircd.git] / src / modules / m_dnsbl.cpp
index a645e2cd16b47d91bb54460cb24db2dce2d2aa5a..9a9ad85a296351d492e259b6055165efbbfd1ef6 100644 (file)
@@ -147,9 +147,9 @@ class DNSBLResolver : public DNS::Request
                                                        "*", them->GetIPString());
                                        if (ServerInstance->XLines->AddLine(kl,NULL))
                                        {
-                                               std::string timestr = InspIRCd::TimeString(kl->expiry);
-                                               ServerInstance->SNO->WriteGlobalSno('x', "K-line added due to DNSBL match on *@%s to expire on %s: %s",
-                                                       them->GetIPString().c_str(), timestr.c_str(), reason.c_str());
+                                               ServerInstance->SNO->WriteGlobalSno('x', "K-line added due to DNSBL match on *@%s to expire in %s (on %s): %s",
+                                                       them->GetIPString().c_str(), InspIRCd::DurationString(kl->duration).c_str(),
+                                                       InspIRCd::TimeString(kl->expiry).c_str(), reason.c_str());
                                                ServerInstance->XLines->ApplyLines();
                                        }
                                        else
@@ -165,9 +165,9 @@ class DNSBLResolver : public DNS::Request
                                                        "*", them->GetIPString());
                                        if (ServerInstance->XLines->AddLine(gl,NULL))
                                        {
-                                               std::string timestr = InspIRCd::TimeString(gl->expiry);
-                                               ServerInstance->SNO->WriteGlobalSno('x', "G-line added due to DNSBL match on *@%s to expire on %s: %s",
-                                                       them->GetIPString().c_str(), timestr.c_str(), reason.c_str());
+                                               ServerInstance->SNO->WriteGlobalSno('x', "G-line added due to DNSBL match on *@%s to expire in %s (on %s): %s",
+                                                       them->GetIPString().c_str(), InspIRCd::DurationString(gl->duration).c_str(),
+                                                       InspIRCd::TimeString(gl->expiry).c_str(), reason.c_str());
                                                ServerInstance->XLines->ApplyLines();
                                        }
                                        else
@@ -183,9 +183,9 @@ class DNSBLResolver : public DNS::Request
                                                        them->GetIPString());
                                        if (ServerInstance->XLines->AddLine(zl,NULL))
                                        {
-                                               std::string timestr = InspIRCd::TimeString(zl->expiry);
-                                               ServerInstance->SNO->WriteGlobalSno('x', "Z-line added due to DNSBL match on %s to expire on %s: %s",
-                                                       them->GetIPString().c_str(), timestr.c_str(), reason.c_str());
+                                               ServerInstance->SNO->WriteGlobalSno('x', "Z-line added due to DNSBL match on %s to expire in %s (on %s): %s",
+                                                       them->GetIPString().c_str(), InspIRCd::DurationString(zl->duration).c_str(),
+                                                       InspIRCd::TimeString(zl->expiry).c_str(), reason.c_str());
                                                ServerInstance->XLines->ApplyLines();
                                        }
                                        else
@@ -384,6 +384,7 @@ class ModuleDNSBL : public Module, public Stats::EventListener
                                reversedip.push_back(*it);
                                reversedip.push_back('.');
                        }
+                       reversedip.erase(reversedip.length() - 1, 1);
                }
                else
                        return;
@@ -420,10 +421,14 @@ class ModuleDNSBL : public Module, public Stats::EventListener
                std::string dnsbl;
                if (!myclass->config->readString("dnsbl", dnsbl))
                        return MOD_RES_PASSTHRU;
+
                std::string* match = nameExt.get(user);
-               std::string myname = match ? *match : "";
-               if (dnsbl == myname)
+               if (!match)
+                       return MOD_RES_PASSTHRU;
+
+               if (InspIRCd::Match(*match, dnsbl))
                        return MOD_RES_PASSTHRU;
+
                return MOD_RES_DENY;
        }