mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 02:59:01 -04:00
Fix various issues with the cgiirc module.
- Respect the value of <cgiirc:opernotice> when sending snotices to operators. - Write to the log file if opernotice is disabled. - Log to the correct snomask in all cases. This was caused by an oversight when merging insp20 into master. - Replace the full user mask in log messages with a uuid/ip. The WEBIRC command is sent as the first command so there will not be a nickname or username at this point.
This commit is contained in:
parent
e73b78ca67
commit
592dd0e818
@ -24,11 +24,11 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "inspircd.h"
|
#include "inspircd.h"
|
||||||
#include "modules/dns.h"
|
|
||||||
#include "modules/ssl.h"
|
#include "modules/ssl.h"
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
// InspIRCd-specific.
|
||||||
RPL_WHOISGATEWAY = 350
|
RPL_WHOISGATEWAY = 350
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -118,7 +118,8 @@ class CommandWebIRC : public SplitCommand
|
|||||||
if (!irc::sockets::aptosa(parameters[3], 0, ipaddr))
|
if (!irc::sockets::aptosa(parameters[3], 0, ipaddr))
|
||||||
{
|
{
|
||||||
user->CommandFloodPenalty += 5000;
|
user->CommandFloodPenalty += 5000;
|
||||||
ServerInstance->SNO->WriteGlobalSno('a', "Connecting user %s tried to use WEBIRC but gave an invalid IP address.", user->GetFullRealHost().c_str());
|
WriteLog("Connecting user %s (%s) tried to use WEBIRC but gave an invalid IP address.",
|
||||||
|
user->uuid.c_str(), user->GetIPString().c_str());
|
||||||
return CMD_FAILURE;
|
return CMD_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,9 +134,8 @@ class CommandWebIRC : public SplitCommand
|
|||||||
realhost.set(user, user->GetRealHost());
|
realhost.set(user, user->GetRealHost());
|
||||||
realip.set(user, user->GetIPString());
|
realip.set(user, user->GetIPString());
|
||||||
|
|
||||||
if (notify)
|
WriteLog("Connecting user %s is using a WebIRC gateway; changing their IP from %s to %s.",
|
||||||
ServerInstance->SNO->WriteGlobalSno('w', "Connecting user %s is using a WebIRC gateway; changing their IP from %s to %s.",
|
user->uuid.c_str(), user->GetIPString().c_str(), parameters[3].c_str());
|
||||||
user->nick.c_str(), user->GetIPString().c_str(), parameters[3].c_str());
|
|
||||||
|
|
||||||
// Set the IP address sent via WEBIRC. We ignore the hostname and lookup
|
// Set the IP address sent via WEBIRC. We ignore the hostname and lookup
|
||||||
// instead do our own DNS lookups because of unreliable gateways.
|
// instead do our own DNS lookups because of unreliable gateways.
|
||||||
@ -144,9 +144,23 @@ class CommandWebIRC : public SplitCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
user->CommandFloodPenalty += 5000;
|
user->CommandFloodPenalty += 5000;
|
||||||
ServerInstance->SNO->WriteGlobalSno('w', "Connecting user %s tried to use WEBIRC but didn't match any configured WebIRC hosts.", user->GetFullRealHost().c_str());
|
WriteLog("Connecting user %s (%s) tried to use WEBIRC but didn't match any configured WebIRC hosts.",
|
||||||
|
user->uuid.c_str(), user->GetIPString().c_str());
|
||||||
return CMD_FAILURE;
|
return CMD_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WriteLog(const char* message, ...) CUSTOM_PRINTF(2, 3)
|
||||||
|
{
|
||||||
|
std::string buffer;
|
||||||
|
VAFORMAT(buffer, message, message);
|
||||||
|
|
||||||
|
// If we are sending a snotice then the message will already be
|
||||||
|
// written to the logfile.
|
||||||
|
if (notify)
|
||||||
|
ServerInstance->SNO->WriteGlobalSno('w', buffer);
|
||||||
|
else
|
||||||
|
ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, buffer);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class ModuleCgiIRC : public Module, public Whois::EventListener
|
class ModuleCgiIRC : public Module, public Whois::EventListener
|
||||||
@ -166,10 +180,8 @@ class ModuleCgiIRC : public Module, public Whois::EventListener
|
|||||||
cmd.realhost.set(user, user->GetRealHost());
|
cmd.realhost.set(user, user->GetRealHost());
|
||||||
cmd.realip.set(user, user->GetIPString());
|
cmd.realip.set(user, user->GetIPString());
|
||||||
|
|
||||||
if (cmd.notify)
|
cmd.WriteLog("Connecting user %s is using an ident gateway; changing their IP from %s to %s.",
|
||||||
ServerInstance->SNO->WriteGlobalSno('w', "Connecting user %s is using an ident gateway; changing their IP from %s to %s.",
|
user->uuid.c_str(), user->GetIPString().c_str(), newip.c_str());
|
||||||
user->nick.c_str(), user->GetIPString().c_str(), newip.c_str());
|
|
||||||
|
|
||||||
ChangeIP(user, newip);
|
ChangeIP(user, newip);
|
||||||
RecheckClass(user);
|
RecheckClass(user);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user