From e2f1a61fc67500c4c101ff8a3f7847914298375e Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 18 Feb 2016 08:45:22 -0500 Subject: Fix dccallow to work with files with spaces in their names --- src/modules/m_dccallow.cpp | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index 043486283..05fff8937 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -340,29 +340,43 @@ class ModuleDCCAllow : public Module return MOD_RES_PASSTHRU; } - // tokenize - std::stringstream ss(text); - std::string buf; - std::vector tokens; - - while (ss >> buf) - tokens.push_back(buf); - - if (tokens.size() < 2) + std::string buf = text.substr(5); + size_t s = buf.find(' '); + if (s == std::string::npos) return MOD_RES_PASSTHRU; - irc::string type = tokens[1].c_str(); + irc::string type = assign(buf.substr(0, s)); ConfigTag* conftag = ServerInstance->Config->ConfValue("dccallow"); bool blockchat = conftag->getBool("blockchat"); if (type == "SEND") { - if (tokens.size() < 3) + size_t first; + + buf = buf.substr(s + 1); + + if (!buf.empty() && buf[0] == '"') + { + s = buf.find('"', 1); + + if (s == std::string::npos || s <= 1) + return MOD_RES_PASSTHRU; + + --s; + first = 1; + } + else + { + s = buf.find(' '); + first = 0; + } + + if (s == std::string::npos) return MOD_RES_PASSTHRU; std::string defaultaction = conftag->getString("action"); - std::string filename = tokens[2]; + std::string filename = buf.substr(first, s); bool found = false; for (unsigned int i = 0; i < bfl.size(); i++) -- cgit v1.2.3 From f80798f2c15d27d3f98f5323e69c5b9ff2aaa48b Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 25 Feb 2016 08:37:46 -0500 Subject: Don't show snotices for kills from ulined clients --- docs/conf/inspircd.conf.example | 3 +++ include/configreader.h | 4 ++++ src/commands/cmd_kill.cpp | 14 +++++++++----- src/configreader.cpp | 1 + 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/docs/conf/inspircd.conf.example b/docs/conf/inspircd.conf.example index 9fd0adfd3..7099cefe2 100644 --- a/docs/conf/inspircd.conf.example +++ b/docs/conf/inspircd.conf.example @@ -695,6 +695,9 @@ # hidekills: If defined, replaces who set a /kill with a custom string. hidekills="" + # hideulinekills: Hide kills from clients of ulined servers from server notices. + hideulinekills="yes" + # hidesplits: If enabled, non-opers will not be able to see which # servers split in a netsplit, they will only be able to see that one # occurred (If their client has netsplit detection). diff --git a/include/configreader.h b/include/configreader.h index b01a979a7..4a697d05c 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -438,6 +438,10 @@ class CoreExport ServerConfig */ std::string HideKillsServer; + /** Set to hide kills from clients of ulined servers in snotices. + */ + bool HideULineKills; + /** The full pathname and filename of the PID * file as defined in the configuration. */ diff --git a/src/commands/cmd_kill.cpp b/src/commands/cmd_kill.cpp index 99ac39d42..7bdf32c74 100644 --- a/src/commands/cmd_kill.cpp +++ b/src/commands/cmd_kill.cpp @@ -111,7 +111,8 @@ CmdResult CommandKill::Handle (const std::vector& parameters, User if (!IS_LOCAL(u)) { // remote kill - ServerInstance->SNO->WriteToSnoMask('K', "Remote kill by %s: %s (%s)", user->nick.c_str(), u->GetFullRealHost().c_str(), parameters[1].c_str()); + if (!ServerInstance->Config->HideULineKills || !ServerInstance->ULine(user->server)) + ServerInstance->SNO->WriteToSnoMask('K', "Remote kill by %s: %s (%s)", user->nick.c_str(), u->GetFullRealHost().c_str(), parameters[1].c_str()); FOREACH_MOD(I_OnRemoteKill, OnRemoteKill(user, u, killreason, killreason)); } else @@ -121,10 +122,13 @@ CmdResult CommandKill::Handle (const std::vector& parameters, User * XXX - this isn't entirely correct, servers A - B - C, oper on A, client on C. Oper kills client, A and B will get remote kill * snotices, C will get a local kill snotice. this isn't accurate, and needs fixing at some stage. -- w00t */ - if (IS_LOCAL(user)) - ServerInstance->SNO->WriteGlobalSno('k',"Local Kill by %s: %s (%s)", user->nick.c_str(), u->GetFullRealHost().c_str(), parameters[1].c_str()); - else - ServerInstance->SNO->WriteToSnoMask('k',"Local Kill by %s: %s (%s)", user->nick.c_str(), u->GetFullRealHost().c_str(), parameters[1].c_str()); + if (!ServerInstance->Config->HideULineKills || !ServerInstance->ULine(user->server)) + { + if (IS_LOCAL(user)) + ServerInstance->SNO->WriteGlobalSno('k',"Local Kill by %s: %s (%s)", user->nick.c_str(), u->GetFullRealHost().c_str(), parameters[1].c_str()); + else + ServerInstance->SNO->WriteToSnoMask('k',"Local Kill by %s: %s (%s)", user->nick.c_str(), u->GetFullRealHost().c_str(), parameters[1].c_str()); + } ServerInstance->Logs->Log("KILL",DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick.c_str(), ServerInstance->Config->ServerName.c_str(), user->dhost.c_str(), user->nick.c_str(), parameters[1].c_str()); /* Bug #419, make sure this message can only occur once even in the case of multiple KILL messages crossing the network, and change to show * hidekillsserver as source if possible diff --git a/src/configreader.cpp b/src/configreader.cpp index bcee938d5..5b298ddd8 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -531,6 +531,7 @@ void ServerConfig::Fill() HideBans = security->getBool("hidebans"); HideWhoisServer = security->getString("hidewhois"); HideKillsServer = security->getString("hidekills"); + HideULineKills = security->getBool("hideulinekills"); RestrictBannedUsers = security->getBool("restrictbannedusers", true); GenericOper = security->getBool("genericoper"); NoUserDns = ConfValue("performance")->getBool("nouserdns"); -- cgit v1.2.3 From dbcbf9647d0abb421f8a84b41e674f403c91ce8f Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Fri, 26 Feb 2016 09:52:35 +0000 Subject: Quote paths in the makefile. This prevents problems caused by paths with spaces in them. --- make/template/main.mk | 56 +++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/make/template/main.mk b/make/template/main.mk index fa2375ac1..c044bdaaa 100644 --- a/make/template/main.mk +++ b/make/template/main.mk @@ -124,8 +124,8 @@ CXXFLAGS += -Iinclude @ELSE @GNU_ONLY MAKEFLAGS += --silent @BSD_ONLY MAKE += -s - RUNCC = perl $(SOURCEPATH)/make/run-cc.pl $(CC) - RUNLD = perl $(SOURCEPATH)/make/run-cc.pl $(CC) + RUNCC = perl "$(SOURCEPATH)/make/run-cc.pl" $(CC) + RUNLD = perl "$(SOURCEPATH)/make/run-cc.pl" $(CC) VERBOSE = @ENDIF @@ -160,7 +160,7 @@ all: $(FOOTER) target: $(HEADER) $(MAKEENV) perl make/calcdep.pl - cd $(BUILDPATH); $(MAKEENV) $(MAKE) -f real.mk $(TARGET) + cd "$(BUILDPATH)"; $(MAKEENV) $(MAKE) -f real.mk $(TARGET) debug: @${MAKE} D=1 all @@ -220,22 +220,22 @@ install: target echo ""; \ exit 1; \ fi - @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(BASE) - @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(DATPATH) - @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(LOGPATH) - @-$(INSTALL) -d -m $(INSTMODE_DIR) $(BINPATH) - @-$(INSTALL) -d -m $(INSTMODE_DIR) $(CONPATH)/examples/aliases - @-$(INSTALL) -d -m $(INSTMODE_DIR) $(CONPATH)/examples/modules - @-$(INSTALL) -d -m $(INSTMODE_DIR) $(MODPATH) - [ $(BUILDPATH)/bin/ -ef $(BINPATH) ] || $(INSTALL) -m $(INSTMODE_BIN) $(BUILDPATH)/bin/inspircd $(BINPATH) + @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) "$(BASE)" + @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) "$(DATPATH)" + @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) "$(LOGPATH)" + @-$(INSTALL) -d -m $(INSTMODE_DIR) "$(BINPATH)" + @-$(INSTALL) -d -m $(INSTMODE_DIR) "$(CONPATH)/examples/aliases" + @-$(INSTALL) -d -m $(INSTMODE_DIR) "$(CONPATH)/examples/modules" + @-$(INSTALL) -d -m $(INSTMODE_DIR) "$(MODPATH)" + [ "$(BUILDPATH)/bin/" -ef "$(BINPATH)" ] || $(INSTALL) -m $(INSTMODE_BIN) "$(BUILDPATH)/bin/inspircd" "$(BINPATH)" @IFNDEF PURE_STATIC - [ $(BUILDPATH)/modules/ -ef $(MODPATH) ] || $(INSTALL) -m $(INSTMODE_LIB) $(BUILDPATH)/modules/*.so $(MODPATH) + [ "$(BUILDPATH)/modules/" -ef "$(MODPATH)" ] || $(INSTALL) -m $(INSTMODE_LIB) "$(BUILDPATH)/modules/"*.so "$(MODPATH)" @ENDIF - -$(INSTALL) -m $(INSTMODE_BIN) @STARTSCRIPT@ $(BASE) 2>/dev/null - -$(INSTALL) -m $(INSTMODE_LIB) tools/gdbargs $(BASE)/.gdbargs 2>/dev/null - -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/*.example $(CONPATH)/examples - -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/aliases/*.example $(CONPATH)/examples/aliases - -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/modules/*.example $(CONPATH)/examples/modules + -$(INSTALL) -m $(INSTMODE_BIN) @STARTSCRIPT@ "$(BASE)" 2>/dev/null + -$(INSTALL) -m $(INSTMODE_LIB) tools/gdbargs "$(BASE)/.gdbargs" 2>/dev/null + -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/*.example "$(CONPATH)/examples" + -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/aliases/*.example "$(CONPATH)/examples/aliases" + -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/modules/*.example "$(CONPATH)/examples/modules" @echo "" @echo "*************************************" @echo "* INSTALL COMPLETE! *" @@ -258,18 +258,18 @@ GNUmakefile BSDmakefile: make/template/main.mk configure $(RCS_FILES) clean: @echo Cleaning... - -rm -f $(BUILDPATH)/bin/inspircd $(BUILDPATH)/include $(BUILDPATH)/real.mk - -rm -rf $(BUILDPATH)/obj $(BUILDPATH)/modules - @-rmdir $(BUILDPATH)/bin 2>/dev/null - @-rmdir $(BUILDPATH) 2>/dev/null + -rm -f "$(BUILDPATH)/bin/inspircd" "$(BUILDPATH)/include" "$(BUILDPATH)/real.mk" + -rm -rf "$(BUILDPATH)/obj" "$(BUILDPATH)/modules" + @-rmdir "$(BUILDPATH)/bin" 2>/dev/null + @-rmdir "$(BUILDPATH)" 2>/dev/null @echo Completed. deinstall: - -rm -f $(BINPATH)/inspircd - -rm -rf $(CONPATH)/examples - -rm -f $(MODPATH)/*.so - -rm -f $(BASE)/.gdbargs - -rm -f $(BASE)/org.inspircd.plist + -rm -f "$(BINPATH)/inspircd" + -rm -rf "$(CONPATH)/examples" + -rm -f "$(MODPATH)/*.so" + -rm -f "$(BASE)/.gdbargs" + -rm -f "$(BASE)/org.inspircd.plist" squeakyclean: distclean @@ -283,8 +283,8 @@ configureclean: -rm -f org.inspircd.plist distclean: clean configureclean - -rm -rf $(SOURCEPATH)/run - find $(SOURCEPATH)/src/modules -type l | xargs rm -f + -rm -rf "$(SOURCEPATH)/run" + find "$(SOURCEPATH)/src/modules" -type l | xargs rm -f help: @echo 'InspIRCd Makefile' -- cgit v1.2.3 From b972020b391485d92bd46ce662421fa036ca4ca6 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Fri, 26 Feb 2016 20:44:10 +0000 Subject: Fix GCC 6 warning about null checking this. As with 402a1bb010522a35600325c1a3084e092b40ca22 this is known to be undefined behaviour but changing it is too risky for the 2.0 branch. --- src/configparser.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/configparser.cpp b/src/configparser.cpp index 94192a71b..409ebdd39 100644 --- a/src/configparser.cpp +++ b/src/configparser.cpp @@ -388,19 +388,20 @@ bool ParseStack::ParseExec(const std::string& name, int flags, const std::string return ok; } -bool ConfigTag::readString(const std::string& key, std::string& value, bool allow_lf) -{ #ifdef __clang__ # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wunknown-pragmas" # pragma clang diagnostic ignored "-Wundefined-bool-conversion" +#elif defined __GNUC__ +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wpragmas" +# pragma GCC diagnostic ignored "-Wnonnull-compare" #endif +bool ConfigTag::readString(const std::string& key, std::string& value, bool allow_lf) +{ // TODO: this is undefined behaviour but changing the API is too risky for 2.0. if (!this) return false; -#ifdef __clang__ -# pragma clang diagnostic pop -#endif for(std::vector::iterator j = items.begin(); j != items.end(); ++j) { if(j->first != key) @@ -418,6 +419,11 @@ bool ConfigTag::readString(const std::string& key, std::string& value, bool allo } return false; } +#ifdef __clang__ +# pragma clang diagnostic pop +#elif defined __GNUC__ +# pragma GCC diagnostic pop +#endif std::string ConfigTag::getString(const std::string& key, const std::string& def) { -- cgit v1.2.3 From b111d5098fe1ee306d2718c82c72f969db9d183d Mon Sep 17 00:00:00 2001 From: Guillaume Delacour Date: Sun, 28 Feb 2016 10:47:34 +0100 Subject: Minor spelling errors in m_spanningtree.so --- src/modules/m_spanningtree/fjoin.cpp | 2 +- src/modules/m_spanningtree/postcommand.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp index 47b394522..4ec6e1dbb 100644 --- a/src/modules/m_spanningtree/fjoin.cpp +++ b/src/modules/m_spanningtree/fjoin.cpp @@ -201,7 +201,7 @@ CmdResult CommandFJoin::Handle(const std::vector& params, User *src } else { - ServerInstance->Logs->Log("m_spanningtree",SPARSE, "Ignored nonexistant user %s in fjoin to %s (probably quit?)", usr, channel.c_str()); + ServerInstance->Logs->Log("m_spanningtree",SPARSE, "Ignored nonexistent user %s in fjoin to %s (probably quit?)", usr, channel.c_str()); continue; } } diff --git a/src/modules/m_spanningtree/postcommand.cpp b/src/modules/m_spanningtree/postcommand.cpp index 471bbfcb9..3f5d427e1 100644 --- a/src/modules/m_spanningtree/postcommand.cpp +++ b/src/modules/m_spanningtree/postcommand.cpp @@ -73,7 +73,7 @@ void SpanningTreeUtilities::RouteCommand(TreeServer* origin, const std::string & TreeServer* sdest = FindServer(routing.serverdest); if (!sdest) { - ServerInstance->Logs->Log("m_spanningtree",DEFAULT,"Trying to route ENCAP to nonexistant server %s", + ServerInstance->Logs->Log("m_spanningtree",DEFAULT,"Trying to route ENCAP to nonexistent server %s", routing.serverdest.c_str()); return; } -- cgit v1.2.3 From 4f8697d0ce29097583b417b676c73d31349b056f Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Mon, 29 Feb 2016 14:40:02 +0100 Subject: Remove embarrassing negative comments about some clients from the code --- src/commands/cmd_list.cpp | 1 - src/modules/m_securelist.cpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/commands/cmd_list.cpp b/src/commands/cmd_list.cpp index 2c420d1dd..8a99ce3e0 100644 --- a/src/commands/cmd_list.cpp +++ b/src/commands/cmd_list.cpp @@ -49,7 +49,6 @@ CmdResult CommandList::Handle (const std::vector& parameters, User user->WriteNumeric(321, "%s Channel :Users Name",user->nick.c_str()); - /* Work around mIRC suckyness. YOU SUCK, KHALED! */ if (parameters.size() == 1) { if (parameters[0][0] == '<') diff --git a/src/modules/m_securelist.cpp b/src/modules/m_securelist.cpp index 6013d1fd7..5d11d27f7 100644 --- a/src/modules/m_securelist.cpp +++ b/src/modules/m_securelist.cpp @@ -76,7 +76,7 @@ class ModuleSecureList : public Module /* Not exempt, BOOK EM DANNO! */ user->WriteServ("NOTICE %s :*** You cannot list within the first %lu seconds of connecting. Please try again later.",user->nick.c_str(), (unsigned long) WaitTime); - /* Some crap clients (read: mIRC, various java chat applets) muck up if they don't + /* Some clients (e.g. mIRC, various java chat applets) muck up if they don't * receive these numerics whenever they send LIST, so give them an empty LIST to mull over. */ user->WriteNumeric(321, "%s Channel :Users Name",user->nick.c_str()); -- cgit v1.2.3 From 8aced446613e3d68a0c1666edcc0e8817ae2f812 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sat, 19 Mar 2016 20:00:37 +0000 Subject: Fix 'cron' and 'restart' in the helper not forwarding arguments. --- make/template/inspircd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/make/template/inspircd b/make/template/inspircd index 7cd83a8e1..b43ad60c9 100644 --- a/make/template/inspircd +++ b/make/template/inspircd @@ -135,7 +135,7 @@ sub cmd_rehash() sub cmd_cron() { - if (getstatus() == 0) { goto &cmd_start(); } + if (getstatus() == 0) { goto &cmd_start(@_); } exit(); } @@ -149,7 +149,7 @@ sub cmd_restart(@) { cmd_stop(); unlink($pidfile) if (-e $pidfile); - goto &cmd_start; + goto &cmd_start(@_); } sub hid_cheese_sandwich() -- cgit v1.2.3 From ba0649304a73f7a5109af9a97a0ecbe3f4bbed36 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Fri, 25 Mar 2016 11:38:54 +0000 Subject: Partially revert "Quote paths in the makefile". There is no need to quote BASE and {BIN,CON,DAT,MOD,LOG}PATH because they are alreaady quoted. {BUILD,SOURCE}PATH however are unquoted so their usages still need to be quoted. This reverts commit dbcbf9647d0abb421f8a84b41e674f403c91ce8f. --- make/template/main.mk | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/make/template/main.mk b/make/template/main.mk index c044bdaaa..2a220f5a8 100644 --- a/make/template/main.mk +++ b/make/template/main.mk @@ -220,22 +220,22 @@ install: target echo ""; \ exit 1; \ fi - @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) "$(BASE)" - @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) "$(DATPATH)" - @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) "$(LOGPATH)" - @-$(INSTALL) -d -m $(INSTMODE_DIR) "$(BINPATH)" - @-$(INSTALL) -d -m $(INSTMODE_DIR) "$(CONPATH)/examples/aliases" - @-$(INSTALL) -d -m $(INSTMODE_DIR) "$(CONPATH)/examples/modules" - @-$(INSTALL) -d -m $(INSTMODE_DIR) "$(MODPATH)" - [ "$(BUILDPATH)/bin/" -ef "$(BINPATH)" ] || $(INSTALL) -m $(INSTMODE_BIN) "$(BUILDPATH)/bin/inspircd" "$(BINPATH)" + @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(BASE) + @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(DATPATH) + @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(LOGPATH) + @-$(INSTALL) -d -m $(INSTMODE_DIR) $(BINPATH) + @-$(INSTALL) -d -m $(INSTMODE_DIR) $(CONPATH)/examples/aliases + @-$(INSTALL) -d -m $(INSTMODE_DIR) $(CONPATH)/examples/modules + @-$(INSTALL) -d -m $(INSTMODE_DIR) $(MODPATH)" + [ "$(BUILDPATH)/bin/" -ef $(BINPATH) ] || $(INSTALL) -m $(INSTMODE_BIN) "$(BUILDPATH)/bin/inspircd" $(BINPATH) @IFNDEF PURE_STATIC - [ "$(BUILDPATH)/modules/" -ef "$(MODPATH)" ] || $(INSTALL) -m $(INSTMODE_LIB) "$(BUILDPATH)/modules/"*.so "$(MODPATH)" + [ "$(BUILDPATH)/modules/" -ef $(MODPATH) ] || $(INSTALL) -m $(INSTMODE_LIB) "$(BUILDPATH)/modules/"*.so $(MODPATH) @ENDIF - -$(INSTALL) -m $(INSTMODE_BIN) @STARTSCRIPT@ "$(BASE)" 2>/dev/null - -$(INSTALL) -m $(INSTMODE_LIB) tools/gdbargs "$(BASE)/.gdbargs" 2>/dev/null - -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/*.example "$(CONPATH)/examples" - -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/aliases/*.example "$(CONPATH)/examples/aliases" - -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/modules/*.example "$(CONPATH)/examples/modules" + -$(INSTALL) -m $(INSTMODE_BIN) @STARTSCRIPT@ $(BASE) 2>/dev/null + -$(INSTALL) -m $(INSTMODE_LIB) tools/gdbargs $(BASE)/.gdbargs 2>/dev/null + -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/*.example $(CONPATH)/examples + -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/aliases/*.example $(CONPATH)/examples/aliases + -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/modules/*.example $(CONPATH)/examples/modules @echo "" @echo "*************************************" @echo "* INSTALL COMPLETE! *" @@ -265,11 +265,11 @@ clean: @echo Completed. deinstall: - -rm -f "$(BINPATH)/inspircd" - -rm -rf "$(CONPATH)/examples" - -rm -f "$(MODPATH)/*.so" - -rm -f "$(BASE)/.gdbargs" - -rm -f "$(BASE)/org.inspircd.plist" + -rm -f $(BINPATH)/inspircd + -rm -rf $(CONPATH)/examples + -rm -f $(MODPATH)/*.so + -rm -f $(BASE)/.gdbargs + -rm -f $(BASE)/org.inspircd.plist squeakyclean: distclean -- cgit v1.2.3 From eced5062205cb9c2ae4af5ca0972340059ae3363 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Fri, 25 Mar 2016 11:44:51 +0000 Subject: Delete modules cautiously when doing a deinstall. --- make/template/main.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/make/template/main.mk b/make/template/main.mk index 2a220f5a8..08787a1bf 100644 --- a/make/template/main.mk +++ b/make/template/main.mk @@ -267,7 +267,8 @@ clean: deinstall: -rm -f $(BINPATH)/inspircd -rm -rf $(CONPATH)/examples - -rm -f $(MODPATH)/*.so + -rm -f $(MODPATH)/cmd_*.so + -rm -f $(MODPATH)/m_*.so -rm -f $(BASE)/.gdbargs -rm -f $(BASE)/org.inspircd.plist -- cgit v1.2.3 From 955b0d74dc65714163a8e1743ec10e91d4583c4c Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sun, 10 Apr 2016 04:33:20 +0100 Subject: Fix extraneous quotes in makefile template. --- make/template/main.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make/template/main.mk b/make/template/main.mk index 08787a1bf..c46d60502 100644 --- a/make/template/main.mk +++ b/make/template/main.mk @@ -226,7 +226,7 @@ install: target @-$(INSTALL) -d -m $(INSTMODE_DIR) $(BINPATH) @-$(INSTALL) -d -m $(INSTMODE_DIR) $(CONPATH)/examples/aliases @-$(INSTALL) -d -m $(INSTMODE_DIR) $(CONPATH)/examples/modules - @-$(INSTALL) -d -m $(INSTMODE_DIR) $(MODPATH)" + @-$(INSTALL) -d -m $(INSTMODE_DIR) $(MODPATH) [ "$(BUILDPATH)/bin/" -ef $(BINPATH) ] || $(INSTALL) -m $(INSTMODE_BIN) "$(BUILDPATH)/bin/inspircd" $(BINPATH) @IFNDEF PURE_STATIC [ "$(BUILDPATH)/modules/" -ef $(MODPATH) ] || $(INSTALL) -m $(INSTMODE_LIB) "$(BUILDPATH)/modules/"*.so $(MODPATH) -- cgit v1.2.3 From b198b696c8c713949ede6a900646482112e5daf4 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Fri, 10 Oct 2014 15:24:05 +0100 Subject: Add configuration for building with Travis-CI. --- .travis.yml | 12 ++++++++++++ tools/travis-ci.sh | 19 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 .travis.yml create mode 100755 tools/travis-ci.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..631802526 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,12 @@ +compiler: + - "clang" + - "gcc" +language: "cpp" +notifications: + email: false +os: + - "linux" + - "osx" +script: + - "sh ./tools/travis-ci.sh" +sudo: required diff --git a/tools/travis-ci.sh b/tools/travis-ci.sh new file mode 100755 index 000000000..6fb6f22ca --- /dev/null +++ b/tools/travis-ci.sh @@ -0,0 +1,19 @@ +#!/bin/bash +set -v +if [ "$TRAVIS_OS_NAME" = "linux" ] +then + sudo apt-get update --assume-yes + sudo apt-get install --assume-yes libgeoip-dev libgnutls-dev libldap2-dev libmysqlclient-dev libpcre3-dev libpq-dev libsqlite3-dev libssl-dev libtre-dev +elif [ "$TRAVIS_OS_NAME" = "osx" ] +then + brew update + brew install geoip gnutls mysql-connector-c openssl pcre postgresql sqlite3 tre +else + >&2 echo "'$TRAVIS_OS_NAME' is an unknown Travis CI environment!" + exit 1 +fi +set -e +./configure --enable-extras=m_geoip.cpp,m_ldapauth.cpp,m_ldapoper.cpp,m_mysql.cpp,m_pgsql.cpp,m_regex_pcre.cpp,m_regex_posix.cpp,m_regex_tre.cpp,m_sqlite3.cpp,m_ssl_gnutls.cpp,m_ssl_openssl.cpp +./configure --with-cc=$CXX +make -j4 install +./run/bin/inspircd --version -- cgit v1.2.3 From 9b172942217bc6c25a9c0be82a1704ffe4f642bc Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Tue, 3 May 2016 18:47:15 +0100 Subject: Fix a minor warning in m_hideoper on some systems. --- src/modules/m_hideoper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/m_hideoper.cpp b/src/modules/m_hideoper.cpp index 9d50bd2e5..32999d9f0 100644 --- a/src/modules/m_hideoper.cpp +++ b/src/modules/m_hideoper.cpp @@ -94,7 +94,7 @@ class ModuleHideOper : public Module if (opercount) { active = true; - user->WriteNumeric(252, "%s %lu :operator(s) online", user->nick.c_str(), opercount); + user->WriteNumeric(252, "%s %lu :operator(s) online", user->nick.c_str(), static_cast(opercount)); active = false; } return MOD_RES_DENY; -- cgit v1.2.3 From e956bb75eadc6981dd0a4ce5ce1b6b2d5c7aa00c Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sun, 29 May 2016 03:41:00 +0100 Subject: Fix 005 not showing some modes with the same rank as others. --- src/mode.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/mode.cpp b/src/mode.cpp index 89ff37fa1..0f5d45783 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -837,11 +837,19 @@ std::string ModeParser::GiveModeList(ModeMasks m) return type1 + "," + type2 + "," + type3 + "," + type4; } +struct PrefixModeSorter +{ + bool operator()(ModeHandler* lhs, ModeHandler* rhs) + { + return lhs->GetPrefixRank() < rhs->GetPrefixRank(); + } +}; + std::string ModeParser::BuildPrefixes(bool lettersAndModes) { std::string mletters; std::string mprefixes; - std::map > prefixes; + std::vector prefixes; for (unsigned char mode = 'A'; mode <= 'z'; mode++) { @@ -849,15 +857,15 @@ std::string ModeParser::BuildPrefixes(bool lettersAndModes) if ((modehandlers[pos]) && (modehandlers[pos]->GetPrefix())) { - prefixes[modehandlers[pos]->GetPrefixRank()] = std::make_pair( - modehandlers[pos]->GetPrefix(), modehandlers[pos]->GetModeChar()); + prefixes.push_back(modehandlers[pos]); } } - for(std::map >::reverse_iterator n = prefixes.rbegin(); n != prefixes.rend(); n++) + std::sort(prefixes.begin(), prefixes.end(), PrefixModeSorter()); + for (std::vector::const_reverse_iterator n = prefixes.rbegin(); n != prefixes.rend(); ++n) { - mletters = mletters + n->second.first; - mprefixes = mprefixes + n->second.second; + mletters += (*n)->GetPrefix(); + mprefixes += (*n)->GetModeChar(); } return lettersAndModes ? "(" + mprefixes + ")" + mletters : mletters; -- cgit v1.2.3 From 66f82ccf926aac39273bfc652c85c08080cc9a46 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Thu, 9 Jun 2016 15:12:35 +0200 Subject: Fix for GCC 6 rightfully optimizing out the NULL check of 'this' in ConfigTag::readString() Checking is only necessary in ModuleSSLInfo::OnPostConnect() as oper types are not encountered in the other cases but check anyway to be sure --- src/commands/cmd_oper.cpp | 2 +- src/modules/m_sslinfo.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/commands/cmd_oper.cpp b/src/commands/cmd_oper.cpp index 1a5e7e178..95f6b98df 100644 --- a/src/commands/cmd_oper.cpp +++ b/src/commands/cmd_oper.cpp @@ -69,7 +69,7 @@ CmdResult CommandOper::HandleLocal(const std::vector& parameters, L snprintf(TheIP, MAXBUF,"%s@%s",user->ident.c_str(),user->GetIPString()); OperIndex::iterator i = ServerInstance->Config->oper_blocks.find(parameters[0]); - if (i != ServerInstance->Config->oper_blocks.end()) + if ((i != ServerInstance->Config->oper_blocks.end()) && (i->second->oper_block)) { OperInfo* ifo = i->second; ConfigTag* tag = ifo->oper_block; diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp index 2bfe0e1c4..083ac0f04 100644 --- a/src/modules/m_sslinfo.cpp +++ b/src/modules/m_sslinfo.cpp @@ -180,6 +180,9 @@ class ModuleSSLInfo : public Module if (i != ServerInstance->Config->oper_blocks.end()) { OperInfo* ifo = i->second; + if (!ifo->oper_block) + return MOD_RES_PASSTHRU; + ssl_cert* cert = cmd.CertExt.get(user); if (ifo->oper_block->getBool("sslonly") && !cert) @@ -220,6 +223,9 @@ class ModuleSSLInfo : public Module for(OperIndex::iterator i = ServerInstance->Config->oper_blocks.begin(); i != ServerInstance->Config->oper_blocks.end(); i++) { OperInfo* ifo = i->second; + if (!ifo->oper_block) + continue; + std::string fp = ifo->oper_block->getString("fingerprint"); if (fp == cert->fingerprint && ifo->oper_block->getBool("autologin")) user->Oper(ifo); -- cgit v1.2.3 From cb43342a295c6ab01d3895dd4bf21af60b76adaa Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Mon, 13 Jun 2016 13:05:18 +0200 Subject: Stop processing the new connection in UserManager::AddUser() when an internal SocketEngine error happens and the user is quitted --- src/usermanager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 76446c5b5..2cb7ad511 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -143,6 +143,7 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs { ServerInstance->Logs->Log("USERS", DEBUG,"Internal error on new connection"); this->QuitUser(New, "Internal error handling connection"); + return; } /* NOTE: even if dns lookups are *off*, we still need to display this. -- cgit v1.2.3 From 925afed1b90871a52fb19f0ee2cb99cd26a53bae Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Fri, 17 Jun 2016 12:04:12 +0200 Subject: Don't exit on rehash if the pid file cannot be written --- include/inspircd.h | 3 ++- include/modules.h | 2 +- src/configreader.cpp | 2 +- src/inspircd.cpp | 12 +++++++----- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/include/inspircd.h b/include/inspircd.h index e2eaf8292..78348ed54 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -779,9 +779,10 @@ class CoreExport InspIRCd /** Attempt to write the process id to a given file * @param filename The PID file to attempt to write to + * @param exitonfail If true and the PID fail cannot be written log to stdout and exit, otherwise only log on failure * @return This function may bail if the file cannot be written */ - void WritePID(const std::string &filename); + void WritePID(const std::string& filename, bool exitonfail = true); /** This constructor initialises all the subsystems and reads the config file. * @param argc The argument count passed to main() diff --git a/include/modules.h b/include/modules.h index 9857012fc..4d4d0871f 100644 --- a/include/modules.h +++ b/include/modules.h @@ -116,7 +116,7 @@ struct ModResult { * and numerical comparisons in preprocessor macros if they wish to support * multiple versions of InspIRCd in one file. */ -#define INSPIRCD_VERSION_API 9 +#define INSPIRCD_VERSION_API 10 /** * This #define allows us to call a method in all diff --git a/src/configreader.cpp b/src/configreader.cpp index 5b298ddd8..301db14e8 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -729,7 +729,7 @@ void ServerConfig::Apply(ServerConfig* old, const std::string &useruid) // write once here, to try it out and make sure its ok if (valid) - ServerInstance->WritePID(this->PID); + ServerInstance->WritePID(this->PID, !old); if (old && valid) { diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 656be220f..0fa90fca5 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -294,7 +294,7 @@ bool InspIRCd::DaemonSeed() #endif } -void InspIRCd::WritePID(const std::string &filename) +void InspIRCd::WritePID(const std::string& filename, bool exitonfail) { #ifndef _WIN32 std::string fname(filename); @@ -307,10 +307,12 @@ void InspIRCd::WritePID(const std::string &filename) outfile.close(); } else - { - std::cout << "Failed to write PID-file '" << fname << "', exiting." << std::endl; - this->Logs->Log("STARTUP",DEFAULT,"Failed to write PID-file '%s', exiting.",fname.c_str()); - Exit(EXIT_STATUS_PID); + { + if (exitonfail) + std::cout << "Failed to write PID-file '" << fname << "', exiting." << std::endl; + this->Logs->Log("STARTUP",DEFAULT,"Failed to write PID-file '%s'%s",fname.c_str(), (exitonfail ? ", exiting." : "")); + if (exitonfail) + Exit(EXIT_STATUS_PID); } #endif } -- cgit v1.2.3 From 86c3fde2fedfe9270eeaa1a93c0ea15d6fb9962d Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Tue, 21 Jun 2016 15:07:43 +0200 Subject: m_ssl_gnutls, m_ssl_openssl After a read schedule another read if data remains in the buffer of the SSL library --- src/modules/extra/m_ssl_gnutls.cpp | 3 +++ src/modules/extra/m_ssl_openssl.cpp | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 813a8ecfa..2f4acf3f0 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -703,6 +703,9 @@ class ModuleSSLGnuTLS : public Module if (ret > 0) { recvq.append(buffer, ret); + // Schedule a read if there is still data in the GnuTLS buffer + if (gnutls_record_check_pending(session->sess) > 0) + ServerInstance->SE->ChangeEventMask(user, FD_ADD_TRIAL_READ); return 1; } else if (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED) diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index b21091d3f..9e6472ac3 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -591,8 +591,15 @@ class ModuleSSLOpenSSL : public Module if (ret > 0) { recvq.append(buffer, ret); + + int mask = 0; + // Schedule a read if there is still data in the OpenSSL buffer + if (SSL_pending(session->sess) > 0) + mask |= FD_ADD_TRIAL_READ; if (session->data_to_write) - ServerInstance->SE->ChangeEventMask(user, FD_WANT_POLL_READ | FD_WANT_SINGLE_WRITE); + mask |= FD_WANT_POLL_READ | FD_WANT_SINGLE_WRITE; + if (mask != 0) + ServerInstance->SE->ChangeEventMask(user, mask); return 1; } else if (ret == 0) -- cgit v1.2.3 From 9401f1fbc35bdcf4f24be447b1bdf47d157464fa Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sat, 4 Jun 2016 12:55:17 +0100 Subject: GCC should never assume that this can not be null. --- configure | 5 ++++- make/template/main.mk | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/configure b/configure index fd00ff89c..e8c3deb0d 100755 --- a/configure +++ b/configure @@ -965,6 +965,9 @@ EOF my @dotfiles = qw(main.mk inspircd); push @dotfiles, 'org.inspircd.plist' if $config{OSNAME} eq 'darwin'; + # HACK: we need to know if we are on GCC6 to disable the omission of `this` null pointer checks. + $config{GCC6} = `$config{CC} --version 2>/dev/null` =~ /gcc/i && $config{GCCVER} ge "6" ? "true" : "false"; + foreach my $file (@dotfiles) { open(FILEHANDLE, "make/template/$file") or die "Can't open make/template/$file: $!"; $_ = join '', ; @@ -974,7 +977,7 @@ EOF for my $var (qw( CC SYSTEM BASE_DIR CONFIG_DIR MODULE_DIR BINARY_DIR BUILD_DIR DATA_DIR UID - STARTSCRIPT DESTINATION SOCKETENGINE LOG_DIR + STARTSCRIPT DESTINATION SOCKETENGINE LOG_DIR GCC6 )) { s/\@$var\@/$config{$var}/g; } diff --git a/make/template/main.mk b/make/template/main.mk index c46d60502..23daa7efc 100644 --- a/make/template/main.mk +++ b/make/template/main.mk @@ -89,6 +89,11 @@ INSTMODE_LIB = 0644 D=0 @ENDIF +GCC6=@GCC6@ +@IFEQ $(GCC6) true + CXXFLAGS += -fno-delete-null-pointer-checks +@ENDIF + DBGOK=0 @IFEQ $(D) 0 CXXFLAGS += -O2 -- cgit v1.2.3 From 1f25ec70d144d85e28ec4d2769fefd8abb00cbca Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Fri, 22 Jul 2016 12:04:35 +0200 Subject: m_ssl_openssl Verify DH params being non-NULL before setting it on the context Fixes issue reported by @m4rkw on IRC --- src/modules/extra/m_ssl_openssl.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 9e6472ac3..aee7a5e34 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -405,12 +405,19 @@ class ModuleSSLOpenSSL : public Module #endif ERR_clear_error(); - if ((SSL_CTX_set_tmp_dh(ctx, ret) < 0) || (SSL_CTX_set_tmp_dh(clictx, ret) < 0)) + if (ret) { - ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_openssl.so: Couldn't set DH parameters %s. SSL errors follow:", dhfile.c_str()); - ERR_print_errors_cb(error_callback, this); + if ((SSL_CTX_set_tmp_dh(ctx, ret) < 0) || (SSL_CTX_set_tmp_dh(clictx, ret) < 0)) + { + ServerInstance->Logs->Log("m_ssl_openssl", DEFAULT, "m_ssl_openssl.so: Couldn't set DH parameters %s. SSL errors follow:", dhfile.c_str()); + ERR_print_errors_cb(error_callback, this); + } + DH_free(ret); + } + else + { + ServerInstance->Logs->Log("m_ssl_openssl", DEFAULT, "m_ssl_openssl.so: Couldn't set DH parameters %s.", dhfile.c_str()); } - DH_free(ret); } #ifndef _WIN32 -- cgit v1.2.3 From fe3b48692af9d633da2e92b581f5ad859788f423 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Thu, 28 Jul 2016 15:32:13 +0100 Subject: Force link sqlite3 on OS X when doing Travis builds. The system version of this library does not include support for pkg-config. --- tools/travis-ci.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/travis-ci.sh b/tools/travis-ci.sh index 6fb6f22ca..6dbc82300 100755 --- a/tools/travis-ci.sh +++ b/tools/travis-ci.sh @@ -8,6 +8,7 @@ elif [ "$TRAVIS_OS_NAME" = "osx" ] then brew update brew install geoip gnutls mysql-connector-c openssl pcre postgresql sqlite3 tre + brew link sqlite3 --force else >&2 echo "'$TRAVIS_OS_NAME' is an unknown Travis CI environment!" exit 1 -- cgit v1.2.3 From 5f29158a5b7a892bde7dff26d87f94aacc8beadb Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 29 Jul 2016 13:09:43 -0400 Subject: Fix bursting channel bans --- src/modules/m_spanningtree/netburst.cpp | 25 ++++++++++++++----------- src/modules/m_spanningtree/treesocket.h | 2 ++ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp index d508c092d..3bce90eda 100644 --- a/src/modules/m_spanningtree/netburst.cpp +++ b/src/modules/m_spanningtree/netburst.cpp @@ -140,25 +140,28 @@ void TreeSocket::SendFJoins(Channel* c) buffer.append(list).append("\r\n"); } - int linesize = 1; + unsigned int linesize = 1; for (BanList::iterator b = c->bans.begin(); b != c->bans.end(); b++) { - int size = b->data.length() + 2; - int currsize = linesize + size; - if (currsize <= 350) - { - modes.append("b"); - params.append(" ").append(b->data); - linesize += size; - } - if ((modes.length() >= ServerInstance->Config->Limits.MaxModes) || (currsize > 350)) + unsigned int size = b->data.length() + 2; // "b" and " " + unsigned int nextsize = linesize + size; + + if ((modes.length() >= ServerInstance->Config->Limits.MaxModes) || (nextsize > FMODE_MAX_LENGTH)) { - /* Wrap at MAXMODES */ + /* Wrap */ buffer.append(":").append(ServerInstance->Config->GetSID()).append(" FMODE ").append(c->name).append(" ").append(ConvToStr(c->age)).append(" +").append(modes).append(params).append("\r\n"); + modes.clear(); params.clear(); linesize = 1; } + + modes.push_back('b'); + + params.push_back(' '); + params.append(b->data); + + linesize += size; } /* Only send these if there are any */ diff --git a/src/modules/m_spanningtree/treesocket.h b/src/modules/m_spanningtree/treesocket.h index abda28335..efcce5f7a 100644 --- a/src/modules/m_spanningtree/treesocket.h +++ b/src/modules/m_spanningtree/treesocket.h @@ -100,6 +100,8 @@ class TreeSocket : public BufferedSocket int proto_version; /* Remote protocol version */ bool ConnectionFailureShown; /* Set to true if a connection failure message was shown */ + static const unsigned int FMODE_MAX_LENGTH = 350; + /** Checks if the given servername and sid are both free */ bool CheckDuplicate(const std::string& servername, const std::string& sid); -- cgit v1.2.3 From 25cdcdc777c265124e55bf0fb94fdd856065f25b Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Fri, 5 Aug 2016 20:50:11 +0100 Subject: Fix challenge auth when using m_hash_gnutls instead of m_sha256. --- src/modules/m_spanningtree/capab.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/m_spanningtree/capab.cpp b/src/modules/m_spanningtree/capab.cpp index 7b6435898..0ab815fef 100644 --- a/src/modules/m_spanningtree/capab.cpp +++ b/src/modules/m_spanningtree/capab.cpp @@ -27,6 +27,7 @@ #include "utils.h" #include "link.h" #include "main.h" +#include "../hash.h" std::string TreeSocket::MyModules(int filter) { @@ -134,7 +135,7 @@ void TreeSocket::SendCapabilities(int phase) std::string extra; /* Do we have sha256 available? If so, we send a challenge */ - if (Utils->ChallengeResponse && (ServerInstance->Modules->Find("m_sha256.so"))) + if (Utils->ChallengeResponse && (ServerInstance->Modules->FindDataService("hash/sha256"))) { SetOurChallenge(ServerInstance->GenRandomStr(20)); extra = " CHALLENGE=" + this->GetOurChallenge(); @@ -320,7 +321,7 @@ bool TreeSocket::Capab(const parameterlist ¶ms) /* Challenge response, store their challenge for our password */ std::map::iterator n = this->capab->CapKeys.find("CHALLENGE"); - if (Utils->ChallengeResponse && (n != this->capab->CapKeys.end()) && (ServerInstance->Modules->Find("m_sha256.so"))) + if (Utils->ChallengeResponse && (n != this->capab->CapKeys.end()) && (ServerInstance->Modules->FindDataService("hash/sha256"))) { /* Challenge-response is on now */ this->SetTheirChallenge(n->second); -- cgit v1.2.3 From e2dd99fa342b45364590ec72746e3118f1779538 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Sat, 13 Aug 2016 18:11:57 +0200 Subject: Fix more incorrect std::string::operator[] usage --- src/commands/cmd_list.cpp | 2 +- src/commands/cmd_stats.cpp | 2 +- src/modules/m_sasl.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/commands/cmd_list.cpp b/src/commands/cmd_list.cpp index 8a99ce3e0..eb28fb89c 100644 --- a/src/commands/cmd_list.cpp +++ b/src/commands/cmd_list.cpp @@ -49,7 +49,7 @@ CmdResult CommandList::Handle (const std::vector& parameters, User user->WriteNumeric(321, "%s Channel :Users Name",user->nick.c_str()); - if (parameters.size() == 1) + if ((parameters.size() == 1) && (!parameters[0].empty())) { if (parameters[0][0] == '<') { diff --git a/src/commands/cmd_stats.cpp b/src/commands/cmd_stats.cpp index d547635ed..aa5bf44cd 100644 --- a/src/commands/cmd_stats.cpp +++ b/src/commands/cmd_stats.cpp @@ -39,7 +39,7 @@ class CommandStats : public Command public: /** Constructor for stats. */ - CommandStats ( Module* parent) : Command(parent,"STATS",1,2) { syntax = " []"; } + CommandStats ( Module* parent) : Command(parent,"STATS",1,2) { allow_empty_last_param = false; syntax = " []"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index 32c9afc79..9cb5592d1 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -147,7 +147,7 @@ class SaslAuthenticator SendSASL(params); - if (parameters[0][0] == '*') + if (parameters[0].c_str()[0] == '*') { this->Abort(); return false; -- cgit v1.2.3 From a8c7c85ecdb0449f35d5bb4037a61f461e9c4be0 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Sat, 13 Aug 2016 18:23:12 +0200 Subject: m_censor Fix possible incorrect cast of dest --- src/modules/m_censor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index 50c8e22a7..65b965df2 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -101,7 +101,7 @@ class ModuleCensor : public Module { if (index->second.empty()) { - user->WriteNumeric(ERR_WORDFILTERED, "%s %s %s :Your message contained a censored word, and was blocked", user->nick.c_str(), ((Channel*)dest)->name.c_str(), index->first.c_str()); + user->WriteNumeric(ERR_WORDFILTERED, "%s %s %s :Your message contained a censored word, and was blocked", user->nick.c_str(), ((target_type == TYPE_CHANNEL) ? ((Channel*)dest)->name.c_str() : ((User*)dest)->nick.c_str()), index->first.c_str()); return MOD_RES_DENY; } -- cgit v1.2.3 From c7a26bc21629ddd4103dac1ff7f9acf45a2c4d35 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Sat, 13 Aug 2016 18:23:19 +0200 Subject: Release v2.0.22 --- src/version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.sh b/src/version.sh index 29dbd442b..5e2b31314 100755 --- a/src/version.sh +++ b/src/version.sh @@ -1,2 +1,2 @@ #!/bin/sh -echo "InspIRCd-2.0.21" +echo "InspIRCd-2.0.22" -- cgit v1.2.3