Removed dependency on net-tools, openssl-1.1 patch improvement, minor spec file changes

This commit is contained in:
Vitezslav Crhonek 2017-10-04 10:21:17 +02:00
parent e6e4a4deb3
commit 827d556179
4 changed files with 33 additions and 281 deletions

View File

@ -1,6 +1,6 @@
diff -up openslp-2.0.0/etc/slpd.all_init.orig openslp-2.0.0/etc/slpd.all_init
--- openslp-2.0.0/etc/slpd.all_init.orig 2012-11-28 18:07:04.000000000 +0100
+++ openslp-2.0.0/etc/slpd.all_init 2013-06-24 13:27:34.375575496 +0200
+++ openslp-2.0.0/etc/slpd.all_init 2017-10-04 09:59:28.920071865 +0200
@@ -1,28 +1,5 @@
#!/bin/bash
-#
@ -31,6 +31,15 @@ diff -up openslp-2.0.0/etc/slpd.all_init.orig openslp-2.0.0/etc/slpd.all_init
multicast_route_set()
{
PING_OPTIONS_1='-c1 -w1'
@@ -36,7 +13,7 @@ multicast_route_set()
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}'"
+ CMD_GET_INTERFACE="ip -o link show | awk 'BEGIN{FS=\": \"}!/^:digit:+: lo:.*/{print \$2}'"
CMD_ADD_ROUTE="route add -net 224.0.0.0 netmask 240.0.0.0"
err_unreachable_found=`ping $PING_OPTIONS_1 $MULTICAST_ADDRESS 2>&1 1>/dev/null`
@@ -91,94 +68,11 @@ multicast_route_set()
return $retval
}

View File

@ -1,25 +1,28 @@
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
+++ openslp-2.0.0/common/slp_crypto.c 2017-10-04 09:38:48.469999889 +0200
@@ -88,11 +88,24 @@ 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);
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+ 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... */
+ /* would be nice to check return values, but
+ * original code for OpenSSL < 1.1 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));
+#else
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);
+#endif
}
return result;
}

View File

@ -2,15 +2,13 @@
Summary: Open implementation of Service Location Protocol V2
Name: openslp
Version: 2.0.0
Release: 14%{?dist}
Release: 15%{?dist}
Group: System Environment/Libraries
License: BSD
URL: http://sourceforge.net/projects/openslp/
Source0: http://downloads.sf.net/openslp/openslp-%{version}.tar.gz
Source1: slpd.init
# Source1,2: simple man pages (slightly modified help2man output)
# Source2,3: simple man pages (slightly modified help2man output)
Source2: slpd.8.gz
Source3: slptool.1.gz
# Source3: service file
@ -46,19 +44,17 @@ by RFC 2608 and RFC 2614.
%package devel
Summary: OpenSLP headers and libraries
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
OpenSLP header files and libraries.
%package server
Summary: OpenSLP server daemon
Group: System Environment/Daemons
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires(preun): chkconfig, /sbin/service
Requires(post): chkconfig
Requires(postun): /sbin/service
Requires: net-tools
Requires: iproute
%description server
OpenSLP server daemon to dynamically register services.
@ -109,10 +105,6 @@ rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
%if 0%{?fedora} < 23
install -p -D -m755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/slpd
%endif
mkdir -p ${RPM_BUILD_ROOT}/%{_sysconfdir}/slp.reg.d
# install script that sets multicast
@ -168,9 +160,6 @@ rm -rf $RPM_BUILD_ROOT
%{_sbindir}/slpd
%config(noreplace) %{_sysconfdir}/slp.reg
%config(noreplace) %{_sysconfdir}/slp.spi
%if 0%{?fedora} < 23
%config(noreplace) %{_initrddir}/slpd
%endif
%{_unitdir}/slpd.service
%{_mandir}/man8/*
/usr/lib/%{name}-server/slp-multicast-set.sh
@ -184,6 +173,13 @@ rm -rf $RPM_BUILD_ROOT
%changelog
* Wed Oct 04 2017 Vitezslav Crhonek <vcrhonek@redhat.com> - 2.0.0-15
- Removed dependency on net-tools
Resolves: #1496138
- Removed init script, Group tag and macro from changelog in spec file
- Slightly modified openssl-1.1 fix to be able build the package
with OpenSSL version lower than 1.1
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.0-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
@ -334,7 +330,7 @@ rm -rf $RPM_BUILD_ROOT
- initscript: use $prog instead of hardcoded slpd.
* Fri May 16 2003 Rex Dieter <rexdieter at sf.net> 0:1.0.11-0.fdr.5
- -server: fix %postun on uninstall
- -server: fix %%postun on uninstall
* Fri May 2 2003 Rex Dieter <rexdieter at sf.net> 0:1.0.11-0.fdr.4
- *really* do %%config(noreplace) slp.conf

256
slpd.init
View File

@ -1,256 +0,0 @@
#!/bin/bash
#
# slpd Start/Stop the OpenSLP SA daemon (slpd).
#
# Author: Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
# -Modified for RHS Linux by Damien Neil
# -Modified for COL by Raymund Will, <ray@lst.de>
# -Modified for OpenSLP by Matt Peterson <mpeterson@calderasystems.com>
# -Modified to be distribution agnostic by Bart Whiteley <bart@caldera.com>
# -Modified to be MORE agnostic by Erik Ratcliffe <eratcliffe@volutiontech.com>
# Red Hat "chkconfig" init header:
#
# chkconfig: 345 13 87
# description: slpd - OpenSLP daemon for the Service Location Protocol
# processname: slpd
# LSB init header:
#
### BEGIN INIT INFO
# Provides: openslp slpd
# Required-Start: $named
# Required-Stop:
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Description: slpd - OpenSLP daemon for the Service Location Protocol
### END INIT INFO
#///////////// multicast_route_set() //////////////#
# #
# 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}'"
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
}
NAME=slpd
DAEMON=/usr/sbin/$NAME
# Change to root
OLDDIR=`pwd`
cd /
# Source function library or libraries. Start with the
# uncommon ones like /etc[/rc.d]/init.d/functions, and then
# source in the LSB functions if they exist (which will
# override functions that may be defined in the former
# functions library). Finally, if /etc/sysconfig/slpd
# exists (like on SCO Linux systems), source it in Just
# In Case(tm).
if [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
else
if [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
fi
fi
if [ -f /lib/lsb/init-functions ]; then
. /lib/lsb/init-functions
fi
if [ -f /etc/sysconfig/$NAME ]; then
. /etc/sysconfig/$NAME
fi
# No executable daemon, no go...
test -x $DAEMON || exit 1
# Lock files seem to be very, very consistent across distros...
LOCK=/var/lock/subsys/$NAME
# Run/PID files seem to be consistent as well...
RUNPID=/var/run/$NAME
# Make RETVAL default to 0...
RETVAL=0
#
# See how we were called.
#
case "$1" in
start)
# Check if we're already running...
if [ ! "$LOCK" = "" ] && [ -f $LOCK ]; then
exit 0
fi
echo -n 'Starting slpd: '
# Attempt to guarantee a multicast route...
multicast_route_set 1
multicast_enabled=$?
if [ "$multicast_enabled" != "0" ] ; then
echo "Failure: No Route Available for Multicast Traffic"
exit 1
fi
# Try to start it up, beginning with LSB, then Red Hat,
# then OpenLinux. If there are other methods for starting
# daemons and they don't accidentally fall into one of those
# categories (look below before jumping to conclusions), let
# someone know so this can be fixed...
if [ -x /sbin/startproc ]; then
startproc $DAEMON $OPTIONS
RETVAL=$?
elif grep ^startproc\(\) /etc/rc.d/init.d/functions > /dev/null 2>&1 || \
grep ^startproc\(\) /etc/init.d/functions > /dev/null 2>&1; then
startproc $DAEMON $OPTIONS
RETVAL=$?
elif grep ^daemon\(\) /etc/rc.d/init.d/functions > /dev/null 2>&1 || \
grep ^daemon\(\) /etc/init.d/functions > /dev/null 2>&1; then
daemon $DAEMON
RETVAL=$?
else
if [ -x /sbin/ssd ]; then
ssd -S -n $NAME -x $DAEMON -- $OPTIONS
RETVAL=$?
fi
fi
if [ $RETVAL -eq 0 ]; then touch $LOCK; fi
echo
;;
stop)
# Are we even running? Check first...
if [ -f $LOCK ]; then
echo -n 'Stopping slpd: '
if [ -x /sbin/killproc ]; then
killproc $DAEMON
RETVAL=$?
elif grep killproc\(\) /etc/rc.d/init.d/functions > /dev/null 2>&1 || \
grep killproc\(\) /etc/init.d/functions > /dev/null 2>&1; then
killproc $DAEMON
RETVAL=$?
else
if [ -x /sbin/ssd ]; then
ssd -K -p /var/run/$NAME.pid -n $NAME
RETVAL=$?
fi
fi
if [ $RETVAL -eq 0 ]; then rm -f $LOCK; fi
else
echo "$NAME is not running"
RETVAL=0
fi
echo
;;
reload|restart)
cd $OLDDIR
$0 stop
$0 start
RETVAL=$?
cd /
;;
condrestart)
[ -f $LOCK ] && $0 restart || :
;;
status)
if [ -x /sbin/checkproc ]; then
/sbin/checkproc $NAME > /dev/null 2>&1
elif grep checkproc\(\) /etc/rc.d/init.d/functions > /dev/null 2>&1 || \
grep checkproc\(\) /etc/init.d/functions > /dev/null 2>&1; then
checkproc $NAME > /dev/null 2>&1
elif grep status\(\) /etc/rc.d/init.d/functions > /dev/null 2>&1 || \
grep status\(\) /etc/init.d/functions > /dev/null 2>&1; then
status $NAME > /dev/null 2>&1
else
pidof $NAME > /dev/null 2>&1
fi
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo "$NAME is running."
else
echo "$NAME is not running."
fi
;;
*)
echo "Usage: slpd {start|stop|restart|condrestart|reload|status}"
exit 1
esac
exit $RETVAL