From 1a738eb97eb7ac62b7d28bd40b03969d175ee6e3 Mon Sep 17 00:00:00 2001 From: w00t Date: Mon, 27 Oct 2008 22:29:56 +0000 Subject: Add user/channel mode synchronisation detection to CAPAB - link will now drop if modes differ in some way (one side requires param, other doesn't, etc). Same for user modes. This will not affect services. Side effect: Modes::ChanModes() -> Modes::GiveModeList(ModeMasks), mode list is formatted identically for both MASK_CHANNEL and MASK_USER. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10733 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree/capab.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/modules/m_spanningtree/capab.cpp') diff --git a/src/modules/m_spanningtree/capab.cpp b/src/modules/m_spanningtree/capab.cpp index 8b02b9545..e8fe75177 100644 --- a/src/modules/m_spanningtree/capab.cpp +++ b/src/modules/m_spanningtree/capab.cpp @@ -95,7 +95,8 @@ void TreeSocket::SendCapabilities() " IP6SUPPORT="+ConvToStr(ip6support)+ " PROTOCOL="+ConvToStr(ProtocolVersion)+extra+ " PREFIX="+ServerInstance->Modes->BuildPrefixes()+ - " CHANMODES="+ServerInstance->Modes->ChanModes()+ + " CHANMODES="+ServerInstance->Modes->GiveModeList(MASK_CHANNEL)+ + " USERMODES="+ServerInstance->Modes->GiveModeList(MASK_USER)+ " SVSPART=1"); this->WriteLine("CAPAB END"); @@ -186,9 +187,18 @@ bool TreeSocket::Capab(const std::deque ¶ms) if(this->CapKeys.find("PREFIX") != this->CapKeys.end() && this->CapKeys.find("PREFIX")->second != this->ServerInstance->Modes->BuildPrefixes()) reason = "One or more of the prefixes on the remote server are invalid on this server."; + if(this->CapKeys.find("CHANMODES") != this->CapKeys.end() && this->CapKeys.find("CHANMODES")->second != this->ServerInstance->Modes->GiveModeList(MASK_CHANNEL)) + reason = "One or more of the channel modes on the remote server are invalid on this server."; + + if(this->CapKeys.find("USERMODES") != this->CapKeys.end() && this->CapKeys.find("USERMODES")->second != this->ServerInstance->Modes->GiveModeList(MASK_USER)) + reason = "One or more of the user modes on the remote server are invalid on this server."; + + if (((this->CapKeys.find("HALFOP") == this->CapKeys.end()) && (ServerInstance->Config->AllowHalfop)) || ((this->CapKeys.find("HALFOP") != this->CapKeys.end()) && (this->CapKeys.find("HALFOP")->second != ConvToStr(ServerInstance->Config->AllowHalfop)))) reason = "We don't both have halfop support enabled/disabled identically"; + + /* Challenge response, store their challenge for our password */ std::map::iterator n = this->CapKeys.find("CHALLENGE"); if (Utils->ChallengeResponse && (n != this->CapKeys.end()) && (ServerInstance->Modules->Find("m_sha256.so"))) -- cgit v1.3.1-10-gc9f91