X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_passforward.cpp;h=37efec02b696510db102e29b1d5ee9e76dfe3082;hb=d4a1ea70451abb333e71f9cff09b624db59531a0;hp=b5696c8f4361da33488a67ada344f24cb66e3fa0;hpb=11916574f67962dce1d7a2fdf7ef6a3d2d1fa49f;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_passforward.cpp b/src/modules/m_passforward.cpp index b5696c8f4..37efec02b 100644 --- a/src/modules/m_passforward.cpp +++ b/src/modules/m_passforward.cpp @@ -18,6 +18,7 @@ #include "inspircd.h" +#include "modules/account.h" class ModulePassForward : public Module { @@ -44,22 +45,22 @@ class ModulePassForward : public Module char c = format[i]; if (c == '$') { - if (format.substr(i, 13) == "$nickrequired") + if (!format.compare(i, 13, "$nickrequired", 13)) { result.append(nickrequired); i += 12; } - else if (format.substr(i, 5) == "$nick") + else if (!format.compare(i, 5, "$nick", 5)) { result.append(user->nick); i += 4; } - else if (format.substr(i, 5) == "$user") + else if (!format.compare(i, 5, "$user", 5)) { result.append(user->ident); i += 4; } - else if (format.substr(i,5) == "$pass") + else if (!format.compare(i, 5, "$pass", 5)) { result.append(user->password); i += 4; @@ -78,6 +79,17 @@ class ModulePassForward : public Module if (!user || user->password.empty()) return; + // If the connect class requires a password, don't forward it + if (!user->MyClass->config->getString("password").empty()) + return; + + AccountExtItem* actext = GetAccountExtItem(); + if (actext && actext->get(user)) + { + // User is logged in already (probably via SASL) don't forward the password + return; + } + if (!nickrequired.empty()) { /* Check if nick exists and its server is ulined */ @@ -87,12 +99,12 @@ class ModulePassForward : public Module } std::string tmp; - FormatStr(tmp,forwardmsg, user); - user->WriteServ(tmp); + FormatStr(tmp, forwardmsg, user); + ServerInstance->Parser.ProcessBuffer(user, tmp); tmp.clear(); FormatStr(tmp,forwardcmd, user); - ServerInstance->Parser->ProcessBuffer(tmp,user); + ServerInstance->Parser.ProcessBuffer(user, tmp); } };