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/modules/m_spanningtree') 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 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/modules/m_spanningtree') 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/modules/m_spanningtree') 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/modules/m_spanningtree') 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 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/modules/m_spanningtree') 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