From 426752022ee4b5158b4cfc6c4531fff285029071 Mon Sep 17 00:00:00 2001 From: ChrisTX Date: Sat, 31 Aug 2013 01:17:07 +0200 Subject: Improve support for rarely used compilers, EKOPath in this case. --- src/command_parse.cpp | 2 +- src/mode.cpp | 2 +- src/modules/m_ident.cpp | 2 +- src/modules/m_silence.cpp | 2 +- src/timer.cpp | 2 +- src/users.cpp | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/command_parse.cpp b/src/command_parse.cpp index b05b34c9b..34844d804 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -256,7 +256,7 @@ bool CommandParser::ProcessCommand(LocalUser *user, std::string &cmd) while (command_p.size() > (cm->second->max_params - 1)) { // BE CAREFUL: .end() returns past the end of the vector, hence decrement. - std::vector::iterator it = --command_p.end(); + std::vector::iterator it = command_p.end() - 1; lparam.insert(0, " " + *(it)); command_p.erase(it); // remove last element diff --git a/src/mode.cpp b/src/mode.cpp index e2b0c2f68..16751e712 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -880,7 +880,7 @@ bool ModeParser::DelModeWatcher(ModeWatcher* mw) mw->GetModeType() == MODETYPE_USER ? mask = MASK_USER : mask = MASK_CHANNEL; pos = (mw->GetModeChar()-65) | mask; - ModeWatchIter a = find(modewatchers[pos].begin(),modewatchers[pos].end(),mw); + ModeWatchIter a = std::find(modewatchers[pos].begin(),modewatchers[pos].end(),mw); if (a == modewatchers[pos].end()) { diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 6099e7c14..f0ced1db7 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -362,7 +362,7 @@ class ModuleIdent : public Module /* wooo, got a result (it will be good, or bad) */ if (isock->result.empty()) { - user->ident.insert(0, 1, '~'); + user->ident.insert(user->ident.begin(), 1, '~'); user->WriteServ("NOTICE Auth :*** Could not find your ident, using %s instead.", user->ident.c_str()); } else diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index 817c8ffcf..ce5b26500 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -87,7 +87,7 @@ class CommandSVSSilence : public Command if (IS_LOCAL(u)) { - ServerInstance->Parser->CallHandler("SILENCE", std::vector(++parameters.begin(), parameters.end()), u); + ServerInstance->Parser->CallHandler("SILENCE", std::vector(parameters.begin() + 1, parameters.end()), u); } return CMD_SUCCESS; diff --git a/src/timer.cpp b/src/timer.cpp index a1ee0b488..e04a186cf 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -70,7 +70,7 @@ void TimerManager::DelTimer(Timer* T) void TimerManager::AddTimer(Timer* T) { Timers.push_back(T); - sort(Timers.begin(), Timers.end(), TimerManager::TimerComparison); + std::sort(Timers.begin(), Timers.end(), TimerManager::TimerComparison); } bool TimerManager::TimerComparison( Timer *one, Timer *two) diff --git a/src/users.cpp b/src/users.cpp index 18a356ef8..6b2432cc4 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -978,7 +978,7 @@ const char* User::GetIPString() irc::sockets::satoap(client_sa, cachedip, port); /* IP addresses starting with a : on irc are a Bad Thing (tm) */ if (cachedip.c_str()[0] == ':') - cachedip.insert(0,1,'0'); + cachedip.insert(cachedip.begin(),1,'0'); } return cachedip.c_str(); -- cgit v1.2.3 From ae23aefa3cde3caffc70a0c8058ebdc42326c59a Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Sat, 31 Aug 2013 12:00:55 +0200 Subject: m_spanningtree Fix timestamp in AWAY --- src/modules/m_spanningtree/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index ce1792a02..4e189073f 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -916,7 +916,7 @@ ModResult ModuleSpanningTree::OnSetAway(User* user, const std::string &awaymsg) parameterlist params; if (!awaymsg.empty()) { - params.push_back(ConvToStr(user->awaytime)); + params.push_back(ConvToStr(ServerInstance->Time())); params.push_back(":" + awaymsg); } Utils->DoOneToMany(user->uuid, "AWAY", params); -- cgit v1.2.3 From 3f4d54eb031f1cd6b016dfe1f768ed86303e3856 Mon Sep 17 00:00:00 2001 From: ChrisTX Date: Wed, 4 Sep 2013 14:16:48 +0200 Subject: Fix a crash when running as systemd service - Fix a NULL dereference if a signal is raised in the constructor of the class InspIRCd - Resolve the parent's process exit code being SIGTERM=15 and typically not EXIT_SUCCESS thus A combination of the two caused crashes when running as systemd unit. --- include/inspircd.h | 3 ++- src/inspircd.cpp | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/include/inspircd.h b/include/inspircd.h index 86853a94f..d5e749193 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -47,6 +47,7 @@ #endif // Required system headers. +#include #include #include #include @@ -454,7 +455,7 @@ class CoreExport InspIRCd /** Set to the current signal recieved */ - int s_signal; + static sig_atomic_t s_signal; /** Protocol interface, overridden by server protocol modules */ diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 9516449a0..9d92888a3 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -63,7 +63,6 @@ #include "testsuite.h" InspIRCd* ServerInstance = NULL; -int* mysig = NULL; /** Seperate from the other casemap tables so that code *can* still exclusively rely on RFC casemapping * if it must. @@ -244,13 +243,20 @@ void InspIRCd::QuickExit(int status) exit(status); } +// Required for returning the proper value of EXIT_SUCCESS for the parent process +static void VoidSignalHandler(int signalreceived) +{ + exit(0); +} + bool InspIRCd::DaemonSeed() { #ifdef _WIN32 std::cout << "InspIRCd Process ID: " << con_green << GetCurrentProcessId() << con_reset << std::endl; return true; #else - signal(SIGTERM, InspIRCd::QuickExit); + // Do not use QuickExit here: It will exit with status SIGTERM which would break e.g. daemon scripts + signal(SIGTERM, VoidSignalHandler); int childpid; if ((childpid = fork ()) < 0) @@ -847,10 +853,10 @@ int InspIRCd::Run() GlobalCulls.Apply(); AtomicActions.Run(); - if (this->s_signal) + if (s_signal) { this->SignalHandler(s_signal); - this->s_signal = 0; + s_signal = 0; } } @@ -874,9 +880,11 @@ bool InspIRCd::AllModulesReportReady(LocalUser* user) return (res == MOD_RES_PASSTHRU); } +sig_atomic_t InspIRCd::s_signal = 0; + void InspIRCd::SetSignal(int signal) { - *mysig = signal; + s_signal = signal; } /* On posix systems, the flow of the program starts right here, with @@ -888,7 +896,6 @@ void InspIRCd::SetSignal(int signal) ENTRYPOINT { new InspIRCd(argc, argv); - mysig = &ServerInstance->s_signal; ServerInstance->Run(); delete ServerInstance; return 0; -- cgit v1.2.3 From 6f971a57e52e8f389e47ca5d626da1290a3d3b27 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Mon, 9 Sep 2013 13:22:51 +0200 Subject: m_showwhois Require 2 parameters for WHOISNOTICE --- src/modules/m_showwhois.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/modules/m_showwhois.cpp b/src/modules/m_showwhois.cpp index 434d1b07f..398ebf571 100644 --- a/src/modules/m_showwhois.cpp +++ b/src/modules/m_showwhois.cpp @@ -39,7 +39,7 @@ class SeeWhois : public SimpleUserModeHandler class WhoisNoticeCmd : public Command { public: - WhoisNoticeCmd(Module* Creator) : Command(Creator,"WHOISNOTICE", 1) + WhoisNoticeCmd(Module* Creator) : Command(Creator,"WHOISNOTICE", 2) { flags_needed = FLAG_SERVERONLY; } -- cgit v1.2.3 From c0f946f2b7195e101cdaae9d5453e0027d4204b4 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Mon, 9 Sep 2013 13:30:31 +0200 Subject: m_httpd Close all open http sockets on unload --- src/modules/m_httpd.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index 37f715a8d..6315809a9 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -32,6 +32,7 @@ class ModuleHttpServer; static ModuleHttpServer* HttpModule; static bool claimed; +static std::set sockets; /** HTTP socket states */ @@ -69,6 +70,11 @@ class HttpServerSocket : public BufferedSocket GetIOHook()->OnStreamSocketAccept(this, client, server); } + ~HttpServerSocket() + { + sockets.erase(this); + } + virtual void OnError(BufferedSocketError) { ServerInstance->GlobalCulls.AddItem(this); @@ -333,7 +339,6 @@ class HttpServerSocket : public BufferedSocket class ModuleHttpServer : public Module { - std::vector httpsocks; public: void init() @@ -358,18 +363,21 @@ class ModuleHttpServer : public Module int port; std::string incomingip; irc::sockets::satoap(*client, incomingip, port); - new HttpServerSocket(nfd, incomingip, from, client, server); + sockets.insert(new HttpServerSocket(nfd, incomingip, from, client, server)); return MOD_RES_ALLOW; } - - virtual ~ModuleHttpServer() + CullResult cull() { - for (size_t i = 0; i < httpsocks.size(); i++) + std::set local; + local.swap(sockets); + for (std::set::const_iterator i = local.begin(); i != local.end(); ++i) { - httpsocks[i]->cull(); - delete httpsocks[i]; + HttpServerSocket* sock = *i; + sock->cull(); + delete sock; } + return Module::cull(); } virtual Version GetVersion() -- cgit v1.2.3 From 718a87e7e4ca4541a3c808ccb633eb362c2ef5b3 Mon Sep 17 00:00:00 2001 From: ChrisTX Date: Mon, 9 Sep 2013 23:50:21 +0200 Subject: Fix a shadow warning created by ConfigTag::create --- include/configreader.h | 3 +-- src/configparser.cpp | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/include/configreader.h b/include/configreader.h index 09d4e619d..1edacfe13 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -64,8 +64,7 @@ class CoreExport ConfigTag : public refcountbase inline const std::vector& getItems() const { return items; } /** Create a new ConfigTag, giving access to the private KeyVal item list */ - static ConfigTag* create(const std::string& Tag, const std::string& file, int line, - std::vector*&items); + static ConfigTag* create(const std::string& Tag, const std::string& file, int line, std::vector*& Items); private: ConfigTag(const std::string& Tag, const std::string& file, int line); }; diff --git a/src/configparser.cpp b/src/configparser.cpp index 7d9eab651..825dfc966 100644 --- a/src/configparser.cpp +++ b/src/configparser.cpp @@ -472,10 +472,10 @@ std::string ConfigTag::getTagLocation() return src_name + ":" + ConvToStr(src_line); } -ConfigTag* ConfigTag::create(const std::string& Tag, const std::string& file, int line, std::vector*&items) +ConfigTag* ConfigTag::create(const std::string& Tag, const std::string& file, int line, std::vector*& Items) { ConfigTag* rv = new ConfigTag(Tag, file, line); - items = &rv->items; + Items = &rv->items; return rv; } -- cgit v1.2.3 From b8440f4a023069e31f0af75dd9c15af3c3f9a26c Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Sun, 15 Sep 2013 16:54:34 +0200 Subject: Work around STB_GNU_UNIQUE symbols not allowing module unmap --- src/modules/m_permchannels.cpp | 6 +++--- src/modules/m_ripemd160.cpp | 4 +++- src/modules/m_services_account.cpp | 11 ++++++----- 3 files changed, 12 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp index 0a7dc8ed9..69a282637 100644 --- a/src/modules/m_permchannels.cpp +++ b/src/modules/m_permchannels.cpp @@ -214,10 +214,12 @@ class ModulePermanentChannels : public Module { PermChannel p; bool dirty; + bool loaded; bool save_listmodes; public: - ModulePermanentChannels() : p(this), dirty(false) + ModulePermanentChannels() + : p(this), dirty(false), loaded(false) { } @@ -356,8 +358,6 @@ public: // to be able to set the modes they provide (e.g.: m_stripcolor is inited after us) // Prioritize() is called after all module initialization is complete, consequently // all modes are available now - - static bool loaded = false; if (loaded) return; diff --git a/src/modules/m_ripemd160.cpp b/src/modules/m_ripemd160.cpp index 6ceb4b481..04c27e83d 100644 --- a/src/modules/m_ripemd160.cpp +++ b/src/modules/m_ripemd160.cpp @@ -159,6 +159,9 @@ typedef uint32_t dword; class RIProv : public HashProvider { + /** Final hash value + */ + byte hashcode[RMDsize/8]; void MDinit(dword *MDbuf, unsigned int* key) { @@ -416,7 +419,6 @@ class RIProv : public HashProvider { ServerInstance->Logs->Log("m_ripemd160", DEBUG, "RMD: '%s' length=%u", (const char*)message, length); dword MDbuf[RMDsize/32]; /* contains (A, B, C, D(E)) */ - static byte hashcode[RMDsize/8]; /* for final hash-value */ dword X[16]; /* current 16-word chunk */ unsigned int i; /* counter */ dword nbytes; /* # of bytes not yet processed */ diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index cb3f089c6..a139087a5 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -112,9 +112,11 @@ class ModuleServicesAccount : public Module Channel_r m4; User_r m5; AccountExtItem accountname; + bool checking_ban; + public: ModuleServicesAccount() : m1(this), m2(this), m3(this), m4(this), m5(this), - accountname("accountname", this) + accountname("accountname", this), checking_ban(false) { } @@ -199,8 +201,7 @@ class ModuleServicesAccount : public Module ModResult OnCheckBan(User* user, Channel* chan, const std::string& mask) { - static bool checking = false; - if (checking) + if (checking_ban) return MOD_RES_PASSTHRU; if ((mask.length() > 2) && (mask[1] == ':')) @@ -220,9 +221,9 @@ class ModuleServicesAccount : public Module /* If we made it this far we know the user isn't registered so just deny if it matches */ - checking = true; + checking_ban = true; bool result = chan->CheckBan(user, mask.substr(2)); - checking = false; + checking_ban = false; if (result) return MOD_RES_DENY; -- cgit v1.2.3 From e51ea66534e407bd5314d2df3ecdaf8ef2e7d310 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Tue, 24 Sep 2013 22:36:28 +0100 Subject: Improve error reporting for . --- docs/conf/inspircd.conf.example | 10 ++++++---- src/inspircd.cpp | 8 ++++---- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/docs/conf/inspircd.conf.example b/docs/conf/inspircd.conf.example index 9512e17c4..20344792e 100644 --- a/docs/conf/inspircd.conf.example +++ b/docs/conf/inspircd.conf.example @@ -718,13 +718,15 @@ # no Do not show operspywhois="no" - # runasuser: If this is set, InspIRCd will attempt to setuid - # to run as this user- allows binding of ports under 1024. + # runasuser: If this is set, InspIRCd will attempt to switch + # to run as this user, which allows binding of ports under 1024. + # You should NOT set this unless you are starting as root. # NOT SUPPORTED/NEEDED UNDER WINDOWS. #runasuser="" - # runasgroup: If this is set, InspIRCd will attempt to set group - # to run under this group, which allows binding of ports under 1024 + # runasgroup: If this is set, InspIRCd will attempt to switch + # to run as this group, which allows binding of ports under 1024. + # You should NOT set this unless you are starting as root. # NOT SUPPORTED/NEEDED UNDER WINDOWS. #runasgroup="" diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 9d92888a3..b201e38c6 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -693,7 +693,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : if (!g) { - this->Logs->Log("SETGUID", DEFAULT, "getgrnam() failed (bad user?): %s", strerror(errno)); + this->Logs->Log("SETGUID", DEFAULT, "getgrnam(%s) failed (wrong group?): %s", SetGroup.c_str(), strerror(errno)); this->QuickExit(0); } @@ -701,7 +701,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : if (ret == -1) { - this->Logs->Log("SETGUID", DEFAULT, "setgid() failed (bad user?): %s", strerror(errno)); + this->Logs->Log("SETGUID", DEFAULT, "setgid() failed (wrong group?): %s", strerror(errno)); this->QuickExit(0); } } @@ -716,7 +716,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : if (!u) { - this->Logs->Log("SETGUID", DEFAULT, "getpwnam() failed (bad user?): %s", strerror(errno)); + this->Logs->Log("SETGUID", DEFAULT, "getpwnam(%s) failed (wrong user?): %s", SetUser.c_str(), strerror(errno)); this->QuickExit(0); } @@ -724,7 +724,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : if (ret == -1) { - this->Logs->Log("SETGUID", DEFAULT, "setuid() failed (bad user?): %s", strerror(errno)); + this->Logs->Log("SETGUID", DEFAULT, "setuid() failed (wrong user?): %s", strerror(errno)); this->QuickExit(0); } } -- cgit v1.2.3 From 541e74bc147f4614f61c2781b7a82f3dbf9c9a32 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Wed, 23 Oct 2013 23:46:08 +0100 Subject: Fix m_silence looking for maxentries in instead of . Fixes issue #644. --- src/modules/m_silence.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index ce5b26500..c82ab3f9d 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -315,7 +315,7 @@ class ModuleSilence : public Module void OnRehash(User* user) { - maxsilence = ServerInstance->Config->ConfValue("showwhois")->getInt("maxentries", 32); + maxsilence = ServerInstance->Config->ConfValue("silence")->getInt("maxentries", 32); if (!maxsilence) maxsilence = 32; } -- cgit v1.2.3 From 9cdf47629faeec64edc77ff0729dc55946ed753c Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 9 Nov 2013 06:23:05 -0500 Subject: Fix issue #657, fix sending FNAME with spaces --- src/modules/m_spanningtree/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 4e189073f..606f8e672 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -645,7 +645,7 @@ void ModuleSpanningTree::OnChangeName(User* user, const std::string &gecos) return; parameterlist params; - params.push_back(gecos); + params.push_back(":" + gecos); Utils->DoOneToMany(user->uuid,"FNAME",params); } -- cgit v1.2.3 From 2f0c3281d7deba949147af642fef48b8779020ac Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 9 Nov 2013 06:43:49 -0500 Subject: Fix parsing ADDLINE with expiration or creation dates past ~2038 probably --- src/modules/m_spanningtree/addline.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/modules/m_spanningtree/addline.cpp b/src/modules/m_spanningtree/addline.cpp index 7ee1a7ef1..16043b2aa 100644 --- a/src/modules/m_spanningtree/addline.cpp +++ b/src/modules/m_spanningtree/addline.cpp @@ -54,17 +54,21 @@ bool TreeSocket::AddLine(const std::string &prefix, parameterlist ¶ms) return true; } + long created = atol(params[3].c_str()), expires = atol(params[4].c_str()); + if (created < 0 || expires < 0) + return true; + XLine* xl = NULL; try { - xl = xlf->Generate(ServerInstance->Time(), atoi(params[4].c_str()), params[2], params[5], params[1]); + xl = xlf->Generate(ServerInstance->Time(), expires, params[2], params[5], params[1]); } catch (ModuleException &e) { ServerInstance->SNO->WriteToSnoMask('d',"Unable to ADDLINE type %s from %s: %s", params[0].c_str(), setter.c_str(), e.GetReason()); return true; } - xl->SetCreateTime(atoi(params[3].c_str())); + xl->SetCreateTime(created); if (ServerInstance->XLines->AddLine(xl, NULL)) { if (xl->duration) -- cgit v1.2.3 From e81860311e448867c1c35b89734afb5ea672019c Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 9 Nov 2013 06:52:38 -0500 Subject: Use case insensitive comparison for server names for (auto)connects, issue #662 --- src/modules/m_spanningtree/main.cpp | 6 +++--- src/modules/m_spanningtree/utils.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 606f8e672..37cd8c9a2 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -265,7 +265,7 @@ void ModuleSpanningTree::ConnectServer(Link* x, Autoconnect* y) { bool ipvalid = true; - if (InspIRCd::Match(ServerInstance->Config->ServerName, assign(x->Name))) + if (InspIRCd::Match(ServerInstance->Config->ServerName, assign(x->Name), rfc_case_insensitive_map)) { ServerInstance->SNO->WriteToSnoMask('l', "CONNECT: Not connecting to myself."); return; @@ -395,9 +395,9 @@ ModResult ModuleSpanningTree::HandleConnect(const std::vector& para for (std::vector >::iterator i = Utils->LinkBlocks.begin(); i < Utils->LinkBlocks.end(); i++) { Link* x = *i; - if (InspIRCd::Match(x->Name.c_str(),parameters[0])) + if (InspIRCd::Match(x->Name.c_str(),parameters[0], rfc_case_insensitive_map)) { - if (InspIRCd::Match(ServerInstance->Config->ServerName, assign(x->Name))) + if (InspIRCd::Match(ServerInstance->Config->ServerName, assign(x->Name), rfc_case_insensitive_map)) { RemoteMessage(user, "*** CONNECT: Server \002%s\002 is ME, not connecting.",x->Name.c_str()); return MOD_RES_DENY; diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index 1879d7111..3bd0aa2c7 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -421,7 +421,7 @@ Link* SpanningTreeUtilities::FindLink(const std::string& name) for (std::vector >::iterator i = LinkBlocks.begin(); i != LinkBlocks.end(); ++i) { Link* x = *i; - if (InspIRCd::Match(x->Name.c_str(), name.c_str())) + if (InspIRCd::Match(x->Name.c_str(), name.c_str(), rfc_case_insensitive_map)) { return x; } -- cgit v1.2.3 From 457c4f211f055b54031d8c8822bddc4d78af91c3 Mon Sep 17 00:00:00 2001 From: Daniel Vassdal Date: Tue, 12 Nov 2013 08:28:40 -0800 Subject: Fix remote /MODULES bug --- src/commands/cmd_modules.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/commands/cmd_modules.cpp b/src/commands/cmd_modules.cpp index b8a1805b0..e21df9b08 100644 --- a/src/commands/cmd_modules.cpp +++ b/src/commands/cmd_modules.cpp @@ -49,8 +49,11 @@ class CommandModules : public Command /** Handle /MODULES */ -CmdResult CommandModules::Handle (const std::vector&, User *user) +CmdResult CommandModules::Handle (const std::vector& parameters, User *user) { + if (parameters.size() >= 1 && parameters[0] != ServerInstance->Config->ServerName) + return CMD_SUCCESS; + std::vector module_names = ServerInstance->Modules->GetAllModuleNames(0); for (unsigned int i = 0; i < module_names.size(); i++) @@ -58,7 +61,7 @@ CmdResult CommandModules::Handle (const std::vector&, User *user) Module* m = ServerInstance->Modules->Find(module_names[i]); Version V = m->GetVersion(); - if (user->HasPrivPermission("servers/auspex")) + if (IS_LOCAL(user) && user->HasPrivPermission("servers/auspex")) { std::string flags("SvcC"); int pos = 0; -- cgit v1.2.3 From bc4177ad010d0db5248fd49db1498d67119d709a Mon Sep 17 00:00:00 2001 From: Daniel Vassdal Date: Sat, 7 Dec 2013 12:44:10 -0800 Subject: Fix ACCEPT propagation bug when it got a nick prefixed with + Fixes #696 Does not apply to 2.2 due to Attila's rewrite of the module --- src/modules/m_callerid.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index 37787b525..74428f543 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -171,6 +171,9 @@ public: dash = true; tok.erase(0, 1); // Remove the dash. } + else if (tok[0] == '+') + tok.erase(0, 1); + User* u = ServerInstance->FindNick(tok); if ((!u) || (u->registered != REG_ALL) || (u->quitting) || (IS_SERVER(u))) continue; -- cgit v1.2.3 From 4b9d53b05207cca559f24e098d50c43811fcf176 Mon Sep 17 00:00:00 2001 From: Daniel Vassdal Date: Thu, 12 Dec 2013 13:39:10 -0800 Subject: Fix m_override refusing to override modes if the user holds halfop or higher in the channel --- src/modules/m_override.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp index 1d9447fc4..3e42c4f79 100644 --- a/src/modules/m_override.cpp +++ b/src/modules/m_override.cpp @@ -33,6 +33,20 @@ class ModuleOverride : public Module bool RequireKey; bool NoisyOverride; + static bool IsOverride(unsigned int userlevel, const std::string& modeline) + { + for (std::string::const_iterator i = modeline.begin(); i != modeline.end(); ++i) + { + ModeHandler* mh = ServerInstance->Modes->FindMode(*i, MODETYPE_CHANNEL); + if (!mh) + continue; + + if (mh->GetLevelRequired() > userlevel) + return true; + } + return false; + } + public: void init() @@ -105,7 +119,10 @@ class ModuleOverride : public Module unsigned int mode = channel->GetPrefixValue(source); - if (mode < HALFOP_VALUE && CanOverride(source, "MODE")) + if (!IsOverride(mode, parameters[1])) + return MOD_RES_PASSTHRU; + + if (CanOverride(source, "MODE")) { std::string msg = source->nick+" overriding modes:"; for(unsigned int i=0; i < parameters.size(); i++) -- cgit v1.2.3 From 24fc55bbfd367bf2ef68230173ffe1cb58f744fa Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Sun, 15 Dec 2013 13:10:33 +0100 Subject: m_spanningtree Fix nick TS desync on SVSNICK Don't accept invalid timestamps --- src/modules/m_spanningtree/main.cpp | 4 +++- src/modules/m_spanningtree/main.h | 5 +++++ src/modules/m_spanningtree/svsnick.cpp | 15 +++++++++++++-- 3 files changed, 21 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 37cd8c9a2..d702ab4a2 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -38,6 +38,7 @@ #include "protocolinterface.h" ModuleSpanningTree::ModuleSpanningTree() + : KeepNickTS(false) { Utils = new SpanningTreeUtilities(this); commands = new SpanningTreeCommands(this); @@ -704,11 +705,12 @@ void ModuleSpanningTree::OnUserPostNick(User* user, const std::string &oldnick) /** IMPORTANT: We don't update the TS if the oldnick is just a case change of the newnick! */ - if (irc::string(user->nick.c_str()) != assign(oldnick)) + if ((irc::string(user->nick.c_str()) != assign(oldnick)) && (!this->KeepNickTS)) user->age = ServerInstance->Time(); params.push_back(ConvToStr(user->age)); Utils->DoOneToMany(user->uuid,"NICK",params); + this->KeepNickTS = false; } else if (!loopCall && user->nick == user->uuid) { diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index ae6e2e602..eb17c4195 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -63,6 +63,11 @@ class ModuleSpanningTree : public Module */ bool loopCall; + /** If true OnUserPostNick() won't update the nick TS before sending the NICK, + * used when handling SVSNICK. + */ + bool KeepNickTS; + /** Constructor */ ModuleSpanningTree(); diff --git a/src/modules/m_spanningtree/svsnick.cpp b/src/modules/m_spanningtree/svsnick.cpp index 79dc27ea3..59973202d 100644 --- a/src/modules/m_spanningtree/svsnick.cpp +++ b/src/modules/m_spanningtree/svsnick.cpp @@ -34,17 +34,28 @@ CmdResult CommandSVSNick::Handle(const std::vector& parameters, Use if (isdigit(nick[0])) nick = u->uuid; + // Don't update the TS if the nick is exactly the same + if (u->nick == nick) + return CMD_FAILURE; + + time_t NickTS = ConvToInt(parameters[2]); + if (NickTS <= 0) + return CMD_FAILURE; + + ModuleSpanningTree* st = (ModuleSpanningTree*)(Module*)creator; + st->KeepNickTS = true; + u->age = NickTS; + if (!u->ForceNickChange(nick.c_str())) { /* buh. UID them */ if (!u->ForceNickChange(u->uuid.c_str())) { ServerInstance->Users->QuitUser(u, "Nickname collision"); - return CMD_SUCCESS; } } - u->age = atoi(parameters[2].c_str()); + st->KeepNickTS = false; } return CMD_SUCCESS; -- cgit v1.2.3 From 928c5e6bed419adb1aa489c91857c4eca42ccdcc Mon Sep 17 00:00:00 2001 From: Daniel Vassdal Date: Fri, 20 Dec 2013 19:10:48 -0800 Subject: Allow ranges beginning with 0 in m_channames --- src/modules/m_channames.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/modules/m_channames.cpp b/src/modules/m_channames.cpp index b5f5853e7..325e8fee1 100644 --- a/src/modules/m_channames.cpp +++ b/src/modules/m_channames.cpp @@ -109,6 +109,12 @@ class ModuleChannelNames : public Module ConfigTag* tag = ServerInstance->Config->ConfValue("channames"); std::string denyToken = tag->getString("denyrange"); std::string allowToken = tag->getString("allowrange"); + + if (!denyToken.compare(0, 2, "0-")) + denyToken[0] = '1'; + if (!allowToken.compare(0, 2, "0-")) + allowToken[0] = '1'; + allowedmap.set(); irc::portparser denyrange(denyToken, false); -- cgit v1.2.3 From 43babe5c3eb1883c28c6c4d1a88c1bfa0f957ce8 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Thu, 26 Dec 2013 11:28:22 +0000 Subject: Fix the HELPOP database being destroyed when a rehash fails. --- src/modules/m_helpop.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index 92abcd76f..4bbe8785e 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -99,7 +99,6 @@ class CommandHelpop : public Command class ModuleHelpop : public Module { private: - std::string h_file; CommandHelpop cmd; Helpop ho; @@ -120,7 +119,7 @@ class ModuleHelpop : public Module void ReadConfig() { - helpop_map.clear(); + std::map help; ConfigTagList tags = ServerInstance->Config->ConfTags("helpop"); for(ConfigIter i = tags.first; i != tags.second; ++i) @@ -135,20 +134,21 @@ class ModuleHelpop : public Module throw ModuleException("m_helpop: The key 'index' is reserved for internal purposes. Please remove it."); } - helpop_map[key] = value; + help[key] = value; } - if (helpop_map.find("start") == helpop_map.end()) + if (help.find("start") == help.end()) { // error! throw ModuleException("m_helpop: Helpop file is missing important entry 'start'. Please check the example conf."); } - else if (helpop_map.find("nohelp") == helpop_map.end()) + else if (help.find("nohelp") == help.end()) { // error! throw ModuleException("m_helpop: Helpop file is missing important entry 'nohelp'. Please check the example conf."); } + helpop_map.swap(help); } void OnRehash(User* user) -- cgit v1.2.3 From e1976796bf99ddc6f9f8b946b5cdea26e9e5245a Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Sat, 4 Jan 2014 13:02:39 +0100 Subject: Show +i users on a channel to opers having the channels/auspex priv who do /NAMES from outside of the chan Discovered by @Cronus89 --- src/channels.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/channels.cpp b/src/channels.cpp index 4f63654a5..b5132c8b3 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -772,7 +772,9 @@ void Channel::UserList(User *user) if (!IS_LOCAL(user)) return; - if (this->IsModeSet('s') && !this->HasUser(user) && !user->HasPrivPermission("channels/auspex")) + bool has_privs = user->HasPrivPermission("channels/auspex"); + + if (this->IsModeSet('s') && !this->HasUser(user) && !has_privs) { user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel",user->nick.c_str(), this->name.c_str()); return; @@ -792,7 +794,7 @@ void Channel::UserList(User *user) { if (i->first->quitting) continue; - if ((!has_user) && (i->first->IsModeSet('i'))) + if ((!has_user) && (i->first->IsModeSet('i')) && (!has_privs)) { /* * user is +i, and source not on the channel, does not show -- cgit v1.2.3 From 7ce26772d93115e7c0a2644007351b57030710e6 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Sun, 5 Jan 2014 13:47:28 +0100 Subject: Fix possible use of invalid iterator on module unload When a module quits a user or destroys a channel in OnCleanup() the object is no longer in the container being iterated by the time OnCleanup() returns --- src/modules.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/modules.cpp b/src/modules.cpp index d25e145e3..b2d2f23c6 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -352,18 +352,23 @@ void ModuleManager::DoSafeUnload(Module* mod) std::vector > items; ServerInstance->Extensions.BeginUnregister(modfind->second, items); /* Give the module a chance to tidy out all its metadata */ - for (chan_hash::iterator c = ServerInstance->chanlist->begin(); c != ServerInstance->chanlist->end(); c++) + for (chan_hash::iterator c = ServerInstance->chanlist->begin(); c != ServerInstance->chanlist->end(); ) { - mod->OnCleanup(TYPE_CHANNEL,c->second); - c->second->doUnhookExtensions(items); - const UserMembList* users = c->second->GetUsers(); + Channel* chan = c->second; + ++c; + mod->OnCleanup(TYPE_CHANNEL, chan); + chan->doUnhookExtensions(items); + const UserMembList* users = chan->GetUsers(); for(UserMembCIter mi = users->begin(); mi != users->end(); mi++) mi->second->doUnhookExtensions(items); } - for (user_hash::iterator u = ServerInstance->Users->clientlist->begin(); u != ServerInstance->Users->clientlist->end(); u++) + for (user_hash::iterator u = ServerInstance->Users->clientlist->begin(); u != ServerInstance->Users->clientlist->end(); ) { - mod->OnCleanup(TYPE_USER,u->second); - u->second->doUnhookExtensions(items); + User* user = u->second; + // The module may quit the user (e.g. SSL mod unloading) and that will remove it from the container + ++u; + mod->OnCleanup(TYPE_USER, user); + user->doUnhookExtensions(items); } for(char m='A'; m <= 'z'; m++) { -- cgit v1.2.3 From fd57589b17c7eb5d29346651dd354b790454c68e Mon Sep 17 00:00:00 2001 From: Mantas Mikulėnas Date: Sat, 11 Jan 2014 23:41:16 +0200 Subject: Handle SASL failures during SASL_INIT (wrong mechanism, etc.) --- src/modules/m_sasl.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index b67111987..64960448e 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -93,9 +93,8 @@ class SaslAuthenticator { case SASL_INIT: this->agent = msg[0]; - this->user->Write("AUTHENTICATE %s", msg[3].c_str()); this->state = SASL_COMM; - break; + /* fall through */ case SASL_COMM: if (msg[0] != this->agent) return this->state; -- cgit v1.2.3 From 1c89cb1002c915a18abd1dda2204b5c3ea1b5515 Mon Sep 17 00:00:00 2001 From: Mantas Mikulėnas Date: Sat, 11 Jan 2014 23:42:34 +0200 Subject: Support SASL messages other than 'C' and 'D' --- src/modules/m_sasl.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index 64960448e..66efcfe4e 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -99,13 +99,17 @@ class SaslAuthenticator if (msg[0] != this->agent) return this->state; - if (msg[2] != "D") + if (msg[2] == "C") this->user->Write("AUTHENTICATE %s", msg[3].c_str()); - else + else if (msg[2] == "D") { this->state = SASL_DONE; this->result = this->GetSaslResult(msg[3]); } + else if (msg[2] == "M") + this->user->WriteNumeric(908, "%s %s :are available SASL mechanisms", this->user->nick.c_str(), msg[3].c_str()); + else + ServerInstance->Logs->Log("m_sasl", DEFAULT, "Services sent an unknown SASL message \"%s\" \"%s\"", msg[2].c_str(), msg[3].c_str()); break; case SASL_DONE: -- cgit v1.2.3 From d0a6b9c6eab666136af529953ebd585986a19848 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Mon, 13 Jan 2014 14:01:16 +0100 Subject: m_mlock Only deny the mlocked mode from being changed instead of denying the entire mode change if it contains a single mlocked mode Fixes issue #615 reported by @BlacklightShining --- src/modules/m_mlock.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/modules/m_mlock.cpp b/src/modules/m_mlock.cpp index 719701d02..d1df81354 100644 --- a/src/modules/m_mlock.cpp +++ b/src/modules/m_mlock.cpp @@ -31,7 +31,7 @@ public: void init() { - ServerInstance->Modules->Attach(I_OnPreMode, this); + ServerInstance->Modules->Attach(I_OnRawMode, this); ServerInstance->Modules->AddService(this->mlock); } @@ -40,12 +40,7 @@ public: return Version("Implements the ability to have server-side MLOCK enforcement.", VF_VENDOR); } - void Prioritize() - { - ServerInstance->Modules->SetPriority(this, I_OnPreMode, PRIORITY_FIRST); - } - - ModResult OnPreMode(User* source, User* dest, Channel* channel, const std::vector& parameters) + ModResult OnRawMode(User* source, Channel* channel, const char mode, const std::string& parameter, bool adding, int pcnt) { if (!channel) return MOD_RES_PASSTHRU; @@ -57,11 +52,11 @@ public: if (!mlock_str) return MOD_RES_PASSTHRU; - std::string::size_type p = parameters[1].find_first_of(*mlock_str); + std::string::size_type p = mlock_str->find(mode); if (p != std::string::npos) { source->WriteNumeric(742, "%s %c %s :MODE cannot be set due to channel having an active MLOCK restriction policy", - channel->name.c_str(), parameters[1][p], mlock_str->c_str()); + channel->name.c_str(), mode, mlock_str->c_str()); return MOD_RES_DENY; } -- cgit v1.2.3 From 1df66532700845a64e9ad2909c55c00bbf1d4e8d Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Tue, 14 Jan 2014 15:01:44 +0100 Subject: m_sajoin Send global snotice when the join happens Remove "sent remote SAJOIN" local snotice Fixes issue #382 reported by @JDowny --- src/modules/m_sajoin.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp index 932b564fa..7ac465732 100644 --- a/src/modules/m_sajoin.cpp +++ b/src/modules/m_sajoin.cpp @@ -65,7 +65,7 @@ class CommandSajoin : public Command { if (n->HasUser(dest)) { - ServerInstance->SNO->WriteToSnoMask('a', user->nick+" used SAJOIN to make "+dest->nick+" join "+parameters[1]); + ServerInstance->SNO->WriteGlobalSno('a', user->nick+" used SAJOIN to make "+dest->nick+" join "+parameters[1]); return CMD_SUCCESS; } else @@ -82,7 +82,6 @@ class CommandSajoin : public Command } else { - ServerInstance->SNO->WriteToSnoMask('a', user->nick+" sent remote SAJOIN to make "+dest->nick+" join "+parameters[1]); return CMD_SUCCESS; } } -- cgit v1.2.3 From 84dc48d1426212ed44f3df3fc88cc64cf0e0f610 Mon Sep 17 00:00:00 2001 From: Daniel Vassdal Date: Sun, 24 Nov 2013 16:46:04 -0800 Subject: Fix OOB error in sa2cidr() --- src/socket.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/socket.cpp b/src/socket.cpp index 6fc7b13f8..a695f8c73 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -264,35 +264,41 @@ bool irc::sockets::sockaddrs::operator==(const irc::sockets::sockaddrs& other) c static void sa2cidr(irc::sockets::cidr_mask& cidr, const irc::sockets::sockaddrs& sa, int range) { const unsigned char* base; + unsigned char target_byte; cidr.type = sa.sa.sa_family; + + memset(cidr.bits, 0, sizeof(cidr.bits)); + if (cidr.type == AF_INET) { + target_byte = sizeof(sa.in4.sin_addr); base = (unsigned char*)&sa.in4.sin_addr; if (range > 32) range = 32; } else if (cidr.type == AF_INET6) { + target_byte = sizeof(sa.in6.sin6_addr); base = (unsigned char*)&sa.in6.sin6_addr; if (range > 128) range = 128; } else { - base = (unsigned char*)""; - range = 0; + cidr.length = 0; + return; } cidr.length = range; unsigned int border = range / 8; unsigned int bitmask = (0xFF00 >> (range & 7)) & 0xFF; - for(unsigned int i=0; i < 16; i++) + for(unsigned int i=0; i < target_byte; i++) { if (i < border) cidr.bits[i] = base[i]; else if (i == border) cidr.bits[i] = base[i] & bitmask; else - cidr.bits[i] = 0; + return; } } -- cgit v1.2.3 From dca19b60efcdd2f5e7c22e830082242fcc7d262a Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Sun, 19 Jan 2014 16:39:46 +0100 Subject: m_alias Fix out of bounds string access that happened with certain replace strings --- src/modules/m_alias.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 25f071bab..32fc80b64 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -320,11 +320,11 @@ class ModuleAlias : public Module for (unsigned int i = 0; i < newline.length(); i++) { char c = newline[i]; - if (c == '$') + if ((c == '$') && (i + 1 < newline.length())) { if (isdigit(newline[i+1])) { - int len = (newline[i+2] == '-') ? 3 : 2; + int len = ((i + 2 < newline.length()) && (newline[i+2] == '-')) ? 3 : 2; std::string var = newline.substr(i, len); result.append(GetVar(var, original_line)); i += len - 1; -- cgit v1.2.3 From 69af56f973b9d31f5ebd7d83e6afedb59bb08c92 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Sun, 19 Jan 2014 16:42:10 +0100 Subject: m_dccallow Increase penalty for /DCCALLOW help --- src/modules/m_dccallow.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index de7b6b7bf..db0b54764 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -223,6 +223,10 @@ class CommandDccallow : public Command user->WriteNumeric(998, "%s : they will be removed from your DCCALLOW list.", user->nick.c_str()); user->WriteNumeric(998, "%s : your DCCALLOW list will be deleted when you leave IRC.", user->nick.c_str()); user->WriteNumeric(999, "%s :End of DCCALLOW HELP", user->nick.c_str()); + + LocalUser* localuser = IS_LOCAL(user); + if (localuser) + localuser->CommandFloodPenalty += 4000; } void DisplayDCCAllowList(User* user) -- cgit v1.2.3 From f75a0d5482a09fffc0cc6cfece80bb2f1e4de815 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Sun, 19 Jan 2014 16:48:41 +0100 Subject: Use FindNickOnly() in a few more places if a local user is performing an action to prevent UID walking --- src/mode.cpp | 26 +++++++++++++++++++++----- src/modules/m_callerid.cpp | 17 ++++++++++++++--- src/modules/m_remove.cpp | 5 ++++- src/modules/m_uninvite.cpp | 7 ++++++- src/modules/m_userip.cpp | 2 +- 5 files changed, 46 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/mode.cpp b/src/mode.cpp index 16751e712..2a32dfac2 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -346,10 +346,19 @@ ModeAction ModeParser::TryMode(User* user, User* targetuser, Channel* chan, bool return MODEACTION_DENY; } - if (mh->GetTranslateType() == TR_NICK && !ServerInstance->FindNick(parameter)) + if (mh->GetTranslateType() == TR_NICK) { - user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel", user->nick.c_str(), parameter.c_str()); - return MODEACTION_DENY; + User* prefixtarget; + if (IS_LOCAL(user)) + prefixtarget = ServerInstance->FindNickOnly(parameter); + else + prefixtarget = ServerInstance->FindNick(parameter); + + if (!prefixtarget) + { + user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel", user->nick.c_str(), parameter.c_str()); + return MODEACTION_DENY; + } } if (mh->GetPrefixRank() && chan) @@ -378,9 +387,16 @@ ModeAction ModeParser::TryMode(User* user, User* targetuser, Channel* chan, bool void ModeParser::Process(const std::vector& parameters, User *user, bool merge) { - std::string target = parameters[0]; + const std::string& target = parameters[0]; Channel* targetchannel = ServerInstance->FindChan(target); - User* targetuser = ServerInstance->FindNick(target); + User* targetuser = NULL; + if (!targetchannel) + { + if (IS_LOCAL(user)) + targetuser = ServerInstance->FindNickOnly(target); + else + targetuser = ServerInstance->FindNick(target); + } ModeType type = targetchannel ? MODETYPE_CHANNEL : MODETYPE_USER; LastParse.clear(); diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index 74428f543..09c5c3f24 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -197,7 +197,7 @@ public: /* Even if callerid mode is not set, we let them manage their ACCEPT list so that if they go +g they can * have a list already setup. */ - std::string tok = parameters[0]; + const std::string& tok = parameters[0]; if (tok == "*") { @@ -207,7 +207,12 @@ public: } else if (tok[0] == '-') { - User* whotoremove = ServerInstance->FindNick(tok.substr(1)); + User* whotoremove; + if (IS_LOCAL(user)) + whotoremove = ServerInstance->FindNickOnly(tok.substr(1)); + else + whotoremove = ServerInstance->FindNick(tok.substr(1)); + if (whotoremove) return (RemoveAccept(user, whotoremove) ? CMD_SUCCESS : CMD_FAILURE); else @@ -215,7 +220,13 @@ public: } else { - User* whotoadd = ServerInstance->FindNick(tok[0] == '+' ? tok.substr(1) : tok); + const std::string target = (tok[0] == '+' ? tok.substr(1) : tok); + User* whotoadd; + if (IS_LOCAL(user)) + whotoadd = ServerInstance->FindNickOnly(target); + else + whotoadd = ServerInstance->FindNick(target); + if ((whotoadd) && (whotoadd->registered == REG_ALL) && (!whotoadd->quitting) && (!IS_SERVER(whotoadd))) return (AddAccept(user, whotoadd) ? CMD_SUCCESS : CMD_FAILURE); else diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index 86f50ad62..cf139f4a3 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -63,7 +63,10 @@ class RemoveBase : public Command const std::string& username = parameters[neworder ? 1 : 0]; /* Look up the user we're meant to be removing from the channel */ - target = ServerInstance->FindNick(username); + if (IS_LOCAL(user)) + target = ServerInstance->FindNickOnly(username); + else + target = ServerInstance->FindNick(username); /* And the channel we're meant to be removing them from */ channel = ServerInstance->FindChan(channame); diff --git a/src/modules/m_uninvite.cpp b/src/modules/m_uninvite.cpp index 10fd7c7b6..ff392edc3 100644 --- a/src/modules/m_uninvite.cpp +++ b/src/modules/m_uninvite.cpp @@ -37,7 +37,12 @@ class CommandUninvite : public Command CmdResult Handle (const std::vector ¶meters, User *user) { - User* u = ServerInstance->FindNick(parameters[0]); + User* u; + if (IS_LOCAL(user)) + u = ServerInstance->FindNickOnly(parameters[0]); + else + u = ServerInstance->FindNick(parameters[0]); + Channel* c = ServerInstance->FindChan(parameters[1]); if ((!c) || (!u) || (u->registered != REG_ALL)) diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp index 5ea84c04a..33b261ca1 100644 --- a/src/modules/m_userip.cpp +++ b/src/modules/m_userip.cpp @@ -42,7 +42,7 @@ class CommandUserip : public Command for (int i = 0; i < (int)parameters.size(); i++) { - User *u = ServerInstance->FindNick(parameters[i]); + User *u = ServerInstance->FindNickOnly(parameters[i]); if ((u) && (u->registered == REG_ALL)) { // Anyone may query their own IP -- cgit v1.2.3 From 0f91b6173b506332ee5f771f35698f6815a11f6a Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Sun, 19 Jan 2014 17:04:11 +0100 Subject: m_joinflood Fix remote joins affecting local joinflood state when the channel is locked Fixes issue #694 reported by @TurkDesk --- src/modules/m_joinflood.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp index 0c68da1fb..40f7f1ba9 100644 --- a/src/modules/m_joinflood.cpp +++ b/src/modules/m_joinflood.cpp @@ -231,7 +231,7 @@ class ModuleJoinFlood : public Module joinfloodsettings *f = jf.ext.get(memb->chan); /* But all others are OK */ - if (f) + if ((f) && (!f->islocked())) { f->addjoin(); if (f->shouldlock()) -- cgit v1.2.3 From 3bf44246023cba92ce68445ff7be6f4690079a46 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Mon, 20 Jan 2014 16:30:39 +0100 Subject: m_dnsbl Don't send snotice when the {G|K|Z}line already exists Fixes issue #717 reported by @Robby- --- src/modules/m_dnsbl.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 3a9360380..d4101686a 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -141,7 +141,10 @@ class DNSBLResolver : public Resolver ServerInstance->XLines->ApplyLines(); } else + { delete kl; + return; + } break; } case DNSBLConfEntry::I_GLINE: @@ -156,7 +159,10 @@ class DNSBLResolver : public Resolver ServerInstance->XLines->ApplyLines(); } else + { delete gl; + return; + } break; } case DNSBLConfEntry::I_ZLINE: @@ -171,7 +177,10 @@ class DNSBLResolver : public Resolver ServerInstance->XLines->ApplyLines(); } else + { delete zl; + return; + } break; } case DNSBLConfEntry::I_UNKNOWN: -- cgit v1.2.3 From 44301db24589223e10fc898fb3ca6ec9f57a9bd5 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Mon, 20 Jan 2014 16:40:01 +0100 Subject: m_services_account Add workaround for wrong host being displayed in numeric when cgiirc users log in using SASL --- src/modules/m_services_account.cpp | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index a139087a5..154968e9e 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -114,6 +114,24 @@ class ModuleServicesAccount : public Module AccountExtItem accountname; bool checking_ban; + static bool ReadCGIIRCExt(const char* extname, User* user, const std::string*& out) + { + ExtensionItem* wiext = ServerInstance->Extensions.GetItem(extname); + if (!wiext) + return false; + + if (wiext->creator->ModuleSourceFile != "m_cgiirc.so") + return false; + + StringExtItem* stringext = static_cast(wiext); + std::string* addr = stringext->get(user); + if (!addr) + return false; + + out = addr; + return true; + } + public: ModuleServicesAccount() : m1(this), m2(this), m3(this), m4(this), m5(this), accountname("accountname", this), checking_ban(false) @@ -282,8 +300,19 @@ class ModuleServicesAccount : public Module trim(*account); if (IS_LOCAL(dest)) - dest->WriteNumeric(900, "%s %s %s :You are now logged in as %s", - dest->nick.c_str(), dest->GetFullHost().c_str(), account->c_str(), account->c_str()); + { + const std::string* host = &dest->dhost; + if (dest->registered != REG_ALL) + { + if (!ReadCGIIRCExt("cgiirc_webirc_hostname", dest, host)) + { + ReadCGIIRCExt("cgiirc_webirc_ip", dest, host); + } + } + + dest->WriteNumeric(900, "%s %s!%s@%s %s :You are now logged in as %s", + dest->nick.c_str(), dest->nick.c_str(), dest->ident.c_str(), host->c_str(), account->c_str(), account->c_str()); + } AccountEvent(this, dest, *account).Send(); } -- cgit v1.2.3 From ef264e2dca03126e1ea38ee05594bd015384622b Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Mon, 20 Jan 2014 16:57:30 +0100 Subject: m_httpd Add timeout option; remove timed out connections --- docs/conf/modules.conf.example | 3 +++ src/modules/m_httpd.cpp | 32 +++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/docs/conf/modules.conf.example b/docs/conf/modules.conf.example index b65a0ca02..09a8514a4 100644 --- a/docs/conf/modules.conf.example +++ b/docs/conf/modules.conf.example @@ -870,6 +870,9 @@ # a tag with type "httpd", and load at least one of the other # m_httpd_* modules to provide pages to display. # +# You can adjust the timeout for HTTP connections below. All HTTP +# connections will be closed after (roughly) this many seconds. +# #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # http ACL module: Provides access control lists for m_httpd dependent diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index 6315809a9..a853e12c2 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -59,9 +59,11 @@ class HttpServerSocket : public BufferedSocket std::string http_version; public: + const time_t createtime; HttpServerSocket(int newfd, const std::string& IP, ListenSocket* via, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server) : BufferedSocket(newfd), ip(IP), postsize(0) + , createtime(ServerInstance->Time()) { InternalState = HTTP_SERVE_WAIT_REQUEST; @@ -339,12 +341,22 @@ class HttpServerSocket : public BufferedSocket class ModuleHttpServer : public Module { + unsigned int timeoutsec; + public: void init() { HttpModule = this; - ServerInstance->Modules->Attach(I_OnAcceptConnection, this); + Implementation eventlist[] = { I_OnAcceptConnection, I_OnBackgroundTimer, I_OnRehash }; + ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); + OnRehash(NULL); + } + + void OnRehash(User* user) + { + ConfigTag* tag = ServerInstance->Config->ConfValue("httpd"); + timeoutsec = tag->getInt("timeout"); } void OnRequest(Request& request) @@ -367,6 +379,24 @@ class ModuleHttpServer : public Module return MOD_RES_ALLOW; } + void OnBackgroundTimer(time_t curtime) + { + if (!timeoutsec) + return; + + time_t oldest_allowed = curtime - timeoutsec; + for (std::set::const_iterator i = sockets.begin(); i != sockets.end(); ) + { + HttpServerSocket* sock = *i; + ++i; + if (sock->createtime < oldest_allowed) + { + sock->cull(); + delete sock; + } + } + } + CullResult cull() { std::set local; -- cgit v1.2.3 From b8f0e349ce8891d6236fc026c47139af1f05912c Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Mon, 20 Jan 2014 17:05:01 +0100 Subject: m_svshold Add config option to hide snotices --- docs/conf/modules.conf.example | 2 ++ src/modules/m_svshold.cpp | 27 +++++++++++++++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/docs/conf/modules.conf.example b/docs/conf/modules.conf.example index 09a8514a4..e9304f390 100644 --- a/docs/conf/modules.conf.example +++ b/docs/conf/modules.conf.example @@ -1776,6 +1776,8 @@ # SVSHold module: Implements SVSHOLD. Like Q:Lines, but can only be # # added/removed by Services. # # +# If silent is true no snotices will be generated by SVSHOLD. +# #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # SWHOIS module: Allows you to add arbitary lines to user WHOIS. diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp index d8176043e..e666b0fe2 100644 --- a/src/modules/m_svshold.cpp +++ b/src/modules/m_svshold.cpp @@ -25,6 +25,11 @@ /* $ModDesc: Implements SVSHOLD. Like Q:Lines, but can only be added/removed by Services. */ +namespace +{ + bool silent; +} + /** Holds a SVSHold item */ class SVSHold : public XLine @@ -58,8 +63,11 @@ public: void DisplayExpiry() { - ServerInstance->SNO->WriteToSnoMask('x',"Removing expired SVSHOLD %s (set by %s %ld seconds ago)", - this->nickname.c_str(), this->source.c_str(), (long int)(ServerInstance->Time() - this->set_time)); + if (!silent) + { + ServerInstance->SNO->WriteToSnoMask('x',"Removing expired SVSHOLD %s (set by %s %ld seconds ago)", + this->nickname.c_str(), this->source.c_str(), (long int)(ServerInstance->Time() - this->set_time)); + } } const char* Displayable() @@ -114,7 +122,8 @@ class CommandSvshold : public Command { if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "SVSHOLD", user)) { - ServerInstance->SNO->WriteToSnoMask('x',"%s removed SVSHOLD on %s",user->nick.c_str(),parameters[0].c_str()); + if (!silent) + ServerInstance->SNO->WriteToSnoMask('x',"%s removed SVSHOLD on %s",user->nick.c_str(),parameters[0].c_str()); } else { @@ -132,6 +141,9 @@ class CommandSvshold : public Command if (ServerInstance->XLines->AddLine(r, user)) { + if (silent) + return CMD_SUCCESS; + if (!duration) { ServerInstance->SNO->WriteGlobalSno('x', "%s added permanent SVSHOLD for %s: %s", user->nick.c_str(), parameters[0].c_str(), parameters[2].c_str()); @@ -174,8 +186,15 @@ class ModuleSVSHold : public Module { ServerInstance->XLines->RegisterFactory(&s); ServerInstance->Modules->AddService(cmd); - Implementation eventlist[] = { I_OnUserPreNick, I_OnStats }; + Implementation eventlist[] = { I_OnUserPreNick, I_OnStats, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); + OnRehash(NULL); + } + + void OnRehash(User* user) + { + ConfigTag* tag = ServerInstance->Config->ConfValue("svshold"); + silent = tag->getBool("silent"); } virtual ModResult OnStats(char symbol, User* user, string_list &out) -- cgit v1.2.3 From d0a472641b7c77fe5f40a6affb62de67be2ee888 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Wed, 11 Dec 2013 05:05:36 +0000 Subject: Fix some logically dead code which was found by Coverity. --- src/channels.cpp | 12 ++---------- src/modules/m_joinflood.cpp | 15 ++++----------- src/users.cpp | 16 +++------------- 3 files changed, 9 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/channels.cpp b/src/channels.cpp index b5132c8b3..c546e68db 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -116,16 +116,8 @@ int Channel::SetTopic(User *u, std::string &ntopic, bool forceset) } this->topic.assign(ntopic, 0, ServerInstance->Config->Limits.MaxTopic); - if (u) - { - this->setby.assign(ServerInstance->Config->FullHostInTopic ? u->GetFullHost() : u->nick, 0, 128); - this->WriteChannel(u, "TOPIC %s :%s", this->name.c_str(), this->topic.c_str()); - } - else - { - this->setby.assign(ServerInstance->Config->ServerName); - this->WriteChannelWithServ(ServerInstance->Config->ServerName, "TOPIC %s :%s", this->name.c_str(), this->topic.c_str()); - } + this->setby.assign(ServerInstance->Config->FullHostInTopic ? u->GetFullHost() : u->nick, 0, 128); + this->WriteChannel(u, "TOPIC %s :%s", this->name.c_str(), this->topic.c_str()); this->topicset = ServerInstance->Time(); diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp index 40f7f1ba9..4524a93c0 100644 --- a/src/modules/m_joinflood.cpp +++ b/src/modules/m_joinflood.cpp @@ -153,17 +153,10 @@ class JoinFlood : public ModeHandler else { // new mode param, replace old with new - if ((nsecs > 0) && (njoins > 0)) - { - f = new joinfloodsettings(nsecs, njoins); - ext.set(channel, f); - channel->SetModeParam('j', parameter); - return MODEACTION_ALLOW; - } - else - { - return MODEACTION_DENY; - } + f = new joinfloodsettings(nsecs, njoins); + ext.set(channel, f); + channel->SetModeParam('j', parameter); + return MODEACTION_ALLOW; } } } diff --git a/src/users.cpp b/src/users.cpp index 6b2432cc4..573d4db90 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -1549,7 +1549,7 @@ void User::SplitChanList(User* dest, const std::string &cl) { std::string line; std::ostringstream prefix; - std::string::size_type start, pos, length; + std::string::size_type start, pos; prefix << this->nick << " " << dest->nick << " :"; line = prefix.str(); @@ -1557,23 +1557,13 @@ void User::SplitChanList(User* dest, const std::string &cl) for (start = 0; (pos = cl.find(' ', start)) != std::string::npos; start = pos+1) { - length = (pos == std::string::npos) ? cl.length() : pos; - - if (line.length() + namelen + length - start > 510) + if (line.length() + namelen + pos - start > 510) { ServerInstance->SendWhoisLine(this, dest, 319, "%s", line.c_str()); line = prefix.str(); } - if(pos == std::string::npos) - { - line.append(cl.substr(start, length - start)); - break; - } - else - { - line.append(cl.substr(start, length - start + 1)); - } + line.append(cl.substr(start, pos - start + 1)); } if (line.length() != prefix.str().length()) -- cgit v1.2.3 From e1d0503a760bc6f43804e2212d997d6bee22cfa2 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Tue, 21 Jan 2014 00:44:41 +0100 Subject: m_joinflood Unset the mode on unload --- src/modules/m_joinflood.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp index 4524a93c0..63bcc38a4 100644 --- a/src/modules/m_joinflood.cpp +++ b/src/modules/m_joinflood.cpp @@ -169,8 +169,7 @@ class JoinFlood : public ModeHandler } else { - joinfloodsettings* f = ext.get(channel); - if (f) + if (channel->IsModeSet('j')) { ext.unset(channel); channel->SetModeParam('j', ""); -- cgit v1.2.3 From ed57ffc4febceeb30da35a37ac0b0c386234dd3b Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Tue, 21 Jan 2014 14:04:45 +0100 Subject: Increase the penalty for a few core commands --- src/commands/cmd_admin.cpp | 7 ++++++- src/commands/cmd_commands.cpp | 6 +++++- src/commands/cmd_info.cpp | 7 ++++++- src/commands/cmd_modules.cpp | 7 ++++++- 4 files changed, 23 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/commands/cmd_admin.cpp b/src/commands/cmd_admin.cpp index 3a3eed346..0d6c235f0 100644 --- a/src/commands/cmd_admin.cpp +++ b/src/commands/cmd_admin.cpp @@ -30,7 +30,12 @@ class CommandAdmin : public Command public: /** Constructor for admin. */ - CommandAdmin(Module* parent) : Command(parent,"ADMIN",0,0) { syntax = "[]"; } + CommandAdmin(Module* parent) : Command(parent,"ADMIN",0,0) + { + Penalty = 2; + syntax = "[]"; + } + /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/commands/cmd_commands.cpp b/src/commands/cmd_commands.cpp index 36408b363..1555b4d04 100644 --- a/src/commands/cmd_commands.cpp +++ b/src/commands/cmd_commands.cpp @@ -30,7 +30,11 @@ class CommandCommands : public Command public: /** Constructor for commands. */ - CommandCommands ( Module* parent) : Command(parent,"COMMANDS",0,0) { } + CommandCommands(Module* parent) : Command(parent,"COMMANDS",0,0) + { + Penalty = 3; + } + /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/commands/cmd_info.cpp b/src/commands/cmd_info.cpp index 6e5f2a909..76e414b19 100644 --- a/src/commands/cmd_info.cpp +++ b/src/commands/cmd_info.cpp @@ -32,7 +32,12 @@ class CommandInfo : public Command public: /** Constructor for info. */ - CommandInfo ( Module* parent) : Command(parent,"INFO") { syntax = "[]"; } + CommandInfo(Module* parent) : Command(parent,"INFO") + { + Penalty = 4; + syntax = "[]"; + } + /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/commands/cmd_modules.cpp b/src/commands/cmd_modules.cpp index e21df9b08..2a15b43ed 100644 --- a/src/commands/cmd_modules.cpp +++ b/src/commands/cmd_modules.cpp @@ -31,7 +31,12 @@ class CommandModules : public Command public: /** Constructor for modules. */ - CommandModules ( Module* parent) : Command(parent,"MODULES",0,0) { syntax = "[server]"; } + CommandModules(Module* parent) : Command(parent,"MODULES",0,0) + { + Penalty = 4; + syntax = "[]"; + } + /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command -- cgit v1.2.3 From dca7232d63f3d7d69ea38f0d2ad7337c12803bf3 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Tue, 21 Jan 2014 14:10:01 +0100 Subject: m_httpd_stats Be more conservative when escaping data Fix clang warning --- src/modules/m_httpd_stats.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index 547d6032f..2fc7ca7de 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -55,8 +55,7 @@ class ModuleHttpStats : public Module ret += it->second; ret += ';'; } - else if (*x == 0x9 || *x == 0xA || *x == 0xD || - (*x >= 0x20 && *x <= 0xD7FF) || (*x >= 0xE000 && *x <= 0x10FFFF)) + else if (*x == 0x09 || *x == 0x0A || *x == 0x0D || ((*x >= 0x20) && (*x <= 0x7e))) { // The XML specification defines the following characters as valid inside an XML document: // Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] -- cgit v1.2.3 From 7dd831383f7506e49f568d0684ee1ecb1f5dc90f Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Tue, 21 Jan 2014 14:13:25 +0100 Subject: Release 2.0.15 --- 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 99d0d81d6..0410bd522 100755 --- a/src/version.sh +++ b/src/version.sh @@ -1,2 +1,2 @@ #!/bin/sh -echo "InspIRCd-2.0.14" +echo "InspIRCd-2.0.15" -- cgit v1.2.3