initial import

This commit is contained in:
2025-06-22 20:39:04 -05:00
commit f8a70886f0
3428 changed files with 302546 additions and 0 deletions

56
openslp/PKGBUILD Normal file
View File

@@ -0,0 +1,56 @@
# Maintainer: Jesus E. <heckyel@riseup.net>
pkgname=openslp
pkgver=2.0.0
pkgrel=2
pkgdesc="Free-software implementation of Service Location Protocol"
arch=('i686' 'x86_64')
url="http://www.openslp.org"
license=('Modified-BSD')
depends=('bash' 'libressl')
makedepends=('doxygen')
backup=('etc/slp.conf' 'etc/slp.reg' 'etc/slp.spi')
options=(!makeflags)
source=(https://downloads.sourceforge.net/sourceforge/${pkgname}/${pkgname}-${pkgver}.tar.gz
openslp-2.0.0-null-pointer-deref.patch
openslp-2.0.0-openssl-1.1-fix.patch
slpd.initd
slpd.run)
sha512sums=('e7627417d45d5d0cc83d6e13d62fe192702ce7b763f1b4fb51aa5da8285405b16a34c3ac4f0a1ecffdf59557b29ec7d24925941e56ddee277c8897162f597ade'
'aee5a5f0b65d423b30675ba13042e38261e15151ee31accc84b170c44a90293be5e8253a3cd7c0d8f94039988a303574e59c290ee07e0bc778ad856df5978451'
'd8053b242d79a15bffac137518ef9a3fd39b43335089b29f49b05d5edde95f9f06b73245f5688fd199fcd9e81ef66ac9151e8ef5882a05988c4c12b6c1240ab1'
'f76e98cfd48303d3095f2c9af0e81da7fd2def6d62fcadb881e64dd565af354cff65325d678c6d78cb62fffab67723513c1818a5f5c7606f21aa3a651bd8722b'
'1c4660857bed0872411052a467398a28e012d6303d365f9fa278bdb07a6e4c98ae0b07abfff6f809f15e4ecdc120d3d57c79585f69df3fa5cfac1386810b77e6')
prepare() {
cd $pkgname-$pkgver
sed -i 's|$(datadir)/doc|$(docdir)|' doc/Makefile.in
patch -Np1 -i ${srcdir}/openslp-2.0.0-null-pointer-deref.patch
patch -Np1 -i ${srcdir}/openslp-2.0.0-openssl-1.1-fix.patch
}
build() {
cd ${pkgname}-${pkgver}
./configure --prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--docdir=/usr/share/doc/openslp-${pkgver} \
--enable-slpv1 \
--enable-slpv2-security # service would fail to start without this
sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
make
}
package() {
cd ${pkgname}-${pkgver}
make DESTDIR="${pkgdir}" install
make DESTDIR="${pkgdir}" INSTALL_DATA="cp -r" install-docs
rm "${pkgdir}/usr/share/doc/openslp-${pkgver}/openslp-doxy-${pkgver}.tar.gz"
# license
install -Dm0644 COPYING -t "${pkgdir}/usr/share/licenses/${pkgname}"
# services
install -Dm0755 "${srcdir}/slpd.initd" "${pkgdir}/etc/init.d/slpd"
install -Dm0755 "$srcdir/slpd.run" "${pkgdir}/etc/sv/slpd/run"
}

View File

@@ -0,0 +1,12 @@
diff -up openslp-2.0.0/common/slp_xmalloc.c.orig openslp-2.0.0/common/slp_xmalloc.c
--- openslp-2.0.0/common/slp_xmalloc.c.orig 2012-12-07 01:52:08.000000000 +0100
+++ openslp-2.0.0/common/slp_xmalloc.c 2016-05-23 12:58:57.953532979 +0200
@@ -203,6 +203,8 @@ void * _xrealloc(const char * file, int
if (x->size != size)
{
newptr = _xmalloc(file, line, size);
+ if (newptr == 0)
+ return 0;
memcpy(newptr, ptr, x->size);
_xfree(file, line, x);
}

View File

@@ -0,0 +1,25 @@
diff -up openslp-2.0.0/common/slp_crypto.c.orig openslp-2.0.0/common/slp_crypto.c
--- openslp-2.0.0/common/slp_crypto.c.orig 2012-12-07 21:13:28.000000000 +0100
+++ openslp-2.0.0/common/slp_crypto.c 2017-02-22 11:16:11.620835724 +0100
@@ -88,11 +88,16 @@ SLPCryptoDSAKey * SLPCryptoDSAKeyDup(SLP
result = DSA_new();
if (result)
{
- result->p = BN_dup(dsa->p);
- result->q = BN_dup(dsa->q);
- result->g = BN_dup(dsa->g);
- result->priv_key = BN_dup(dsa->priv_key);
- result->pub_key = BN_dup(dsa->pub_key);
+ const BIGNUM *p, *q, *g;
+ const BIGNUM *priv_key, *pub_key;
+
+ DSA_get0_pqg(dsa, &p, &q, &g);
+ DSA_get0_key(dsa, &pub_key, &priv_key);
+
+ /* would be nice to check return values,
+ * but original code didn't do that either... */
+ DSA_set0_pqg(result, BN_dup(p), BN_dup(q), BN_dup(g));
+ DSA_set0_key(result, BN_dup(pub_key), BN_dup(priv_key));
}
return result;
}

88
openslp/slpd.initd Normal file
View File

@@ -0,0 +1,88 @@
#!/sbin/openrc-run
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
depend() {
need net
}
#
# Does nothing if a route exists that supports multicast traffic.
# If no routes supporting multicast traffic exists, the function
# tries to add one. A 0 is returned on success and a 1 on failure.
# One parameter must be passed in. This variable determins verbosity.
# If parameter is non-zero debugging will appear.
#
multicast_route_set() {
PING_OPTIONS_1='-c1 -w1'
PING_OPTIONS_2='-c1 -i1'
MULTICAST_ADDRESS='239.255.255.253'
TMP_FILE=/tmp/route.check
PING_ERROR_NO_ROUTE='unreachable'
MSG_FAILED_TO_FIND='Failed to Detect Multicast Route'
MSG_SUCCESS_ON_FIND='Multicast Route Enabled'
MSG_ADDING_ROUTE='Attempting to Add Multicast Route ...'
MSG_FAILED_TO_ADD=' FAILED - Route NOT Added.'
MSG_SUCCES_ON_ADD=' SUCCESS - Route Added.'
CMD_GET_INTERFACE="netstat -i | awk 'BEGIN{}(NR>2)&&(!/^lo*/){print \$1;exit}'"
CMD_ADD_ROUTE="route add -net 224.0.0.0 netmask 240.0.0.0"
ping $PING_OPTIONS_1 $MULTICAST_ADDRESS 2> $TMP_FILE 1> /dev/null
if [ $? = 2 ]; then
ping $PING_OPTIONS_2 $MULTICAST_ADDRESS 2> $TMP_FILE 1> /dev/null
fi
grep $PING_ERROR_NO_ROUTE $TMP_FILE > /dev/null 2>&1
err_unreachable_found=$?
#If errors, add route. Otherwise, do nothing
if [ -s $TMP_FILE ] && [ $err_unreachable_found = 0 ]; then
if [ $1 != 0 ]; then
echo $MSG_FAILED_TO_FIND
echo $MSG_ADDING_ROUTE
fi
$CMD_ADD_ROUTE `eval $CMD_GET_INTERFACE` > /dev/null 2>&1
retval=$?
if [ $1 != 0 ]; then
if [ $retval = 0 ]; then
echo $MSG_SUCCES_ON_ADD
else
echo $MSG_FAILED_TO_ADD
fi
fi
else
if [ $1 != 0 ]; then
echo -n $MSG_SUCCESS_ON_FIND
fi
retval=0
fi
rm -f $TMP_FILE # Clean up
return $retval
}
checkconfig() {
multicast_route_set 0
if [ $? -ne 0 ]; then
eerror "No route available for multicast traffic!"
return 1
fi
}
start() {
checkconfig || return 1
ebegin "Starting slpd"
start-stop-daemon --start --quiet --exec /usr/sbin/slpd --pidfile /var/run/slpd.pid
eend $?
}
stop() {
ebegin "Stopping slpd"
start-stop-daemon --stop --quiet --pidfile /var/run/slpd.pid
eend $?
}

2
openslp/slpd.run Normal file
View File

@@ -0,0 +1,2 @@
#!/bin/sh
exec /usr/sbin/slpd