init
This commit is contained in:
commit
936f8acc1b
|
@ -0,0 +1,3 @@
|
||||||
|
# openslp
|
||||||
|
|
||||||
|
Библиотека [OpenSLP](http://www.openslp.org) представляет собой реализацию протокола Service Location Protocol (SLP), разработанного в рамках стандартов IETF (Internet Engineering Task Force). Этот протокол предназначен для обнаружения сетевых служб в локальных сетях, что позволяет приложениям находить доступные ресурсы, такие как принтеры, серверы или другие устройства, без необходимости знать их точные сетевые адреса.
|
|
@ -0,0 +1,90 @@
|
||||||
|
diff -up openslp-2.0.0/common/slp_compare.c.orig openslp-2.0.0/common/slp_compare.c
|
||||||
|
--- openslp-2.0.0/common/slp_compare.c.orig 2012-12-12 20:12:43.000000000 +0100
|
||||||
|
+++ openslp-2.0.0/common/slp_compare.c 2017-03-14 10:51:36.480675991 +0100
|
||||||
|
@@ -194,7 +194,8 @@ static int SLPUnescapeInPlace(size_t len
|
||||||
|
* @return The new (shorter) length of @p str.
|
||||||
|
*
|
||||||
|
* @note This routine assumes that leading and trailing white space have
|
||||||
|
- * already been removed from @p str.
|
||||||
|
+ * already been removed from @p str. It also assumes that @p str may
|
||||||
|
+ * not be null-terminated.
|
||||||
|
*/
|
||||||
|
static int SLPFoldWhiteSpace(size_t len, char * str)
|
||||||
|
{
|
||||||
|
@@ -203,11 +204,11 @@ static int SLPFoldWhiteSpace(size_t len,
|
||||||
|
{
|
||||||
|
if (isspace(*p))
|
||||||
|
{
|
||||||
|
- char * ws2p = ++p; /* Point ws2p to the second ws char. */
|
||||||
|
- while (isspace(*p)) /* Scan till we hit a non-ws char. */
|
||||||
|
+ char * ws2p = ++p; /* Point ws2p to the second ws char. */
|
||||||
|
+ while (p < ep && isspace(*p)) /* Scan till we hit a non-ws char. */
|
||||||
|
p++;
|
||||||
|
- len -= p - ws2p; /* Reduce the length by extra ws. */
|
||||||
|
- memmove(ws2p, p, ep - p); /* Overwrite the extra white space. */
|
||||||
|
+ len -= p - ws2p; /* Reduce the length by extra ws. */
|
||||||
|
+ memmove(ws2p, p, ep - p); /* Overwrite the extra white space. */
|
||||||
|
}
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
@@ -821,6 +822,50 @@ int SLPCheckAttributeListSyntax(const ch
|
||||||
|
|
||||||
|
#ifdef SLP_COMPARE_TEST
|
||||||
|
|
||||||
|
+/* Test boundary conditions of SLPFoldWhiteSpace. */
|
||||||
|
+static int test_SLPFoldWhiteSpace(void)
|
||||||
|
+{
|
||||||
|
+ static char test_str0[] = " ";
|
||||||
|
+ static char test_str1[] = "Blah";
|
||||||
|
+ static char test_str3[] = "Blah blah";
|
||||||
|
+ static char test_str4[] = "Blah blah";
|
||||||
|
+ static char test_str5[] = "Blah blah blah";
|
||||||
|
+ static char test_str8[] = " Blah blah";
|
||||||
|
+ static char test_str9[] = " Blah blah";
|
||||||
|
+ static char test_strC[] = "Blah blah ";
|
||||||
|
+ static char test_strD[] = "Blah blah xxxx";
|
||||||
|
+
|
||||||
|
+ static char * test_strs[] =
|
||||||
|
+ {
|
||||||
|
+ test_str0, test_str0, test_str0, test_str1, test_strC,
|
||||||
|
+ test_str3, test_str4, test_str5, test_strC, test_strC,
|
||||||
|
+ test_str8, test_str9, test_strC, test_strD,
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ static int test_lens[] =
|
||||||
|
+ {
|
||||||
|
+ 0, 1, 2, 4, 9, 10, 11, 15, 10, 11, 10, 11, 11, 11,
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ static int test_fins[] =
|
||||||
|
+ {
|
||||||
|
+ 0, 1, 1, 4, 9, 9, 9, 14, 10, 10, 10, 10, 10, 10,
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+#define MAX_BUFSZ 32
|
||||||
|
+
|
||||||
|
+ int i;
|
||||||
|
+ for (i = 0; i < sizeof(test_strs) / sizeof(*test_strs); ++i)
|
||||||
|
+ {
|
||||||
|
+ char test_buf[MAX_BUFSZ];
|
||||||
|
+ memmove(test_buf, test_strs[i], test_lens[i]);
|
||||||
|
+ int len = SLPFoldWhiteSpace(test_lens[i], test_buf);
|
||||||
|
+ if (len != test_fins[i])
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/* ---------------- Test main for the slp_compare.c module ----------------
|
||||||
|
*
|
||||||
|
* Compile with:
|
||||||
|
@@ -840,6 +885,9 @@ int main(void)
|
||||||
|
|
||||||
|
int count;
|
||||||
|
|
||||||
|
+ if (test_SLPFoldWhiteSpace() != 0)
|
||||||
|
+ return -1;
|
||||||
|
+
|
||||||
|
/* *** SLPContainsStringList ***
|
||||||
|
*/
|
||||||
|
count = SLPContainsStringList(sizeof lst1 - 1, lst1, sizeof str1 - 1, str1);
|
|
@ -0,0 +1,19 @@
|
||||||
|
diff -up openslp-2.0.0/slpd/slpd_process.c.orig openslp-2.0.0/slpd/slpd_process.c
|
||||||
|
--- openslp-2.0.0/slpd/slpd_process.c.orig 2018-05-09 13:08:06.185104375 +0200
|
||||||
|
+++ openslp-2.0.0/slpd/slpd_process.c 2018-05-09 13:07:21.017095089 +0200
|
||||||
|
@@ -462,6 +462,15 @@ static int ProcessSrvRqst(SLPMessage * m
|
||||||
|
message->body.srvrqst.srvtype, 23, SLP_DA_SERVICE_TYPE) == 0)
|
||||||
|
{
|
||||||
|
errorcode = ProcessDASrvRqst(message, sendbuf, errorcode);
|
||||||
|
+
|
||||||
|
+ if (result != *sendbuf)
|
||||||
|
+ {
|
||||||
|
+ // The pointer stored at *sendbuf can be modified by a realloc
|
||||||
|
+ // operation in ProcessDASrvRqst(). Fix up the local copy of
|
||||||
|
+ // that pointer if necessary.
|
||||||
|
+ result = *sendbuf;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (errorcode == 0)
|
||||||
|
{
|
||||||
|
/* Since we have an errorcode of 0, we were successful,
|
|
@ -0,0 +1,165 @@
|
||||||
|
diff -up openslp-2.0.0/common/slp_buffer.c.orig openslp-2.0.0/common/slp_buffer.c
|
||||||
|
--- openslp-2.0.0/common/slp_buffer.c.orig 2012-12-11 00:31:53.000000000 +0100
|
||||||
|
+++ openslp-2.0.0/common/slp_buffer.c 2019-12-09 10:39:16.422058793 +0100
|
||||||
|
@@ -30,6 +30,13 @@
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*-------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
+/* Copyright (c) 2019 VMware, Inc.
|
||||||
|
+ * SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
+ * This file is provided under the BSD-3-Clause license.
|
||||||
|
+ * See COPYING file for more details and other copyrights
|
||||||
|
+ * that may apply.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
/** Functions for managing SLP message buffers.
|
||||||
|
*
|
||||||
|
* This file provides a higher level abstraction over malloc and free that
|
||||||
|
@@ -153,4 +160,20 @@ void SLPBufferFree(SLPBuffer buf)
|
||||||
|
xfree(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
+/** Report remaining free buffer size in bytes.
|
||||||
|
+ *
|
||||||
|
+ * Check if buffer is allocated and if so return bytes left in a
|
||||||
|
+ * @c SLPBuffer object.
|
||||||
|
+ *
|
||||||
|
+ * @param[in] buf The SLPBuffer to be freed.
|
||||||
|
+ */
|
||||||
|
+size_t
|
||||||
|
+RemainingBufferSpace(SLPBuffer buf)
|
||||||
|
+{
|
||||||
|
+ if (buf->allocated == 0) {
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+ return buf->end - buf->curpos;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/*=========================================================================*/
|
||||||
|
diff -up openslp-2.0.0/common/slp_buffer.h.orig openslp-2.0.0/common/slp_buffer.h
|
||||||
|
--- openslp-2.0.0/common/slp_buffer.h.orig 2012-11-28 18:07:04.000000000 +0100
|
||||||
|
+++ openslp-2.0.0/common/slp_buffer.h 2019-12-09 10:39:16.422058793 +0100
|
||||||
|
@@ -30,6 +30,13 @@
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*-------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
+/* Copyright (c) 2019 VMware, Inc.
|
||||||
|
+ * SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
+ * This file is provided under the BSD-3-Clause license.
|
||||||
|
+ * See COPYING file for more details and other copyrights
|
||||||
|
+ * that may apply.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
/** Header file that defines SLP message buffer management routines.
|
||||||
|
*
|
||||||
|
* Includes structures, constants and functions that used to handle memory
|
||||||
|
@@ -78,6 +85,8 @@ SLPBuffer SLPBufferListRemove(SLPBuffer
|
||||||
|
|
||||||
|
SLPBuffer SLPBufferListAdd(SLPBuffer * list, SLPBuffer buf);
|
||||||
|
|
||||||
|
+size_t RemainingBufferSpace(SLPBuffer buf);
|
||||||
|
+
|
||||||
|
/*! @} */
|
||||||
|
|
||||||
|
#endif /* SLP_BUFFER_H_INCLUDED */
|
||||||
|
diff -up openslp-2.0.0/slpd/slpd_process.c.orig openslp-2.0.0/slpd/slpd_process.c
|
||||||
|
--- openslp-2.0.0/slpd/slpd_process.c.orig 2019-12-09 10:39:16.420058789 +0100
|
||||||
|
+++ openslp-2.0.0/slpd/slpd_process.c 2019-12-09 10:39:16.422058793 +0100
|
||||||
|
@@ -30,6 +30,13 @@
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*-------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
+/* Copyright (c) 2019 VMware, Inc.
|
||||||
|
+ * SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
+ * This file is provided under the BSD-3-Clause license.
|
||||||
|
+ * See COPYING file for more details and other copyrights
|
||||||
|
+ * that may apply.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
/** Processes incoming SLP messages.
|
||||||
|
*
|
||||||
|
* @file slpd_process.c
|
||||||
|
@@ -523,13 +530,27 @@ RESPOND:
|
||||||
|
{
|
||||||
|
for (i = 0; i < db->urlcount; i++)
|
||||||
|
{
|
||||||
|
- /* urlentry is the url from the db result */
|
||||||
|
urlentry = db->urlarray[i];
|
||||||
|
+ if (urlentry->opaque != NULL) {
|
||||||
|
+ const int64_t newsize = size + urlentry->opaquelen;
|
||||||
|
+ if (urlentry->opaquelen <= 0 || newsize > INT_MAX)
|
||||||
|
+ {
|
||||||
|
+ SLPDLog("Invalid opaquelen %d or sizeo of opaque url is too big, size=%d\n",
|
||||||
|
+ urlentry->opaquelen, size);
|
||||||
|
+ errorcode = SLP_ERROR_PARSE_ERROR;
|
||||||
|
+ goto FINISHED;
|
||||||
|
+ }
|
||||||
|
+ size += urlentry->opaquelen;
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ /* urlentry is the url from the db result */
|
||||||
|
+ size += urlentry->urllen + 6; /* 1 byte for reserved */
|
||||||
|
+ /* 2 bytes for lifetime */
|
||||||
|
+ /* 2 bytes for urllen */
|
||||||
|
+ /* 1 byte for authcount */
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- size += urlentry->urllen + 6; /* 1 byte for reserved */
|
||||||
|
- /* 2 bytes for lifetime */
|
||||||
|
- /* 2 bytes for urllen */
|
||||||
|
- /* 1 byte for authcount */
|
||||||
|
#ifdef ENABLE_SLPv2_SECURITY
|
||||||
|
/* make room to include the authblock that was asked for */
|
||||||
|
if (G_SlpdProperty.securityEnabled
|
||||||
|
@@ -603,7 +624,7 @@ RESPOND:
|
||||||
|
urlentry = db->urlarray[i];
|
||||||
|
|
||||||
|
#ifdef ENABLE_SLPv1
|
||||||
|
- if (urlentry->opaque == 0)
|
||||||
|
+ if (urlentry->opaque == NULL)
|
||||||
|
{
|
||||||
|
/* url-entry reserved */
|
||||||
|
*result->curpos++ = 0;
|
||||||
|
@@ -615,8 +636,18 @@ RESPOND:
|
||||||
|
PutUINT16(&result->curpos, urlentry->urllen);
|
||||||
|
|
||||||
|
/* url-entry url */
|
||||||
|
- memcpy(result->curpos, urlentry->url, urlentry->urllen);
|
||||||
|
- result->curpos += urlentry->urllen;
|
||||||
|
+ if (RemainingBufferSpace(result) >= urlentry->urllen)
|
||||||
|
+ {
|
||||||
|
+ memcpy(result->curpos, urlentry->url, urlentry->urllen);
|
||||||
|
+ result->curpos = result->curpos + urlentry->urllen;
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ SLPDLog("Url too big (ask: %d have %" PRId64 "), failing request\n",
|
||||||
|
+ urlentry->opaquelen, (int64_t) RemainingBufferSpace(result));
|
||||||
|
+ errorcode = SLP_ERROR_PARSE_ERROR;
|
||||||
|
+ goto FINISHED;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
/* url-entry auths */
|
||||||
|
*result->curpos++ = 0;
|
||||||
|
@@ -630,8 +661,18 @@ RESPOND:
|
||||||
|
|
||||||
|
/* TRICKY: Fix up the lifetime. */
|
||||||
|
TO_UINT16(urlentry->opaque + 1, urlentry->lifetime);
|
||||||
|
- memcpy(result->curpos, urlentry->opaque, urlentry->opaquelen);
|
||||||
|
- result->curpos += urlentry->opaquelen;
|
||||||
|
+ if (RemainingBufferSpace(result) >= urlentry->opaquelen)
|
||||||
|
+ {
|
||||||
|
+ memcpy(result->curpos, urlentry->opaque, urlentry->opaquelen);
|
||||||
|
+ result->curpos = result->curpos + urlentry->opaquelen;
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ SLPDLog("Opaque Url too big (ask: %d have %" PRId64 "), failing request\n",
|
||||||
|
+ urlentry->opaquelen, (int64_t) RemainingBufferSpace(result));
|
||||||
|
+ errorcode = SLP_ERROR_PARSE_ERROR;
|
||||||
|
+ goto FINISHED;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,145 @@
|
||||||
|
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 2017-10-04 12:50:36.672953246 +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'
|
||||||
|
@@ -36,8 +13,8 @@ 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_ADD_ROUTE="route add -net 224.0.0.0 netmask 240.0.0.0"
|
||||||
|
+ CMD_GET_INTERFACE="ip -o link show | awk 'BEGIN{FS=\": \"}!/^:digit:+: lo:.*/{print \$2}'"
|
||||||
|
+ CMD_ADD_ROUTE="ip route add 224.0.0.0/4 dev"
|
||||||
|
|
||||||
|
err_unreachable_found=`ping $PING_OPTIONS_1 $MULTICAST_ADDRESS 2>&1 1>/dev/null`
|
||||||
|
|
||||||
|
@@ -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
|
|
@ -0,0 +1,39 @@
|
||||||
|
exporting patch:
|
||||||
|
# HG changeset patch
|
||||||
|
# User Stephen Gallagher <sgallagh@redhat.com>
|
||||||
|
# Date 1394805577 14400
|
||||||
|
# Fri Mar 14 09:59:37 2014 -0400
|
||||||
|
# Node ID ff9067316db43f8e1204c0a7a743574c9f94feb5
|
||||||
|
# Parent 598821da69f2f26b1e76447bfecf139a4210ad48
|
||||||
|
Notify systemd of start-up completion
|
||||||
|
|
||||||
|
diff -r 598821da69f2 -r ff9067316db4 openslp/slpd/Makefile.am
|
||||||
|
--- a/openslp/slpd/Makefile.am Sat Jun 08 15:14:45 2013 -0600
|
||||||
|
+++ b/openslp/slpd/Makefile.am Fri Mar 14 09:59:37 2014 -0400
|
||||||
|
@@ -93,5 +93,5 @@
|
||||||
|
slpd_index.h
|
||||||
|
|
||||||
|
#if you're building on Irix, replace .la with .a below
|
||||||
|
-slpd_LDADD = ../common/libcommonslpd.la ../libslpattr/libslpattr.la
|
||||||
|
+slpd_LDADD = ../common/libcommonslpd.la ../libslpattr/libslpattr.la -lsystemd
|
||||||
|
|
||||||
|
diff -r 598821da69f2 -r ff9067316db4 openslp/slpd/slpd_main.c
|
||||||
|
--- a/openslp/slpd/slpd_main.c Sat Jun 08 15:14:45 2013 -0600
|
||||||
|
+++ b/openslp/slpd/slpd_main.c Fri Mar 14 09:59:37 2014 -0400
|
||||||
|
@@ -58,6 +58,8 @@
|
||||||
|
#include "slp_xid.h"
|
||||||
|
#include "slp_net.h"
|
||||||
|
|
||||||
|
+#include <systemd/sd-daemon.h>
|
||||||
|
+
|
||||||
|
int G_SIGALRM;
|
||||||
|
int G_SIGTERM;
|
||||||
|
int G_SIGHUP;
|
||||||
|
@@ -666,6 +668,7 @@
|
||||||
|
|
||||||
|
/* Main loop */
|
||||||
|
SLPDLog("Startup complete entering main run loop ...\n\n");
|
||||||
|
+ sd_notify(0, "READY=1");
|
||||||
|
G_SIGALRM = 0;
|
||||||
|
G_SIGTERM = 0;
|
||||||
|
G_SIGHUP = 0;
|
|
@ -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);
|
||||||
|
}
|
|
@ -0,0 +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-10-04 09:38:48.469999889 +0200
|
||||||
|
@@ -88,11 +88,24 @@ SLPCryptoDSAKey * SLPCryptoDSAKeyDup(SLP
|
||||||
|
result = DSA_new();
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
+#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 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;
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
[Unit]
|
||||||
|
Description=OpenSLP daemon for the Service Location Protocol
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=forking
|
||||||
|
ExecStart=/usr/bin/slpd -c /etc/openslp/slp.conf -r /etc/openslp/slp.reg -s /etc/openslp/slp.spi
|
||||||
|
ExecReload=/bin/kill -HUP $MAINPID
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
After=network.target
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,41 @@
|
||||||
|
name : openslp
|
||||||
|
version : 2.0.0
|
||||||
|
release : 1
|
||||||
|
source :
|
||||||
|
- http://downloads.sf.net/openslp/openslp-2.0.0.tar.gz : 924337a2a8e5be043ebaea2a78365c7427ac6e9cee24610a0780808b2ba7579b
|
||||||
|
homepage : http://www.openslp.org
|
||||||
|
license : BSD
|
||||||
|
component : system.utils
|
||||||
|
summary : Service Location Protocol (SLP) is an Internet Engineering Task Force (IETF) standards track protocol that provides a framework to allow networking applications to discover the existence, location, and configuration of networked services in enterprise networks.
|
||||||
|
description: |
|
||||||
|
Service Location Protocol (SLP) is an Internet Engineering Task Force (IETF) standards track protocol that provides a framework to allow networking applications to discover the existence, location, and configuration of networked services in enterprise networks.
|
||||||
|
setup : |
|
||||||
|
%patch -p1 < $pkgfiles/openslp-2.0.0-multicast-set.patch
|
||||||
|
%patch -p2 < $pkgfiles/openslp-2.0.0-notify-systemd-of-start-up.patch
|
||||||
|
%patch -p1 < $pkgfiles/openslp-2.0.0-null-pointer-deref.patch
|
||||||
|
%patch -p1 < $pkgfiles/openslp-2.0.0-openssl-1.1-fix.patch
|
||||||
|
%patch -p1 < $pkgfiles/openslp-2.0.0-cve-2016-7567.patch
|
||||||
|
%patch -p1 < $pkgfiles/openslp-2.0.0-cve-2017-17833.patch
|
||||||
|
%patch -p1 < $pkgfiles/openslp-2.0.0-cve-2019-5544.patch
|
||||||
|
|
||||||
|
autoreconf -f -i
|
||||||
|
find . -name "CVS" | xargs rm -rf
|
||||||
|
|
||||||
|
%configure \
|
||||||
|
--prefix=/usr \
|
||||||
|
--sbindir=/usr/bin \
|
||||||
|
--sysconfdir=/etc/openslp \
|
||||||
|
--localstatedir=/var \
|
||||||
|
--enable-slpv1 \
|
||||||
|
--enable-slpv2-security \
|
||||||
|
--enable-async-api \
|
||||||
|
--disable-dependency-tracking \
|
||||||
|
--disable-static
|
||||||
|
build : |
|
||||||
|
%make
|
||||||
|
install : |
|
||||||
|
%make_install
|
||||||
|
|
||||||
|
install -Dm 00644 $pkgfiles/openslp.service $installdir/usr/lib/systemd/system/openslp.service
|
||||||
|
install -Dm 00644 $pkgfiles/slpd.8.gz $installdir/usr/share/man/man8/slpd.8.gz
|
||||||
|
install -Dm 00644 $pkgfiles/slptool.1.gz $installdir/usr/share/man/man1/slptool.1.gz
|
Loading…
Reference in New Issue