Update to openslp-2.0.0, Add systemd support, man pages, build with full relro

This commit is contained in:
Vitezslav Crhonek 2013-10-01 11:08:52 +02:00
parent d2ce3eac77
commit e62c923b2d
9 changed files with 206 additions and 89 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
openslp-1.2.1.tar.gz
/openslp-2.0.0.tar.gz

View File

@ -1,36 +0,0 @@
diff -up openslp-1.2.1/slpd/slpd_log.c.orig openslp-1.2.1/slpd/slpd_log.c
--- openslp-1.2.1/slpd/slpd_log.c.orig 2005-02-08 05:34:31.000000000 +0000
+++ openslp-1.2.1/slpd/slpd_log.c 2009-09-15 19:39:23.000000000 +0100
@@ -179,7 +179,8 @@ void SLPDLogBuffer(const char* prefix, i
if (G_SlpdLogFile)
{
fprintf(G_SlpdLogFile,"%s",prefix);
- fwrite(buf,bufsize,1,G_SlpdLogFile);
+ if (buf && (bufsize > 0))
+ fwrite(buf,bufsize,1,G_SlpdLogFile);
fprintf(G_SlpdLogFile,"\n");
fflush(G_SlpdLogFile);
}
@@ -275,7 +276,21 @@ void SLPDLogSrvTypeRqstMessage(SLPSrvTyp
/*-------------------------------------------------------------------------*/
{
SLPDLog("Message SRVTYPERQST:\n");
- SLPDLogBuffer(" namingauth = ", srvtyperqst->namingauthlen, srvtyperqst->namingauth);
+
+ if (srvtyperqst->namingauthlen == 0xffff)
+ {
+ /* Naming authority matches all */
+ SLPDLog(" namingauth = (all)\n");
+ }
+ else if (srvtyperqst->namingauthlen == 0)
+ {
+ SLPDLog(" namingauth = (empty)\n");
+ }
+ else
+ {
+ /* Naming authority has been provided */
+ SLPDLogBuffer(" namingauth = ", srvtyperqst->namingauthlen, srvtyperqst->namingauth);
+ }
SLPDLogBuffer(" scope = ", srvtyperqst->scopelistlen, srvtyperqst->scopelist);
}

View File

@ -1,22 +0,0 @@
--- openslp-1.2.1/configure.in.optflags 2005-02-15 14:06:02.000000000 -0600
+++ openslp-1.2.1/configure.in 2005-03-04 06:53:02.000000000 -0600
@@ -130,7 +130,7 @@
CFLAGS="$CFLAGS -Werror"
fi
if test X"$debug" = X"no"; then
- OPTFLAGS="-O3"
+ OPTFLAGS="-O3 $RPM_OPT_FLAGS"
fi
elif $CC -V 2>&1 | grep "WorkShop Compilers"; then
--- openslp-1.2.1/configure.optflags 2005-03-02 12:00:28.000000000 -0600
+++ openslp-1.2.1/configure 2005-03-04 06:53:04.000000000 -0600
@@ -20596,7 +20596,7 @@
CFLAGS="$CFLAGS -Werror"
fi
if test X"$debug" = X"no"; then
- OPTFLAGS="-O3"
+ OPTFLAGS="-O3 $RPM_OPT_FLAGS"
fi
elif $CC -V 2>&1 | grep "WorkShop Compilers"; then

View File

@ -0,0 +1,134 @@
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
@@ -1,28 +1,5 @@
#!/bin/bash
-#
-# /etc/rc.d/init.d/slpd
-#
-# slpd Start/Stop the OpenSLP SA daemon (slpd).
-#
-# chkconfig: 345 13 87
-# description: OpenSLP daemon for the Service Location Protocol
-# processname: 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>
-
-#//////////////////////////////////////////////////#
-# 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'
@@ -91,94 +68,11 @@ multicast_route_set()
return $retval
}
-NAME=slpd
-DAEMON=/usr/sbin/$NAME
-SUSE=0
-
-# Change to root
-OLDDIR=`pwd`
-cd /
-
-# Source function library.
-if [ -f /etc/rc.d/init.d/functions ]; then
- . /etc/rc.d/init.d/functions
-else
- SUSE=1
-fi
-
-test -x $DAEMON || exit 0
-
-if [ ! "$SVIlock" = "" ]; then
- unset LOCK
-else
- LOCK=/var/lock/subsys/slpd
+multicast_route_set 1
+multicast_enabled=$?
+if [ "$multicast_enabled" != "0" ] ; then
+ echo "Failure: No Route Available for Multicast Traffic"
+ exit 1
fi
-RETVAL=0
-
-#
-# See how we were called.
-#
-case "$1" in
- start)
- # Check if atd is already running
- # RH style
- if [ $SUSE -eq 0 ] && [ ! "$LOCK" = "" ] && [ -f $LOCK ]; then
- exit 0
- fi
- # Caldera Style
- if [ ! "$SVIlock" = "" ] && [ -f $SVIlock ]; then
- exit 0
- fi
- echo -n 'Starting slpd: '
-
- multicast_route_set 1
- multicast_enabled=$?
- if [ "$multicast_enabled" != "0" ] ; then
- echo "Failure: No Route Available for Multicast Traffic"
- exit 1
- fi
- if [ $SUSE -eq 0 ]; then
- if [ -x /sbin/ssd ]; then
- ssd -S -n $NAME -x $DAEMON -- $OPTIONS
- [ ! "$SVIlock" = "" ] && touch $SVIlock
- else
- daemon $DAEMON
- RETVAL=$?
- fi
- else
- startproc $DAEMON $OPTIONS
- fi
- [ $SUSE -eq 0 ] && [ ! "$LOCK" = "" ] && [ $RETVAL -eq 0 ] && touch $LOCK
- echo
- ;;
- stop)
- echo -n 'Stopping slpd: '
-
- if [ -x /sbin/ssd ]; then
- ssd -K -p /var/run/$NAME.pid -n $NAME
- [ ! "$SVIlock" = "" ] && rm -f $SVIlock
- else
- killproc $DAEMON
- RETVAL=$?
- fi
- [ ! "$LOCK" = "" ] && [ $RETVAL -eq 0 ] && rm -f $LOCK
- echo
- ;;
- reload|restart)
- cd $OLDDIR
- $0 stop
- $0 start
- cd /
- RETVAL=$?
- ;;
- status)
- status /usr/sbin/slpd
- RETVAL=$?
- ;;
- *)
- echo "Usage: /etc/rc.d/init.d/slpd {start|stop|restart|reload|status}"
- exit 1
-esac
-
-exit $RETVAL
+exit 0

View File

@ -1,26 +1,30 @@
Summary: Open implementation of Service Location Protocol V2
Name: openslp
Version: 1.2.1
Release: 20%{?dist}
Version: 2.0.0
Release: 1%{?dist}
Group: System Environment/Libraries
License: BSD
URL: http://sourceforge.net/projects/openslp/
Source0: http://downloads.sf.net/openslp/openslp-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Source1: slpd.init
# Source1,2: simple man pages (slightly modified help2man output)
Source2: slpd.8.gz
Source3: slptool.1.gz
# Source3: service file
Source4: slpd.service
Patch1: openslp-1.2.1-optflags.patch
# slpd crashes if slptool findsrvtypes is run, when message logging is on
# http://bugzilla.redhat.com/523609
Patch2: openslp-1.2.1-nullauth.patch
# Patch1: creates script from upstream init script that sets multicast
# prior to the start of the service
Patch1: openslp-2.0.0-multicast-set.patch
BuildRequires: automake libtool
BuildRequires: bison
BuildRequires: flex
BuildRequires: openssl-devel
BuildRequires: systemd-units
%description
Service Location Protocol is an IETF standards track protocol that
@ -53,8 +57,7 @@ OpenSLP server daemon to dynamically register services.
%prep
%setup -q
%patch1 -p1 -b .optflags
%patch2 -p1 -b .nullauth
%patch1 -p1 -b .multicast-set
# tarball goof (?), it wants to re-automake anyway, so let's do it right.
#libtoolize --force
@ -70,15 +73,20 @@ find . -name "CVS" | xargs rm -rf
%build
# for x86_64
export CFLAGS="-fPIC $RPM_OPT_FLAGS"
export CFLAGS="-fPIC -fno-strict-aliasing -fPIE -DPIE $RPM_OPT_FLAGS"
# for slpd
export LDFLAGS="-pie"
export LDFLAGS="-pie -Wl,-z,now"
%configure \
--prefix=%{_prefix} \
--libdir=%{_libdir} \
--sysconfdir=%{_sysconfdir} \
--localstatedir=/var \
--disable-dependency-tracking \
--disable-static \
--enable-slpv2-security
# --enable-async-api
--enable-slpv2-security \
--disable-rpath \
--enable-async-api
make %{?_smp_mflags}
@ -90,6 +98,22 @@ make install DESTDIR=$RPM_BUILD_ROOT
install -p -D -m755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/slpd
mkdir -p ${RPM_BUILD_ROOT}/%{_sysconfdir}/slp.reg.d
# install script that sets multicast
mkdir -p ${RPM_BUILD_ROOT}/usr/lib/%{name}-server
install -m 0755 etc/slpd.all_init ${RPM_BUILD_ROOT}/usr/lib/%{name}-server/slp-multicast-set.sh
# install service file
mkdir -p ${RPM_BUILD_ROOT}/%{_unitdir}
install -p -m 644 %{SOURCE4} ${RPM_BUILD_ROOT}/%{_unitdir}/slpd.service
# install man page
mkdir -p ${RPM_BUILD_ROOT}/%{_mandir}/man8/
mkdir -p ${RPM_BUILD_ROOT}/%{_mandir}/man1/
cp %SOURCE2 ${RPM_BUILD_ROOT}/%{_mandir}/man8/
cp %SOURCE3 ${RPM_BUILD_ROOT}/%{_mandir}/man1/
# nuke unpackaged/unwanted files
rm -rf $RPM_BUILD_ROOT/usr/doc
rm -f $RPM_BUILD_ROOT%{_libdir}/lib*.la
@ -104,20 +128,13 @@ rm -rf $RPM_BUILD_ROOT
%postun -p /sbin/ldconfig
%post server
/sbin/chkconfig --add slpd
%systemd_post slpd.service
%preun server
# on remove
if [ $1 -eq 0 ]; then
/sbin/service slpd stop >/dev/null 2>&1 ||:
/sbin/chkconfig --del slpd
fi
%systemd_preun slpd.service
%postun server
# on upgrade
if [ $1 -gt 0 ]; then
/sbin/service slpd condrestart >/dev/null 2>&1 ||:
fi
%systemd_postun_with_restart slpd.service
%files
@ -126,26 +143,38 @@ fi
%config(noreplace) %{_sysconfdir}/slp.conf
%{_bindir}/slptool
%{_libdir}/libslp.so.1*
%{_mandir}/man1/*
%files server
%defattr(-,root,root)
%doc doc/html/IntroductionToSLP
%doc doc/html/UsersGuide
%doc doc/html/faq*
%doc doc/doc/html/IntroductionToSLP
%doc doc/doc/html/UsersGuide
%doc doc/doc/html/faq*
%{_sbindir}/slpd
%config(noreplace) %{_sysconfdir}/slp.reg
%config(noreplace) %{_sysconfdir}/slp.spi
%config(noreplace) %{_initrddir}/slpd
%{_unitdir}/slpd.service
%{_mandir}/man8/*
/usr/lib/%{name}-server/slp-multicast-set.sh
%files devel
%defattr(-,root,root)
%doc doc/html/ProgrammersGuide
%doc doc/rfc
%doc doc/doc/html/ProgrammersGuide
%doc doc/doc/rfc
%{_includedir}/slp.h
%{_libdir}/libslp.so
%changelog
* Tue Oct 01 2013 Vitezslav Crhonek <vcrhonek@redhat.com> - 2.0.0-1
- Update to openslp-2.0.0
- Fix bogus dates in %%changelog
- Add systemd support
- Add man pages for slptool and slpd
- Add CFLAGS and LDFLAGS for full relro
- Build with -fno-strict-aliasing
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.1-20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
@ -216,7 +245,7 @@ fi
* Sun May 22 2005 Jeremy Katz <katzj@redhat.com> - 1.2.0
- rebuild on all arches
* Fri Apr 7 2005 Michael Schwendt <mschwendt[AT]users.sf.net>
* Thu Apr 7 2005 Michael Schwendt <mschwendt[AT]users.sf.net>
- rebuilt
* Mon Jul 19 2004 Rex Dieter <rexdieter at sf.net> 0:1.2.0-0.fdr.4
@ -246,7 +275,7 @@ fi
* Fri May 16 2003 Rex Dieter <rexdieter at sf.net> 0:1.0.11-0.fdr.5
- -server: fix %postun on uninstall
* Thu May 2 2003 Rex Dieter <rexdieter at sf.net> 0:1.0.11-0.fdr.4
* Fri May 2 2003 Rex Dieter <rexdieter at sf.net> 0:1.0.11-0.fdr.4
- *really* do %%config(noreplace) slp.conf
* Thu May 1 2003 Rex Dieter <rexdieter at sf.net> 0:1.0.11-0.fdr.3

BIN
slpd.8.gz Normal file

Binary file not shown.

11
slpd.service Normal file
View File

@ -0,0 +1,11 @@
[Unit]
Description=OpenSLP daemon for the Service Location Protocol
After=network.target
[Service]
Type=forking
ExecStart=/usr/sbin/slpd
ExecStartPre=/usr/lib/openslp-server/slp-multicast-set.sh
[Install]
WantedBy=multi-user.target

BIN
slptool.1.gz Normal file

Binary file not shown.

View File

@ -1 +1 @@
ff9999d1b44017281dd00ed2c4d32330 openslp-1.2.1.tar.gz
18cf7940bcc444e32592cf34e84f833f openslp-2.0.0.tar.gz