Измненеие сборки версии 2.0.0
All checks were successful
Build / Build project (push) Successful in 57s

Исходный код взят с GitHub с последними актуальными коммитами.
Добавлена русскоязычная документация.
Пути к конфигурационным файлам заданы по умолчанию в /usr/share/defaults/etc/openslp, но могут переопределяться в /etc/openslp.
This commit is contained in:
Alexander Zhirov 2025-05-06 21:53:19 +03:00
parent 2ce0a0601c
commit af925eca6d
Signed by: alexander
GPG key ID: C8D8BE544A27C511
18 changed files with 413 additions and 213 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 2017-10-04 12:50:36.672953246 +0200
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
-#

View file

@ -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;

View file

@ -1,6 +1,6 @@
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
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.
*-------------------------------------------------------------------------*/
@ -36,9 +36,9 @@ diff -up openslp-2.0.0/common/slp_buffer.c.orig openslp-2.0.0/common/slp_buffer.
+}
+
/*=========================================================================*/
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
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.
*-------------------------------------------------------------------------*/
@ -62,9 +62,10 @@ diff -up openslp-2.0.0/common/slp_buffer.h.orig openslp-2.0.0/common/slp_buffer.
/*! @} */
#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
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.
*-------------------------------------------------------------------------*/
@ -142,11 +143,17 @@ diff -up openslp-2.0.0/slpd/slpd_process.c.orig openslp-2.0.0/slpd/slpd_process.
/* url-entry auths */
*result->curpos++ = 0;
@@ -630,8 +661,18 @@ RESPOND:
@@ -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)
+ {

42
files/man/en/slpd.8 Normal file
View file

@ -0,0 +1,42 @@
.TH SLPD "8" "March 2025" "slpd 2.0.0" "System Administration Utilities"
.SH NAME
slpd \- SLP daemon
.SH SYNOPSIS
.B slpd
[\-d] [\-c configfile] [\-l logfile] [\-r registrationfile] [\-s spifile] [\-p pidfile] [\-v version]
.SH OPTIONS
.IP
.TP
.BI \-d\fR
Don't detach from the controlling tty.
.TP
.BI \-c\ configfile \fR
Use
.IR configfile
as the file slpd reads to obtain configuration information, rather than the default,
.IR /usr/share/defaults/etc/openslp/slp.conf
or
.IR /etc/openslp/slp.conf .
.TP
.BI \-l\ logfile \fR
Use
.IR logfile
as the file that slpd reads to write log messages, rather than the default,
.IR /var/log/slpd.log .
.TP
.BI \-l\ registrationfile \fR
Use
.IR registrationfile
as the file that slpd reads to obtain static registrations, rather than the default,
.IR /usr/share/defaults/etc/openslp/slp.reg
or
.IR /etc/openslp/slp.reg .
.TP
.BI \-l\ pidfile \fR
Use
.IR pidfile
as the file that holds the slpd process id, rather than the default,
.IR /var/run/slpd.pid .
.TP
.BI \-v\fR
Show slpd version and compile options.

63
files/man/en/slptool.1 Normal file
View file

@ -0,0 +1,63 @@
.TH SLPTOOL "1" "May 2013" "slptool 2.0.beta2" "User Commands"
.SH NAME
slptool \- SLP command line tool
.SH SYNOPSIS
.B slptool
[\fIoptions\fR] \fIcommand-and-arguments\fR
.SH OPTIONS
.IP
options may be:
.HP
\fB\-v\fR (or \fB\-\-version\fR) displays the versions of slptool and OpenSLP.
.HP
\fB\-s\fR (or \fB\-\-scope\fR) followed by a comma\-separated list of scopes.
.HP
\fB\-l\fR (or \fB\-\-language\fR) followed by a language tag.
.HP
\fB\-t\fR (or \fB\-\-time\fR) followed by a lifetime tag.
.HP
\fB\-i\fR (or \fB\-\-interfaces\fR) followed by a comma\-separated list of interfaces.
.HP
\fB\-u\fR (or \fB\-\-unicastifc\fR) followed by a single interface.
.IP
command\-and\-arguments may be:
.IP
.HP
findsrvs service\-type [filter]
.HP
findattrs url [attrids]
.HP
findsrvtypes [authority]
.HP
findscopes
.HP
register url [attrs]
.HP
deregister url
.HP
getproperty propertyname
.SH EXAMPLES
.IP
.HP
slptool register service:myserv.x://myhost.com "(attr1=val1),(attr2=val2)"
.HP
slptool findsrvs service:myserv.x
.HP
slptool findsrvs service:myserv.x "(attr1=val1)"
.HP
slptool \fB\-i\fR 10.77.13.240,192.168.250.240 findsrvs service:myserv.x
.HP
slptool \fB\-u\fR 10.77.13.237 findsrvs service:myserv.x "(attr1=val1)"
.HP
slptool findattrs service:myserv.x://myhost.com
.HP
slptool findattrs service:myserv.x://myhost.com attr1
.HP
slptool \fB\-i\fR 10.77.13.243 findattrs service:myserv.x://myhost.com attr1
.HP
slptool \fB\-u\fR 10.77.13.237 findattrs service:myserv.x://myhost.com attr1
.HP
slptool deregister service:myserv.x://myhost.com
.HP
slptool getproperty net.slp.useScopes
.PP

42
files/man/ru/slpd.8 Normal file
View file

@ -0,0 +1,42 @@
.TH SLPD "8" "Май 2025" "slpd 2.0" "Утилиты системного администрирования"
.SH ИМЯ
slpd \- демон SLP
.SH СИНТАКСИС
.B slpd
[\-d] [\-c файл_конфигурации] [\-l файл_журнала] [\-r файл_регистрации] [\-s файл_spi] [\-p файл_pid] [\-v версия]
.SH ОПЦИИ
.IP
.TP
.BI \-d\fR
Не отключаться от управляющего терминала.
.TP
.BI \-c\ файл_конфигурации \fR
Использовать
.IR файл_конфигурации
в качестве файла, который slpd читает для получения конфигурационной информации, вместо стандартного
.IR /usr/share/defaults/etc/openslp/slp.conf
или
.IR /etc/openslp/slp.conf .
.TP
.BI \-l\ файл_журнала \fR
Использовать
.IR файл_журнала
в качестве файла, в который slpd записывает сообщения журнала, вместо стандартного
.IR /var/log/slpd.log .
.TP
.BI \-r\ файл_регистрации \fR
Использовать
.IR файл_регистрации
в качестве файла, который slpd читает для получения статических регистраций, вместо стандартного
.IR /usr/share/defaults/etc/openslp/slp.reg
или
.IR /etc/openslp/slp.reg .
.TP
.BI \-p\ файл_pid \fR
Использовать
.IR файл_pid
в качестве файла, содержащего идентификатор процесса slpd, вместо стандартного
.IR /var/run/slpd.pid .
.TP
.BI \-v\fR
Показать версию slpd и параметры компиляции.

63
files/man/ru/slptool.1 Normal file
View file

@ -0,0 +1,63 @@
.TH SLPTOOL "1" "Май 2025" "slptool 2.0" "Команды пользователя"
.SH ИМЯ
slptool \- командный инструмент SLP
.SH СИНТАКСИС
.B slptool
[\fIопции\fR] \fIкоманда-и-аргументы\fR
.SH ОПЦИИ
.IP
Опции могут быть:
.HP
\fB\-v\fR (или \fB\-\-version\fR) отображает версии slptool и OpenSLP.
.HP
\fB\-s\fR (или \fB\-\-scope\fR) с последующим списком областей, разделённых запятыми.
.HP
\fB\-l\fR (или \fB\-\-language\fR) с последующим тегом языка.
.HP
\fB\-t\fR (или \fB\-\-time\fR) с последующим тегом времени жизни.
.HP
\fB\-i\fR (или \fB\-\-interfaces\fR) с последующим списком интерфейсов, разделённых запятыми.
.HP
\fB\-u\fR (или \fB\-\-unicastifc\fR) с последующим одиночным интерфейсом.
.IP
Команда-и-аргументы могут быть:
.IP
.HP
findsrvs тип_службы [фильтр]
.HP
findattrs url [идентификаторы_атрибутов]
.HP
findsrvtypes [авторизация]
.HP
findscopes
.HP
register url [атрибуты]
.HP
deregister url
.HP
getproperty имя_свойства
.SH ПРИМЕРЫ
.IP
.HP
slptool register service:myserv.x://myhost.com "(attr1=val1),(attr2=val2)"
.HP
slptool findsrvs service:myserv.x
.HP
slptool findsrvs service:myserv.x "(attr1=val1)"
.HP
slptool \fB\-i\fR 10.77.13.240,192.168.250.240 findsrvs service:myserv.x
.HP
slptool \fB\-u\fR 10.77.13.237 findsrvs service:myserv.x "(attr1=val1)"
.HP
slptool findattrs service:myserv.x://myhost.com
.HP
slptool findattrs service:myserv.x://myhost.com attr1
.HP
slptool \fB\-i\fR 10.77.13.243 findattrs service:myserv.x://myhost.com attr1
.HP
slptool \fB\-u\fR 10.77.13.237 findattrs service:myserv.x://myhost.com attr1
.HP
slptool deregister service:myserv.x://myhost.com
.HP
slptool getproperty net.slp.useScopes
.PP

View file

@ -1,90 +0,0 @@
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);

View file

@ -1,19 +0,0 @@
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,

View file

@ -1,39 +0,0 @@
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;

View file

@ -1,12 +0,0 @@
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

@ -1,28 +0,0 @@
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;
}

View file

@ -4,7 +4,7 @@ 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
ExecStart=/usr/bin/slpd
ExecReload=/bin/kill -HUP $MAINPID
[Install]

4
files/series Normal file
View file

@ -0,0 +1,4 @@
default_patches/0001-openslp-2.0.0-multicast-set.patch
default_patches/0002-openslp-2.0.0-notify-systemd-of-start-up.patch
default_patches/0003-openslp-2.0.0-cve-2019-5544.patch
solus_patches/0004-stateless.patch

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,115 @@
From: Alexander Zhirov <azhirov1991@gmail.com>
Date: Tue, 06 May 2025 19:15:37 +0300
Subject: The default paths to the configuration files have been changed.
diff --git a/common/slp_types.h b/common/slp_types.h
index 9714a50..478155b 100644
--- a/common/slp_types.h
+++ b/common/slp_types.h
@@ -231,8 +231,11 @@ typedef unsigned long uint32_t;
# endif
# define SLPD_CONFFILE ETCDIR "/slp.conf"
+# define SLPD_CONFFILE_STATELESS "/usr/share/defaults/etc/openslp/slp.conf"
# define SLPD_REGFILE ETCDIR "/slp.reg"
+# define SLPD_REGFILE_STATELESS "/usr/share/defaults/etc/openslp/slp.reg"
# define SLPD_SPIFILE ETCDIR "/slp.spi"
+# define SLPD_SPIFILE_STATELESS "/usr/share/defaults/etc/openslp/slp.spi"
# define SLPD_LOGFILE VARDIR "/log/slpd.log"
# define SLPD_PIDFILE VARDIR "/run/slpd.pid"
diff --git a/libslp/libslp_handle.c b/libslp/libslp_handle.c
index b938345..d75314a 100644
--- a/libslp/libslp_handle.c
+++ b/libslp/libslp_handle.c
@@ -65,7 +65,11 @@ static SLPError InitUserAgentLibrary(void)
/* Initialize the system if this is the first handle opened. */
if (SLPAtomicInc(&s_OpenSLPHandleCount) == 1)
{
- if (LIBSLPPropertyInit(LIBSLP_CONFFILE) != 0)
+ const char *slp_conf_file_name = LIBSLP_CONFFILE;
+ if (access(slp_conf_file_name, R_OK) != 0)
+ slp_conf_file_name = SLPD_CONFFILE_STATELESS;
+
+ if (LIBSLPPropertyInit(slp_conf_file_name) != 0)
{
SLPAtomicDec(&s_OpenSLPHandleCount);
return SLP_MEMORY_ALLOC_FAILED;
@@ -221,7 +225,11 @@ SLPEXP SLPError SLPAPI SLPOpen(
}
#ifdef ENABLE_SLPv2_SECURITY
- handle->hspi = SLPSpiOpen(LIBSLP_SPIFILE, 0);
+ const char *slp_spi_file_name = LIBSLP_SPIFILE;
+ if (access(slp_spi_file_name, R_OK) != 0)
+ slp_spi_file_name = SLPD_SPIFILE_STATELESS;
+
+ handle->hspi = SLPSpiOpen(slp_spi_file_name, 0);
if (!handle->hspi)
{
xfree(handle->langtag);
diff --git a/libslp/libslp_property.c b/libslp/libslp_property.c
index f645b93..913d39b 100644
--- a/libslp/libslp_property.c
+++ b/libslp/libslp_property.c
@@ -115,8 +115,12 @@ SLPEXP const char * SLPAPI SLPGetProperty(const char * pcName)
if (!pcName || !*pcName)
return 0;
+ const char *slp_conf_file_name = LIBSLP_CONFFILE;
+ if (access(slp_conf_file_name, R_OK) != 0)
+ slp_conf_file_name = SLPD_CONFFILE_STATELESS;
+
/* This wrapper ensures that we only get initialized once */
- if (!s_PropInited && LIBSLPPropertyInit(LIBSLP_CONFFILE) != 0)
+ if (!s_PropInited && LIBSLPPropertyInit(slp_conf_file_name) != 0)
return 0;
/* At this point, the caller may no longer call SLPSetProperty because
@@ -157,8 +161,12 @@ SLPEXP void SLPAPI SLPSetProperty(const char * pcName, const char * pcValue)
if (!pcName || !*pcName)
return;
+ const char *slp_conf_file_name = LIBSLP_CONFFILE;
+ if (access(slp_conf_file_name, R_OK) != 0)
+ slp_conf_file_name = SLPD_CONFFILE_STATELESS;
+
/* This wrapper ensures that we only get initialized once */
- if (!s_PropInited && LIBSLPPropertyInit(LIBSLP_CONFFILE) != 0)
+ if (!s_PropInited && LIBSLPPropertyInit(slp_conf_file_name) != 0)
return;
if (s_UserAllowedToSet)
diff --git a/slpd/slpd_cmdline.c b/slpd/slpd_cmdline.c
index 177833e..7f47436 100644
--- a/slpd/slpd_cmdline.c
+++ b/slpd/slpd_cmdline.c
@@ -85,14 +85,25 @@ int SLPDParseCommandLine(int argc, char * argv[])
{
int i;
+ const char *slp_spi_file_name = SLPD_SPIFILE;
+ const char *slp_reg_file_name = SLPD_REGFILE;
+ const char *slp_conf_file_name = SLPD_CONFFILE;
+
+ if (access(slp_spi_file_name, R_OK) != 0)
+ slp_spi_file_name = SLPD_SPIFILE_STATELESS;
+ if (access(slp_reg_file_name, R_OK) != 0)
+ slp_reg_file_name = SLPD_REGFILE_STATELESS;
+ if (access(slp_conf_file_name, R_OK) != 0)
+ slp_conf_file_name = SLPD_CONFFILE_STATELESS;
+
/* Set defaults */
memset(&G_SlpdCommandLine, 0, sizeof(SLPDCommandLine));
- strnenv(G_SlpdCommandLine.cfgfile, SLPD_CONFFILE, sizeof(G_SlpdCommandLine.cfgfile));
+ strnenv(G_SlpdCommandLine.cfgfile, slp_conf_file_name, sizeof(G_SlpdCommandLine.cfgfile));
strnenv(G_SlpdCommandLine.logfile, SLPD_LOGFILE, sizeof(G_SlpdCommandLine.logfile));
- strnenv(G_SlpdCommandLine.regfile, SLPD_REGFILE, sizeof(G_SlpdCommandLine.regfile));
+ strnenv(G_SlpdCommandLine.regfile, slp_reg_file_name, sizeof(G_SlpdCommandLine.regfile));
strnenv(G_SlpdCommandLine.pidfile, SLPD_PIDFILE, sizeof(G_SlpdCommandLine.pidfile));
#ifdef ENABLE_SLPv2_SECURITY
- strnenv(G_SlpdCommandLine.spifile, SLPD_SPIFILE, sizeof(G_SlpdCommandLine.spifile));
+ strnenv(G_SlpdCommandLine.spifile, slp_spi_file_name, sizeof(G_SlpdCommandLine.spifile));
#endif
G_SlpdCommandLine.action = -1;

View file

@ -1,8 +1,11 @@
name : openslp
version : 2.0.0
release : 1
release : 2
source :
- http://downloads.sf.net/openslp/openslp-2.0.0.tar.gz : 924337a2a8e5be043ebaea2a78365c7427ac6e9cee24610a0780808b2ba7579b
# The official repository has moved from SourceForge to GitHub.
# No releases have been made since 2013, but there is an abundance of commits with fixes.
# Therefore, the git source was used as the source code.
- git|https://github.com/openslp-org/openslp.git : f8dd97d68bdcf4af58d973d9eb97f4cddd149fe7
homepage : http://www.openslp.org
license : BSD
component : system.utils
@ -10,13 +13,10 @@ summary : Service Location Protocol (SLP) is an Internet Engineering Task For
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
# The path in the official repository has become nested, a transition is required.
cd openslp
%apply_patches
autoreconf -f -i
find . -name "CVS" | xargs rm -rf
@ -32,11 +32,31 @@ setup : |
--disable-dependency-tracking \
--disable-static
build : |
cd openslp
%make
# Preparation of man pages
gzip -c $pkgfiles/man/en/slptool.1 > slptool.1.gz.en
gzip -c $pkgfiles/man/en/slpd.8 > slpd.8.gz.en
gzip -c $pkgfiles/man/ru/slptool.1 > slptool.1.gz.ru
gzip -c $pkgfiles/man/ru/slpd.8 > slpd.8.gz.ru
install : |
cd openslp
%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
install -Dm 00644 $pkgfiles/slp.pc $installdir/usr/lib64/pkgconfig/slp.pc
install -Dm 00644 slptool.1.gz.en $installdir/usr/share/man/man1/slptool.1.gz
install -Dm 00644 slpd.8.gz.en $installdir/usr/share/man/man8/slpd.8.gz
install -Dm 00644 slptool.1.gz.ru $installdir/usr/share/man/ru/man1/slptool.1.gz
install -Dm 00644 slpd.8.gz.ru $installdir/usr/share/man/ru/man8/slpd.8.gz
install -dm00755 $installdir/usr/share/defaults/etc/
mv $installdir/etc/openslp $installdir/usr/share/defaults/etc/
rmdir $installdir/etc
rmdir $installdir/var/log
rmdir $installdir/var