Измненеие сборки версии 2.0.0
All checks were successful
Build / Build project (push) Successful in 57s
All checks were successful
Build / Build project (push) Successful in 57s
Исходный код взят с GitHub с последними актуальными коммитами. Добавлена русскоязычная документация. Пути к конфигурационным файлам заданы по умолчанию в /usr/share/defaults/etc/openslp, но могут переопределяться в /etc/openslp.
This commit is contained in:
parent
2ce0a0601c
commit
af925eca6d
18 changed files with 413 additions and 213 deletions
145
files/default_patches/0001-openslp-2.0.0-multicast-set.patch
Normal file
145
files/default_patches/0001-openslp-2.0.0-multicast-set.patch
Normal file
|
@ -0,0 +1,145 @@
|
|||
diff -up a/etc/slpd.all_init.orig b/etc/slpd.all_init
|
||||
--- a/etc/slpd.all_init.orig 2012-11-28 18:07:04.000000000 +0100
|
||||
+++ b/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,32 @@
|
|||
diff --git a/slpd/Makefile.am b/slpd/Makefile.am
|
||||
index c94dd6a..ca0f702 100644
|
||||
--- a/slpd/Makefile.am
|
||||
+++ b/slpd/Makefile.am
|
||||
@@ -93,5 +93,5 @@ noinst_HEADERS = \
|
||||
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 --git a/slpd/slpd_main.c b/slpd/slpd_main.c
|
||||
index 130497e..6359c4b 100644
|
||||
--- a/slpd/slpd_main.c
|
||||
+++ b/slpd/slpd_main.c
|
||||
@@ -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;
|
||||
@@ -668,6 +670,7 @@ int main(int argc, char * argv[])
|
||||
|
||||
/* 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;
|
172
files/default_patches/0003-openslp-2.0.0-cve-2019-5544.patch
Normal file
172
files/default_patches/0003-openslp-2.0.0-cve-2019-5544.patch
Normal file
|
@ -0,0 +1,172 @@
|
|||
diff -up a/common/slp_buffer.c.orig b/common/slp_buffer.c
|
||||
--- a/common/slp_buffer.c.orig 2012-12-11 00:31:53.000000000 +0100
|
||||
+++ b/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 a/common/slp_buffer.h.orig b/common/slp_buffer.h
|
||||
--- a/common/slp_buffer.h.orig 2012-11-28 18:07:04.000000000 +0100
|
||||
+++ b/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 --git a/slpd/slpd_process.c b/slpd/slpd_process.c
|
||||
index 0698ab8..935f6c9 100644
|
||||
--- a/slpd/slpd_process.c
|
||||
+++ b/slpd/slpd_process.c
|
||||
@@ -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;
|
||||
@@ -628,14 +659,18 @@ RESPOND:
|
||||
|
||||
/* TRICKY: Fix up the lifetime. */
|
||||
TO_UINT16(urlentry->opaque + 1, urlentry->lifetime);
|
||||
- memcpy(result->curpos, urlentry->opaque, urlentry->opaquelen);
|
||||
-
|
||||
- /* TRICKY: Fix up the result authblock count. */
|
||||
- if (urlentry->authcount)
|
||||
- result->curpos[1 + 2 + 2 + urlentry->urllen] = (uint8_t)urlentry->authcount;
|
||||
- /* 1 reserved + 2 lifetime + 2 url length */
|
||||
-
|
||||
- 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;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue