summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/inspircd.conf.example6
-rw-r--r--include/configreader.h4
-rw-r--r--src/configreader.cpp1
-rw-r--r--src/inspircd.cpp45
-rw-r--r--src/snomasks.cpp2
-rw-r--r--src/users.cpp4
6 files changed, 42 insertions, 20 deletions
diff --git a/docs/inspircd.conf.example b/docs/inspircd.conf.example
index 322a6e820..a820d4a40 100644
--- a/docs/inspircd.conf.example
+++ b/docs/inspircd.conf.example
@@ -598,7 +598,11 @@
# invitebypassmodes: This allows /invite to bypass other channel modes.
# (Such as +k, +j, +l, etc)
- invitebypassmodes="yes">
+ invitebypassmodes="yes"
+
+ # nosnoticestack: This prevents snotices from 'stacking' and giving you
+ # the message saying '(last message repeated X times)'. Defaults to no.
+ nosnoticestack="no">
#-#-#-#-#-#-#-#-#-#-#-# PERFORMANCE CONFIGURATION #-#-#-#-#-#-#-#-#-#-#
diff --git a/include/configreader.h b/include/configreader.h
index 8748e57f9..d828283c3 100644
--- a/include/configreader.h
+++ b/include/configreader.h
@@ -581,6 +581,10 @@ class CoreExport ServerConfig
*/
bool InvBypassModes;
+ /** If this value is true, snotices will not stack when repeats are sent
+ */
+ bool NoSnoticeStack;
+
};
/** The background thread for config reading, so that reading from executable includes
diff --git a/src/configreader.cpp b/src/configreader.cpp
index a1a244501..eecf01d8d 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -505,6 +505,7 @@ void ServerConfig::Fill()
Limits.MaxGecos = ConfValue("limits")->getInt("maxgecos", 128);
Limits.MaxAway = ConfValue("limits")->getInt("maxaway", 200);
InvBypassModes = options->getBool("invitebypassmodes", true);
+ NoSnoticeStack = options->getBool("nosnoticestack", false);
range(SoftLimit, 10, ServerInstance->SE->GetMaxFds(), ServerInstance->SE->GetMaxFds(), "<performance:softlimit>");
range(MaxConn, 0, SOMAXCONN, SOMAXCONN, "<performance:somaxconn>");
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 86223ae95..1a856898f 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -595,23 +595,36 @@ InspIRCd::InspIRCd(int argc, char** argv) :
}
}
- if (isatty(0) && isatty(1) && isatty(2))
+ /* Explicitly shut down stdio's stdin/stdout/stderr.
+ *
+ * The previous logic here was to only do this if stdio was connected to a controlling
+ * terminal. However, we must do this always to avoid information leaks and other
+ * problems related to stdio.
+ *
+ * The only exception is if we are in debug mode.
+ *
+ * -- nenolod
+ */
+ if ((!do_nofork) && (!do_testsuite) && (!Config->cmdline.forcedebug))
{
- /* We didn't start from a TTY, we must have started from a background process -
- * e.g. we are restarting, or being launched by cron. Dont kill parent, and dont
- * close stdin/stdout
- */
- if ((!do_nofork) && (!do_testsuite))
- {
- fclose(stdin);
- fclose(stderr);
- if (!Config->cmdline.forcedebug)
- fclose(stdout);
- }
- else
- {
- Logs->Log("STARTUP", DEFAULT,"Keeping pseudo-tty open as we are running in the foreground.");
- }
+ int fd;
+
+ fclose(stdin);
+ fclose(stderr);
+ fclose(stdout);
+
+ fd = open("/dev/null", O_RDWR);
+ if (dup2(fd, 0) < 0)
+ Logs->Log("STARTUP", DEFAULT, "Failed to dup /dev/null to stdin.");
+ if (dup2(fd, 1) < 0)
+ Logs->Log("STARTUP", DEFAULT, "Failed to dup /dev/null to stdout.");
+ if (dup2(fd, 2) < 0)
+ Logs->Log("STARTUP", DEFAULT, "Failed to dup /dev/null to stderr.");
+ close(fd);
+ }
+ else
+ {
+ Logs->Log("STARTUP", DEFAULT,"Keeping pseudo-tty open as we are running in the foreground.");
}
#else
WindowsIPC = new IPC;
diff --git a/src/snomasks.cpp b/src/snomasks.cpp
index f8e1fc158..e0849147b 100644
--- a/src/snomasks.cpp
+++ b/src/snomasks.cpp
@@ -83,7 +83,7 @@ SnomaskManager::SnomaskManager()
void Snomask::SendMessage(const std::string &message, char mysnomask)
{
- if (message != LastMessage || mysnomask != LastLetter)
+ if (ServerInstance->Config->NoSnoticeStack || message != LastMessage || mysnomask != LastLetter)
{
this->Flush();
LastMessage = message;
diff --git a/src/users.cpp b/src/users.cpp
index 6277f95f9..f8f9d0025 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -829,8 +829,8 @@ void LocalUser::FullConnect()
FOREACH_MOD(I_OnPostConnect,OnPostConnect(this));
- ServerInstance->SNO->WriteToSnoMask('c',"Client connecting on port %d: %s!%s@%s [%s] [%s]",
- this->GetServerPort(), this->nick.c_str(), this->ident.c_str(), this->host.c_str(), this->GetIPString(), this->fullname.c_str());
+ ServerInstance->SNO->WriteToSnoMask('c',"Client connecting on port %d (class %s): %s!%s@%s [%s] [%s]",
+ this->GetServerPort(), this->MyClass->name.c_str(), this->nick.c_str(), this->ident.c_str(), this->host.c_str(), this->GetIPString(), this->fullname.c_str());
ServerInstance->Logs->Log("BANCACHE", DEBUG, "BanCache: Adding NEGATIVE hit for %s", this->GetIPString());
ServerInstance->BanCache->AddHit(this->GetIPString(), "", "");
// reset the flood penalty (which could have been raised due to things like auto +x)