X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_cgiirc.cpp;h=52c24e50ad89eb815173d9abbc46b72efbbf09d2;hb=3151d60c1ecc9462e4c335282ee6c31672f45111;hp=94fc99db143b3c59d967cd65a101b9fc3a064915;hpb=aa692dc1039b63deef7886e914ec499abe7facaf;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index 94fc99db1..52c24e50a 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -4,7 +4,7 @@ * Copyright (C) 2019 linuxdaemon * Copyright (C) 2014 md_5 * Copyright (C) 2014 Googolplexed - * Copyright (C) 2013, 2017-2018 Sadie Powell + * Copyright (C) 2013, 2017-2018, 2020 Sadie Powell * Copyright (C) 2013 Adam * Copyright (C) 2012-2013, 2015 Attila Molnar * Copyright (C) 2012, 2019 Robby @@ -307,12 +307,19 @@ class ModuleCgiIRC // The IP address will be received via the WEBIRC command. const std::string fingerprint = tag->getString("fingerprint"); const std::string password = tag->getString("password"); + const std::string passwordhash = tag->getString("hash", "plaintext", 1); // WebIRC blocks require a password. if (fingerprint.empty() && password.empty()) throw ModuleException("When using either the fingerprint or password field is required, at " + tag->getTagLocation()); - webirchosts.push_back(WebIRCHost(mask, fingerprint, password, tag->getString("hash"))); + if (!password.empty() && stdalgo::string::equalsci(passwordhash, "plaintext")) + { + ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, " tag at %s contains an plain text password, this is insecure!", + tag->getTagLocation().c_str()); + } + + webirchosts.push_back(WebIRCHost(mask, fingerprint, password, passwordhash)); } else { @@ -339,11 +346,22 @@ class ModuleCgiIRC // cannot match this connect class. const std::string* gateway = cmd.gateway.get(user); if (!gateway) + { + ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "The %s connect class is not suitable as it requires a connection via a WebIRC gateway", + myclass->GetName().c_str()); return MOD_RES_DENY; + } // If the gateway matches the constraint then // allow the check to continue. Otherwise, reject it. - return InspIRCd::Match(*gateway, webirc) ? MOD_RES_PASSTHRU : MOD_RES_DENY; + if (!InspIRCd::Match(*gateway, webirc)) + { + ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "The %s connect class is not suitable as the WebIRC gateway name (%s) does not match %s", + myclass->GetName().c_str(), gateway->c_str(), webirc.c_str()); + return MOD_RES_DENY; + } + + return MOD_RES_PASSTHRU; } ModResult OnUserRegister(LocalUser* user) CXX11_OVERRIDE @@ -459,7 +477,7 @@ class ModuleCgiIRC Version GetVersion() CXX11_OVERRIDE { - return Version("Enables forwarding the real IP address of a user from a gateway to the IRC server", VF_VENDOR); + return Version("Adds the ability for IRC gateways to forward the real IP address of users connecting through them.", VF_VENDOR); } };