net-im/biboumi: add 9.0-r3 with fix for newer libexpat

Signed-off-by: Florian Schmaus <flow@gentoo.org>
This commit is contained in:
Florian Schmaus
2022-02-26 21:46:43 +01:00
parent 6197678f3a
commit fa0328d9ed
2 changed files with 171 additions and 0 deletions

View File

@@ -0,0 +1,114 @@
# Copyright 2020-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit cmake
MY_PV="${PV/_/-}"
DESCRIPTION="XMPP gateway to IRC"
HOMEPAGE="https://biboumi.louiz.org/"
SRC_URI="https://git.louiz.org/biboumi/snapshot/biboumi-${MY_PV}.tar.xz"
LICENSE="ZLIB"
SLOT="0"
KEYWORDS="~amd64"
IUSE="+idn postgres +sqlite +ssl systemd udns"
DEPEND="
dev-libs/expat
virtual/libiconv
sys-apps/util-linux
sqlite? ( dev-db/sqlite:3 )
postgres? ( dev-db/postgresql:* )
idn? ( net-dns/libidn:= )
udns? ( net-libs/udns )
ssl? ( dev-libs/botan:2= )
!ssl? ( dev-libs/libgcrypt )
systemd? ( sys-apps/systemd:= )
"
BDEPEND="dev-python/sphinx"
RDEPEND="
${DEPEND}
acct-user/biboumi
"
S="${WORKDIR}/${PN}-${MY_PV}"
DOCS=( README.rst CHANGELOG.rst doc/user.rst )
PATCHES=(
"${FILESDIR}/${PN}-9.0-fix-namespace-separator.patch"
)
src_configure() {
local mycmakeargs=(
-DSERVICE_USER="${PN}"
-DSERVICE_GROUP="${PN}"
)
# Account for biboumi's atypical configuration system.
if use systemd; then
mycmakeargs+=(-DWITH_SYSTEMD=yes)
else
mycmakeargs+=(-DWITHOUT_SYSTEMD=yes)
fi
if use idn; then
mycmakeargs+=(-DWITH_LIBIDN=yes)
else
mycmakeargs+=(-DWITHOUT_LIBIDN=yes)
fi
if use ssl; then
mycmakeargs+=(-DWITH_BOTAN=yes)
else
mycmakeargs+=(-DWITHOUT_BOTAN=yes)
fi
if use udns; then
mycmakeargs+=(-DWITH_UDNS=yes)
else
mycmakeargs+=(-DWITHOUT_UDNS=yes)
fi
if use sqlite; then
mycmakeargs+=(-DWITH_SQLITE3=yes)
else
mycmakeargs+=(-DWITHOUT_SQLITE3=yes)
fi
if use postgres; then
mycmakeargs+=(-DWITH_POSTGRESQL=yes)
else
mycmakeargs+=(-DWITHOUT_POSTGRESQL=yes)
fi
cmake_src_configure
}
src_compile() {
cmake_src_compile
cmake_build man
}
src_install() {
cmake_src_install
newinitd "${FILESDIR}/${PN}.initd" "${PN}"
insinto /etc/logrotate.d
newins "${FILESDIR}/${PN}.logrotate" "${PN}"
diropts --owner=biboumi --group=biboumi --mode=750
if use sqlite; then
keepdir /var/lib/biboumi
fi
keepdir /var/log/biboumi
insinto /etc/biboumi
insopts --group=biboumi --mode=640
newins conf/biboumi.cfg biboumi.cfg.example
}

View File

@@ -0,0 +1,57 @@
From 380abf66e930f5c4ead591014f31624d80a3151c Mon Sep 17 00:00:00 2001
From: Florian Schmaus <flo@geekplace.eu>
Date: Sat, 26 Feb 2022 21:41:34 +0100
Subject: [PATCH] Fix bad namespace separator
Fixes: https://lab.louiz.org/louiz/biboumi/-/issues/3465
---
src/xmpp/xmpp_parser.cpp | 2 +-
src/xmpp/xmpp_parser.hpp | 4 ++--
src/xmpp/xmpp_stanza.cpp | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/xmpp/xmpp_parser.cpp b/src/xmpp/xmpp_parser.cpp
index 781fe4cd94b0..1f25fa6f982b 100644
--- a/src/xmpp/xmpp_parser.cpp
+++ b/src/xmpp/xmpp_parser.cpp
@@ -38,7 +38,7 @@ XmppParser::XmppParser():
void XmppParser::init_xml_parser()
{
// Create the expat parser
- this->parser = XML_ParserCreateNS("UTF-8", ':');
+ this->parser = XML_ParserCreateNS("UTF-8", '\1');
XML_SetUserData(this->parser, static_cast<void*>(this));
// Install Expat handlers
diff --git a/src/xmpp/xmpp_parser.hpp b/src/xmpp/xmpp_parser.hpp
index ec42f9a326e1..1e5e4e55a875 100644
--- a/src/xmpp/xmpp_parser.hpp
+++ b/src/xmpp/xmpp_parser.hpp
@@ -18,9 +18,9 @@
* stanza is reasonnably short.
*
* The element names generated by expat contain the namespace of the
- * element, a colon (':') and then the actual name of the element. To get
+ * element, a \1 separator and then the actual name of the element. To get
* an element "x" with a namespace of "http://jabber.org/protocol/muc", you
- * just look for an XmlNode named "http://jabber.org/protocol/muc:x"
+ * just look for an XmlNode named "http://jabber.org/protocol/muc\1x"
*
* TODO: enforce the size-limit for the stanza (limit the number of childs
* it can contain). For example forbid the parser going further than level
diff --git a/src/xmpp/xmpp_stanza.cpp b/src/xmpp/xmpp_stanza.cpp
index 435f33313b09..bd668cf2f28d 100644
--- a/src/xmpp/xmpp_stanza.cpp
+++ b/src/xmpp/xmpp_stanza.cpp
@@ -52,7 +52,7 @@ XmlNode::XmlNode(const std::string& name, XmlNode* parent):
parent(parent)
{
// split the namespace and the name
- auto n = name.rfind(':');
+ auto n = name.rfind('\1');
if (n == std::string::npos)
this->name = name;
else
--
2.34.1