From a5d110282a864fd2e91b51ce360a977cd0643657 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sun, 20 Aug 2017 17:47:38 +0100 Subject: Update wiki links to use HTTPS and point to the correct pages. When we release 3.0 these links will break as they will point to the pages for 3.0 rather than 2.0. --- src/modules/extra/README | 2 +- src/modules/extra/m_mysql.cpp | 2 -- src/modules/m_spanningtree/main.h | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/modules/extra/README b/src/modules/extra/README index 2478b57cf..b59494df9 100644 --- a/src/modules/extra/README +++ b/src/modules/extra/README @@ -2,7 +2,7 @@ This directory stores modules which require external libraries to compile. For example, m_filter_pcre requires the PCRE libraries. To compile any of these modules first ensure you have the required dependencies -(read the online documentation at http://wiki.inspircd.org/) and then symlink +(read the online documentation at https://wiki.inspircd.org/) and then symlink the .cpp file from this directory into the parent directory (src/modules/). Alternatively, use the command: ./configure --enable-extras=m_extra.cpp, which will diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index 01b1553b0..159a0b8b2 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -67,8 +67,6 @@ * if a module is ever put in a re-enterant state (stack corruption could occur, crashes, data * corruption, and worse, so DONT think about it until the day comes when InspIRCd is 100% * gauranteed threadsafe!) - * - * For a diagram of this system please see http://wiki.inspircd.org/Mysql2 */ class SQLConnection; diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index 17adc9287..3e0a83111 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -31,7 +31,7 @@ * If you completely change the protocol, completely change the number. * * IMPORTANT: If you make changes, document your changes here, without fail: - * http://wiki.inspircd.org/List_of_protocol_changes_between_versions + * https://wiki.inspircd.org/List_of_protocol_changes_between_versions * * Failure to document your protocol changes will result in a painfully * painful death by pain. You have been warned. -- cgit v1.2.3 From 7e4cc45149f41346f18e581cb301a1196b92bf68 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Wed, 18 Oct 2017 00:36:26 +0100 Subject: Fix sending a malformed 410 numeric when sent empty CAP commands. --- src/modules/m_cap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp index 6b4387fdd..ae9e824f4 100644 --- a/src/modules/m_cap.cpp +++ b/src/modules/m_cap.cpp @@ -120,7 +120,7 @@ class CommandCAP : public Command } else { - user->WriteNumeric(ERR_INVALIDCAPSUBCOMMAND, "%s %s :Invalid CAP subcommand", user->nick.c_str(), subcommand.c_str()); + user->WriteNumeric(ERR_INVALIDCAPSUBCOMMAND, "%s %s :Invalid CAP subcommand", user->nick.c_str(), subcommand.empty() ? "*" : subcommand.c_str()); return CMD_FAILURE; } -- cgit v1.2.3 From 7b7953aaf2aa0895604e57fe0136ba9a5831349c Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 26 Oct 2017 20:23:24 -0400 Subject: ConfigReader: fix compilers optimizing NULL check in ConfigTag::readString() See: 66f82ccf926aac39273bfc652c85c08080cc9a46 Fixes inspircd/inspircd-extras#110 --- src/modules.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/modules.cpp b/src/modules.cpp index b2d2f23c6..79a33e617 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -641,7 +641,8 @@ static ConfigTag* SlowGetTag(const std::string &tag, int index) std::string ConfigReader::ReadValue(const std::string &tag, const std::string &name, const std::string &default_value, int index, bool allow_linefeeds) { std::string result = default_value; - if (!SlowGetTag(tag, index)->readString(name, result, allow_linefeeds)) + ConfigTag* conftag = SlowGetTag(tag, index); + if (!conftag || !conftag->readString(name, result, allow_linefeeds)) { this->error = CONF_VALUE_NOT_FOUND; } @@ -656,7 +657,8 @@ std::string ConfigReader::ReadValue(const std::string &tag, const std::string &n bool ConfigReader::ReadFlag(const std::string &tag, const std::string &name, const std::string &default_value, int index) { bool def = (default_value == "yes"); - return SlowGetTag(tag, index)->getBool(name, def); + ConfigTag* conftag = SlowGetTag(tag, index); + return conftag ? conftag->getBool(name, def) : def; } bool ConfigReader::ReadFlag(const std::string &tag, const std::string &name, int index) @@ -668,7 +670,8 @@ bool ConfigReader::ReadFlag(const std::string &tag, const std::string &name, int int ConfigReader::ReadInteger(const std::string &tag, const std::string &name, const std::string &default_value, int index, bool need_positive) { int v = atoi(default_value.c_str()); - int result = SlowGetTag(tag, index)->getInt(name, v); + ConfigTag* conftag = SlowGetTag(tag, index); + int result = conftag ? conftag->getInt(name, v) : v; if ((need_positive) && (result < 0)) { -- cgit v1.2.3 From 5f3360a217f28d1ba80fdf5db3167c87dd70449c Mon Sep 17 00:00:00 2001 From: Jordyn/The Linux Geek Date: Sat, 4 Nov 2017 18:13:41 -0500 Subject: Fix CMD_RESTART with relative paths as argv[0]. --- src/commands/cmd_restart.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/commands/cmd_restart.cpp b/src/commands/cmd_restart.cpp index bdbcfed35..48f902d1e 100644 --- a/src/commands/cmd_restart.cpp +++ b/src/commands/cmd_restart.cpp @@ -47,7 +47,7 @@ CmdResult CommandRestart::Handle (const std::vector& parameters, Us ServerInstance->SendError("Server restarting."); #ifndef _WIN32 - /* XXX: This hack sets FD_CLOEXEC on all possible file descriptors, so they're closed if the execv() below succeeds. + /* XXX: This hack sets FD_CLOEXEC on all possible file descriptors, so they're closed if the execvp() below succeeds. * Certainly, this is not a nice way to do things and it's slow when the fd limit is high. * * A better solution would be to set the close-on-exec flag for each fd we create (or create them with O_CLOEXEC), @@ -61,7 +61,7 @@ CmdResult CommandRestart::Handle (const std::vector& parameters, Us } #endif - execv(ServerInstance->Config->cmdline.argv[0], ServerInstance->Config->cmdline.argv); + execvp(ServerInstance->Config->cmdline.argv[0], ServerInstance->Config->cmdline.argv); ServerInstance->SNO->WriteGlobalSno('a', "Failed RESTART - could not execute '%s' (%s)", ServerInstance->Config->cmdline.argv[0], strerror(errno)); } -- cgit v1.2.3 From 52de083afcd1608f030551f532bdcdb1f45f1513 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sun, 22 Oct 2017 23:51:15 +0100 Subject: Use InvalidateCache in the sockaddrs overload of OnSetClientIP. This was done to the string variant in d3b82b2f7f. --- src/users.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/users.cpp b/src/users.cpp index 4dbb73a1f..9e06485e5 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -1008,8 +1008,7 @@ bool User::SetClientIP(const char* sip, bool recheck_eline) void User::SetClientIP(const irc::sockets::sockaddrs& sa, bool recheck_eline) { - cachedip.clear(); - cached_hostip.clear(); + this->InvalidateCache(); memcpy(&client_sa, &sa, sizeof(irc::sockets::sockaddrs)); } -- cgit v1.2.3 From 9d4b4344b49de3c474302e8316576b759249c409 Mon Sep 17 00:00:00 2001 From: genius3000 Date: Thu, 27 Jul 2017 03:05:44 -0600 Subject: Inform the client when a SASL message cannot be sent When SASL is properly configured with a 'target' server, we are able to inform the client when the message fails to send. Currently if a target is configured and it is offline, no response is sent. This can cause some clients to time out while waiting for a response. If a target isn't configured, behaviour will not change with this commit. The default of '*' will still send to all servers. Updated example config with 'target' variable. --- docs/conf/modules.conf.example | 7 +++++++ src/modules/m_sasl.cpp | 4 ++++ 2 files changed, 11 insertions(+) (limited to 'src') diff --git a/docs/conf/modules.conf.example b/docs/conf/modules.conf.example index b39ee5d2b..8e193904d 100644 --- a/docs/conf/modules.conf.example +++ b/docs/conf/modules.conf.example @@ -1591,6 +1591,13 @@ # Layer via AUTHENTICATE. Note: You also need to have m_cap.so loaded # for SASL to work. # +# Define the following to your services server name to improve security +# by ensuring the SASL messages are only sent to the services server +# and not to all connected servers. This prevents a rogue server from +# capturing SASL messages. Having this defined can also improve client +# connections when your services are down, as the client will be told +# that SASL failed rather than just timing out on registration. +# #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Secure list module: Prevent /LIST in the first minute of connection, diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index 5afab9502..8ac43fba7 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -35,6 +35,10 @@ static void SendSASL(const parameterlist& params) { if (!ServerInstance->PI->SendEncapsulatedData(params)) { + User* u = ServerInstance->FindUUID(params[2]); + if (u) + u->WriteNumeric(904, "%s :SASL authentication failed", u->nick.c_str()); + SASLFallback(NULL, params); } } -- cgit v1.2.3 From 3eefb336c670d5b2f39696913717e0c47b75232c Mon Sep 17 00:00:00 2001 From: genius3000 Date: Mon, 21 Nov 2016 22:00:27 -0700 Subject: Improve (synchronize) the notices in m_timedbans * Send to remote servers upon setting * Send to halfop if available upon expiry --- src/modules/m_timedbans.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index 61095d6eb..bbbc518bd 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -117,11 +117,13 @@ class CommandTban : public Command T.chan = channel; TimedBanList.push_back(T); + const std::string addban = user->nick + " added a timed ban on " + mask + " lasting for " + ConvToStr(duration) + " seconds."; // If halfop is loaded, send notice to halfops and above, otherwise send to ops and above ModeHandler* mh = ServerInstance->Modes->FindMode('h', MODETYPE_CHANNEL); char pfxchar = (mh && mh->name == "halfop") ? mh->GetPrefix() : '@'; - channel->WriteAllExcept(ServerInstance->FakeClient, true, pfxchar, tmp, "NOTICE %s :%s added a timed ban on %s lasting for %ld seconds.", channel->name.c_str(), user->nick.c_str(), mask.c_str(), duration); + channel->WriteAllExcept(ServerInstance->FakeClient, true, pfxchar, tmp, "NOTICE %s :%s", channel->name.c_str(), addban.c_str()); + ServerInstance->PI->SendChannelNotice(channel, pfxchar, addban); return CMD_SUCCESS; } @@ -207,9 +209,13 @@ class ModuleTimedBans : public Module setban.push_back(mask); CUList empty; - std::string expiry = "*** Timed ban on " + chan + " expired."; - cr->WriteAllExcept(ServerInstance->FakeClient, true, '@', empty, "NOTICE %s :%s", cr->name.c_str(), expiry.c_str()); - ServerInstance->PI->SendChannelNotice(cr, '@', expiry); + const std::string expiry = "*** Timed ban on " + chan + " expired."; + // If halfop is loaded, send notice to halfops and above, otherwise send to ops and above + ModeHandler* mh = ServerInstance->Modes->FindMode('h', MODETYPE_CHANNEL); + char pfxchar = (mh && mh->name == "halfop") ? mh->GetPrefix() : '@'; + + cr->WriteAllExcept(ServerInstance->FakeClient, true, pfxchar, empty, "NOTICE %s :%s", cr->name.c_str(), expiry.c_str()); + ServerInstance->PI->SendChannelNotice(cr, pfxchar, expiry); ServerInstance->SendGlobalMode(setban, ServerInstance->FakeClient); } -- cgit v1.2.3 From e83506b7abde9fdd628b9065fb3b6c01d370808f Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Thu, 9 Nov 2017 11:04:52 +0000 Subject: Revert the code changes to m_sasl made in commit 9d4b4344b4. This is causing problems such as duplicate 904 messages. --- src/modules/m_sasl.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src') diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index 7108e0c07..0ef93ec5a 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -35,10 +35,6 @@ static void SendSASL(const parameterlist& params) { if (!ServerInstance->PI->SendEncapsulatedData(params)) { - User* u = ServerInstance->FindUUID(params[2]); - if (u) - u->WriteNumeric(904, "%s :SASL authentication failed", u->nick.c_str()); - SASLFallback(NULL, params); } } -- cgit v1.2.3 From f57dbb6dbe0a49b0f0aa80c327904d4273a76b55 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Tue, 7 Nov 2017 18:18:35 +0000 Subject: Work around removing shuns on nicks when the nick is online. --- src/modules/m_shun.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp index 8bf4d30e7..3147d5476 100644 --- a/src/modules/m_shun.cpp +++ b/src/modules/m_shun.cpp @@ -114,13 +114,17 @@ class CommandShun : public Command if (parameters.size() == 1) { - if (ServerInstance->XLines->DelLine(target.c_str(), "SHUN", user)) + if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "SHUN", user)) + { + ServerInstance->SNO->WriteToSnoMask('x', "%s removed SHUN on %s", user->nick.c_str(), parameters[0].c_str()); + } + else if (ServerInstance->XLines->DelLine(target.c_str(), "SHUN", user)) { ServerInstance->SNO->WriteToSnoMask('x',"%s removed SHUN on %s",user->nick.c_str(),target.c_str()); } else { - user->WriteServ("NOTICE %s :*** Shun %s not found in list, try /stats H.",user->nick.c_str(),target.c_str()); + user->WriteServ("NOTICE %s :*** Shun %s not found in list, try /stats H.", user->nick.c_str(), parameters[0].c_str()); return CMD_FAILURE; } } -- cgit v1.2.3 From 53d822a7d19aded988ee74eb05437e587cb1ac92 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sun, 12 Nov 2017 15:55:01 +0000 Subject: Release v2.0.25 --- src/version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/version.sh b/src/version.sh index 2025a4810..4172331bf 100755 --- a/src/version.sh +++ b/src/version.sh @@ -1,2 +1,2 @@ #!/bin/sh -echo "InspIRCd-2.0.24" +echo "InspIRCd-2.0.25" -- cgit v1.2.3