aboutsummaryrefslogtreecommitdiff
path: root/net/znc/patches
diff options
context:
space:
mode:
authorJonas Gorski <jogo@openwrt.org>2015-06-19 13:07:17 +0200
committerJonas Gorski <jogo@openwrt.org>2015-06-19 13:10:19 +0200
commite49e86e036923e05822edca86fcf21f7581631ce (patch)
tree19745843d6bea4109ced331d54a263dbafb469b3 /net/znc/patches
parenta9277215a945690d9fd235ce7999d756be9060a7 (diff)
znc: update to 1.6.0
Fixes compilation with musl. Requires GCC 4.7 or newer, so broken for octeon. Signed-off-by: Jonas Gorski <jogo@openwrt.org>
Diffstat (limited to 'net/znc/patches')
-rw-r--r--net/znc/patches/001-fix-savebuff-timer-initialization.patch28
-rw-r--r--net/znc/patches/002-CThreadPool-Handle-spurious-wakeups.patch33
-rw-r--r--net/znc/patches/003-Fix-CIRCNetwork-FindChans-and-FindQueries-to-be-case.patch149
-rw-r--r--net/znc/patches/004-Fix-chansaver-loading.patch38
-rw-r--r--net/znc/patches/005-Fix-rare-conflict-of-HTTP-Basic-auth-and-cookies.patch36
-rw-r--r--net/znc/patches/006-Fix-954-Startup-failure-when-simple_away-is-loaded-a.patch24
-rw-r--r--net/znc/patches/100-move_rootcheck_after_config.patch (renamed from net/znc/patches/001-move_rootcheck_after_config.patch)16
-rw-r--r--net/znc/patches/101-Reduce_rebuild_time.patch (renamed from net/znc/patches/003-Reduce_rebuild_time.patch)19
-rw-r--r--net/znc/patches/102-restore_droproot.patch (renamed from net/znc/patches/004-restore_droproot.patch)0
9 files changed, 326 insertions, 17 deletions
diff --git a/net/znc/patches/001-fix-savebuff-timer-initialization.patch b/net/znc/patches/001-fix-savebuff-timer-initialization.patch
new file mode 100644
index 000000000..5299ca859
--- /dev/null
+++ b/net/znc/patches/001-fix-savebuff-timer-initialization.patch
@@ -0,0 +1,28 @@
+From d6feb6f574933753371687ee42fa19d0b0d8d777 Mon Sep 17 00:00:00 2001
+From: Thomas Kriechbaumer <kriechbaumer@gmail.com>
+Date: Tue, 17 Feb 2015 10:08:30 +0000
+Subject: [PATCH] fix savebuff timer initialization
+
+closes #868
+---
+ modules/savebuff.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/modules/savebuff.cpp
++++ b/modules/savebuff.cpp
+@@ -93,13 +93,13 @@ public:
+ else
+ m_sPassword = CBlowfish::MD5(sArgs);
+
++ AddTimer(new CSaveBuffJob(this, 60, 0, "SaveBuff", "Saves the current buffer to disk every 1 minute"));
++
+ return( !m_bBootError );
+ }
+
+ virtual bool OnBoot() override
+ {
+- AddTimer(new CSaveBuffJob(this, 60, 0, "SaveBuff", "Saves the current buffer to disk every 1 minute"));
+-
+ CDir saveDir(GetSavePath());
+ for (CFile* pFile : saveDir) {
+ CString sName;
diff --git a/net/znc/patches/002-CThreadPool-Handle-spurious-wakeups.patch b/net/znc/patches/002-CThreadPool-Handle-spurious-wakeups.patch
new file mode 100644
index 000000000..1377307a1
--- /dev/null
+++ b/net/znc/patches/002-CThreadPool-Handle-spurious-wakeups.patch
@@ -0,0 +1,33 @@
+From 2f4488c2a4f2d6b130ded560efa06680bfd8a185 Mon Sep 17 00:00:00 2001
+From: Uli Schlachter <psychon@znc.in>
+Date: Sat, 14 Feb 2015 19:41:26 +0100
+Subject: [PATCH] ~CThreadPool(): Handle spurious wakeups
+
+From pthread_cond_wait()'s man page:
+
+ When using condition variables there is always a boolean predicate involving
+ shared variables associated with each condition wait that is true if the
+ thread should proceed. Spurious wakeups from the pthread_cond_wait() or
+ pthread_cond_timedwait() functions may occur. Since the return from
+ pthread_cond_wait() or pthread_cond_timedwait() does not imply anything about
+ the value of this predicate, the predicate should be re-evaluated upon such
+ return.
+
+Fix ~CThreadPool() to account for this possibility.
+
+Signed-off-by: Uli Schlachter <psychon@znc.in>
+---
+ src/Threads.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/src/Threads.cpp
++++ b/src/Threads.cpp
+@@ -87,7 +87,7 @@ CThreadPool::~CThreadPool() {
+ CMutexLocker guard(m_mutex);
+ m_done = true;
+
+- if (m_num_threads > 0) {
++ while (m_num_threads > 0) {
+ m_cond.broadcast();
+ m_exit_cond.wait(m_mutex);
+ }
diff --git a/net/znc/patches/003-Fix-CIRCNetwork-FindChans-and-FindQueries-to-be-case.patch b/net/znc/patches/003-Fix-CIRCNetwork-FindChans-and-FindQueries-to-be-case.patch
new file mode 100644
index 000000000..d5ad3df75
--- /dev/null
+++ b/net/znc/patches/003-Fix-CIRCNetwork-FindChans-and-FindQueries-to-be-case.patch
@@ -0,0 +1,149 @@
+From e10b53b87bb7ce87d1a31473e03a02ccafa78787 Mon Sep 17 00:00:00 2001
+From: J-P Nurmi <jpnurmi@gmail.com>
+Date: Tue, 3 Feb 2015 10:11:47 +0100
+Subject: [PATCH] Fix CIRCNetwork::FindChans() and FindQueries() to be
+ case-insensitive
+
+The playback module failed to clear a buffer, because it tried to
+clear "NickServ" whereas ZNC had internally stored it has "nickserv".
+---
+ Makefile.in | 2 +-
+ src/IRCNetwork.cpp | 6 ++--
+ test/NetworkTest.cpp | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 101 insertions(+), 3 deletions(-)
+ create mode 100644 test/NetworkTest.cpp
+
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -48,7 +48,7 @@ LIB_SRCS := $(addprefix src/,$(LIB_SRCS
+ BIN_SRCS := src/main.cpp
+ LIB_OBJS := $(patsubst %cpp,%o,$(LIB_SRCS))
+ BIN_OBJS := $(patsubst %cpp,%o,$(BIN_SRCS))
+-TESTS := StringTest ConfigTest UtilsTest ThreadTest NickTest ClientTest
++TESTS := StringTest ConfigTest UtilsTest ThreadTest NickTest ClientTest NetworkTest
+ TESTS := $(addprefix test/,$(addsuffix .o,$(TESTS)))
+ CLEAN := znc src/*.o test/*.o core core.* .version_extra .depend modules/.depend unittest
+ DISTCLEAN := Makefile config.log config.status znc-buildmod \
+--- a/src/IRCNetwork.cpp
++++ b/src/IRCNetwork.cpp
+@@ -787,8 +787,9 @@ CChan* CIRCNetwork::FindChan(CString sNa
+ std::vector<CChan*> CIRCNetwork::FindChans(const CString& sWild) const {
+ std::vector<CChan*> vChans;
+ vChans.reserve(m_vChans.size());
++ const CString sLower = sWild.AsLower();
+ for (std::vector<CChan*>::const_iterator it = m_vChans.begin(); it != m_vChans.end(); ++it) {
+- if ((*it)->GetName().WildCmp(sWild))
++ if ((*it)->GetName().AsLower().WildCmp(sLower))
+ vChans.push_back(*it);
+ }
+ return vChans;
+@@ -946,8 +947,9 @@ CQuery* CIRCNetwork::FindQuery(const CSt
+ std::vector<CQuery*> CIRCNetwork::FindQueries(const CString& sWild) const {
+ std::vector<CQuery*> vQueries;
+ vQueries.reserve(m_vQueries.size());
++ const CString sLower = sWild.AsLower();
+ for (std::vector<CQuery*>::const_iterator it = m_vQueries.begin(); it != m_vQueries.end(); ++it) {
+- if ((*it)->GetName().WildCmp(sWild))
++ if ((*it)->GetName().AsLower().WildCmp(sLower))
+ vQueries.push_back(*it);
+ }
+ return vQueries;
+--- /dev/null
++++ b/test/NetworkTest.cpp
+@@ -0,0 +1,96 @@
++/*
++ * Copyright (C) 2004-2015 ZNC, see the NOTICE file for details.
++ *
++ * Licensed under the Apache License, Version 2.0 (the "License");
++ * you may not use this file except in compliance with the License.
++ * You may obtain a copy of the License at
++ *
++ * http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++
++#include <gtest/gtest.h>
++#include <znc/IRCNetwork.h>
++#include <znc/User.h>
++#include <znc/znc.h>
++
++class NetworkTest : public ::testing::Test {
++protected:
++ void SetUp() { CZNC::CreateInstance(); }
++ void TearDown() { CZNC::DestroyInstance(); }
++};
++
++TEST_F(NetworkTest, FindChan) {
++ CUser user("user");
++ CIRCNetwork network(&user, "network");
++
++ EXPECT_TRUE(network.AddChan("#foo", false));
++ EXPECT_TRUE(network.AddChan("#Bar", false));
++ EXPECT_TRUE(network.AddChan("#BAZ", false));
++
++ EXPECT_TRUE(network.FindChan("#foo"));
++ EXPECT_TRUE(network.FindChan("#Bar"));
++ EXPECT_TRUE(network.FindChan("#BAZ"));
++
++ EXPECT_TRUE(network.FindChan("#Foo"));
++ EXPECT_TRUE(network.FindChan("#BAR"));
++ EXPECT_TRUE(network.FindChan("#baz"));
++
++ EXPECT_FALSE(network.FindChan("#f"));
++ EXPECT_FALSE(network.FindChan("&foo"));
++ EXPECT_FALSE(network.FindChan("##foo"));
++}
++
++TEST_F(NetworkTest, FindChans) {
++ CUser user("user");
++ CIRCNetwork network(&user, "network");
++
++ EXPECT_TRUE(network.AddChan("#foo", false));
++ EXPECT_TRUE(network.AddChan("#Bar", false));
++ EXPECT_TRUE(network.AddChan("#BAZ", false));
++
++ EXPECT_EQ(network.FindChans("#f*").size(), 1);
++ EXPECT_EQ(network.FindChans("#b*").size(), 2);
++ EXPECT_EQ(network.FindChans("#?A*").size(), 2);
++ EXPECT_EQ(network.FindChans("*z").size(), 1);
++}
++
++TEST_F(NetworkTest, FindQuery) {
++ CUser user("user");
++ CIRCNetwork network(&user, "network");
++
++ EXPECT_TRUE(network.AddQuery("foo"));
++ EXPECT_TRUE(network.AddQuery("Bar"));
++ EXPECT_TRUE(network.AddQuery("BAZ"));
++
++ EXPECT_TRUE(network.FindQuery("foo"));
++ EXPECT_TRUE(network.FindQuery("Bar"));
++ EXPECT_TRUE(network.FindQuery("BAZ"));
++
++ EXPECT_TRUE(network.FindQuery("Foo"));
++ EXPECT_TRUE(network.FindQuery("BAR"));
++ EXPECT_TRUE(network.FindQuery("baz"));
++
++ EXPECT_FALSE(network.FindQuery("f"));
++ EXPECT_FALSE(network.FindQuery("fo"));
++ EXPECT_FALSE(network.FindQuery("FF"));
++}
++
++TEST_F(NetworkTest, FindQueries) {
++ CUser user("user");
++ CIRCNetwork network(&user, "network");
++
++ EXPECT_TRUE(network.AddQuery("foo"));
++ EXPECT_TRUE(network.AddQuery("Bar"));
++ EXPECT_TRUE(network.AddQuery("BAZ"));
++
++ EXPECT_EQ(network.FindQueries("f*").size(), 1);
++ EXPECT_EQ(network.FindQueries("b*").size(), 2);
++ EXPECT_EQ(network.FindQueries("?A*").size(), 2);
++ EXPECT_EQ(network.FindQueries("*z").size(), 1);
++}
diff --git a/net/znc/patches/004-Fix-chansaver-loading.patch b/net/znc/patches/004-Fix-chansaver-loading.patch
new file mode 100644
index 000000000..b0f2690af
--- /dev/null
+++ b/net/znc/patches/004-Fix-chansaver-loading.patch
@@ -0,0 +1,38 @@
+From 7e75018ba60a9f50ea9e936eb1b6eb6b44dbc668 Mon Sep 17 00:00:00 2001
+From: J-P Nurmi <jpnurmi@gmail.com>
+Date: Sat, 28 Feb 2015 21:15:23 +0100
+Subject: [PATCH] Fix chansaver loading
+
+CModules::LoadModule() sets the module type _after_ construction.
+The constructor cannot therefore do actions based on the module
+type. Move loading to OnLoad().
+---
+ modules/chansaver.cpp | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+--- a/modules/chansaver.cpp
++++ b/modules/chansaver.cpp
+@@ -21,6 +21,12 @@
+ class CChanSaverMod : public CModule {
+ public:
+ MODCONSTRUCTOR(CChanSaverMod) {
++ }
++
++ virtual ~CChanSaverMod() {
++ }
++
++ bool OnLoad(const CString& sArgsi, CString& sMessage) override {
+ switch (GetType()) {
+ case CModInfo::GlobalModule:
+ LoadUsers();
+@@ -32,9 +38,7 @@ public:
+ LoadNetwork(GetNetwork());
+ break;
+ }
+- }
+-
+- virtual ~CChanSaverMod() {
++ return true;
+ }
+
+ void LoadUsers() {
diff --git a/net/znc/patches/005-Fix-rare-conflict-of-HTTP-Basic-auth-and-cookies.patch b/net/znc/patches/005-Fix-rare-conflict-of-HTTP-Basic-auth-and-cookies.patch
new file mode 100644
index 000000000..d635e78bb
--- /dev/null
+++ b/net/znc/patches/005-Fix-rare-conflict-of-HTTP-Basic-auth-and-cookies.patch
@@ -0,0 +1,36 @@
+From 13c2dc126d8bb4c57273178fc455dab6f02e1efc Mon Sep 17 00:00:00 2001
+From: Alexey Sokolov <alexey+znc@asokolov.org>
+Date: Thu, 16 Apr 2015 01:21:57 +0100
+Subject: [PATCH] Fix rare conflict of HTTP-Basic auth and cookies.
+
+Fix #946
+---
+ src/HTTPSock.cpp | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+--- a/src/HTTPSock.cpp
++++ b/src/HTTPSock.cpp
+@@ -122,7 +122,7 @@ void CHTTPSock::ReadLine(const CString&
+ sLine.Token(2).Base64Decode(sUnhashed);
+ m_sUser = sUnhashed.Token(0, false, ":");
+ m_sPass = sUnhashed.Token(1, true, ":");
+- m_bLoggedIn = OnLogin(m_sUser, m_sPass, true);
++ // Postpone authorization attempt until end of headers, because cookies should be read before that, otherwise session id will be overwritten in GetSession()
+ } else if (sName.Equals("Content-Length:")) {
+ m_uPostLen = sLine.Token(1).ToULong();
+ if (m_uPostLen > MAX_POST_SIZE)
+@@ -170,6 +170,14 @@ void CHTTPSock::ReadLine(const CString&
+ } else if (sLine.empty()) {
+ m_bGotHeader = true;
+
++ if (!m_sUser.empty()) {
++ m_bLoggedIn = OnLogin(m_sUser, m_sPass, true);
++ if (!m_bLoggedIn) {
++ // Error message already was sent
++ return;
++ }
++ }
++
+ if (m_bPost) {
+ m_sPostData = GetInternalReadBuffer();
+ CheckPost();
diff --git a/net/znc/patches/006-Fix-954-Startup-failure-when-simple_away-is-loaded-a.patch b/net/znc/patches/006-Fix-954-Startup-failure-when-simple_away-is-loaded-a.patch
new file mode 100644
index 000000000..ab0429357
--- /dev/null
+++ b/net/znc/patches/006-Fix-954-Startup-failure-when-simple_away-is-loaded-a.patch
@@ -0,0 +1,24 @@
+From 703a244b9b8c1b4af02a6132c5c70a748d98e3f8 Mon Sep 17 00:00:00 2001
+From: J-P Nurmi <jpnurmi@gmail.com>
+Date: Tue, 28 Apr 2015 10:00:55 +0200
+Subject: [PATCH] Fix #954: Startup failure when simple_away is loaded
+ after awaynick
+
+---
+ src/User.cpp | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/src/User.cpp
++++ b/src/User.cpp
+@@ -1101,6 +1101,11 @@ bool CUser::LoadModule(const CString& sM
+ CFile fNVFile = CFile(GetUserPath() + "/moddata/" + sModName + "/.registry");
+
+ for (vector<CIRCNetwork*>::iterator it = m_vIRCNetworks.begin(); it != m_vIRCNetworks.end(); ++it) {
++ // Check whether the network already has this module loaded (#954)
++ if ((*it)->GetModules().FindModule(sModName)) {
++ continue;
++ }
++
+ if (fNVFile.Exists()) {
+ CString sNetworkModPath = (*it)->GetNetworkPath() + "/moddata/" + sModName;
+ if (!CFile::Exists(sNetworkModPath)) {
diff --git a/net/znc/patches/001-move_rootcheck_after_config.patch b/net/znc/patches/100-move_rootcheck_after_config.patch
index 8b3e3e703..84ee6aa6f 100644
--- a/net/znc/patches/001-move_rootcheck_after_config.patch
+++ b/net/znc/patches/100-move_rootcheck_after_config.patch
@@ -1,15 +1,15 @@
-From 5f655f9a25a377c01cb15517859eb514628a43d4 Mon Sep 17 00:00:00 2001
+From adf42357c9043c38d9a9b47544a1b46445bdae19 Mon Sep 17 00:00:00 2001
From: Jonas Gorski <jonas.gorski+openwrt@gmail.com>
Date: Wed, 6 Apr 2011 04:10:23 +0200
Subject: [PATCH] Move the root check to after config parsing
---
- src/main.cpp | 27 ++++++++++++++-------------
- 1 files changed, 14 insertions(+), 13 deletions(-)
+ src/main.cpp | 27 ++++++++++++++-------------
+ 1 file changed, 14 insertions(+), 13 deletions(-)
--- a/src/main.cpp
+++ b/src/main.cpp
-@@ -243,19 +243,6 @@ int main(int argc, char** argv) {
+@@ -303,19 +303,6 @@ int main(int argc, char** argv) {
CUtils::PrintStatus(true, "");
}
@@ -17,7 +17,7 @@ Subject: [PATCH] Move the root check to after config parsing
- CUtils::PrintError("You are running ZNC as root! Don't do that! There are not many valid");
- CUtils::PrintError("reasons for this and it can, in theory, cause great damage!");
- if (!bAllowRoot) {
-- delete pZNC;
+- CZNC::DestroyInstance();
- return 1;
- }
- CUtils::PrintError("You have been warned.");
@@ -28,8 +28,8 @@ Subject: [PATCH] Move the root check to after config parsing
-
if (bMakeConf) {
if (!pZNC->WriteNewConfig(sConfig)) {
- delete pZNC;
-@@ -276,6 +263,20 @@ int main(int argc, char** argv) {
+ CZNC::DestroyInstance();
+@@ -337,6 +324,20 @@ int main(int argc, char** argv) {
return 1;
}
@@ -37,7 +37,7 @@ Subject: [PATCH] Move the root check to after config parsing
+ CUtils::PrintError("You are running ZNC as root! Don't do that! There are not many valid");
+ CUtils::PrintError("reasons for this and it can, in theory, cause great damage!");
+ if (!bAllowRoot) {
-+ delete pZNC;
++ CZNC::DestroyInstance();
+ return 1;
+ }
+ CUtils::PrintError("You have been warned.");
diff --git a/net/znc/patches/003-Reduce_rebuild_time.patch b/net/znc/patches/101-Reduce_rebuild_time.patch
index 25c08e5b3..60d335c74 100644
--- a/net/znc/patches/003-Reduce_rebuild_time.patch
+++ b/net/znc/patches/101-Reduce_rebuild_time.patch
@@ -1,27 +1,28 @@
-From 94aff4c3389111fc85054eb06b40bea26a216d0c Mon Sep 17 00:00:00 2001
+From 0527869a72c27bfb25b5f92fdd77a04c39d939db Mon Sep 17 00:00:00 2001
From: Jonas Gorski <jonas.gorski+openwrt@gmail.com>
Date: Sat, 16 Apr 2011 05:51:04 +0200
-Subject: [PATCH] Don't rebuild everything when the Makefile's timestamp changed
+Subject: [PATCH] Don't rebuild everything when the Makefile's timestamp
+ changed
---
- Makefile.in | 2 +-
- modules/Makefile.in | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
+ Makefile.in | 2 +-
+ modules/Makefile.in | 4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
--- a/Makefile.in
+++ b/Makefile.in
-@@ -104,7 +104,7 @@ clean:
+@@ -112,7 +112,7 @@ clean:
distclean: clean
rm -rf $(DISTCLEAN)
--src/%.o: src/%.cpp Makefile
-+src/%.o: src/%.cpp
+-src/%.o: src/%.cpp Makefile include/znc/Csocket.h
++src/%.o: src/%.cpp include/znc/Csocket.h
@mkdir -p .depend src
$(E) Building core object $*...
$(Q)$(CXX) $(CXXFLAGS) -c -o $@ $< -MD -MF .depend/$*.dep -MT $@
--- a/modules/Makefile.in
+++ b/modules/Makefile.in
-@@ -117,12 +117,12 @@ install_datadir:
+@@ -112,12 +112,12 @@ install_datadir:
clean:
rm -rf $(CLEAN)
diff --git a/net/znc/patches/004-restore_droproot.patch b/net/znc/patches/102-restore_droproot.patch
index 2c7cefe5d..2c7cefe5d 100644
--- a/net/znc/patches/004-restore_droproot.patch
+++ b/net/znc/patches/102-restore_droproot.patch