From 6b36b7da3238b7cdd9e2ecfb6d2dbea910112db4 Mon Sep 17 00:00:00 2001 From: Alexander Zhirov Date: Wed, 7 May 2025 01:04:23 +0300 Subject: [PATCH] =?UTF-8?q?=D0=92=D0=BD=D0=B5=D0=B4=D1=80=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BF=D0=B0=D1=82=D1=87=D0=B0=20=D1=81=20=D1=83?= =?UTF-8?q?=D0=BB=D1=83=D1=87=D1=88=D0=B5=D0=BD=D0=B8=D1=8F=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../0005-fix-interfaces-scope-list.patch | 158 ++++++++++++++++++ files/series | 1 + package.yml | 4 +- 3 files changed, 161 insertions(+), 2 deletions(-) create mode 100644 files/default_patches/0005-fix-interfaces-scope-list.patch diff --git a/files/default_patches/0005-fix-interfaces-scope-list.patch b/files/default_patches/0005-fix-interfaces-scope-list.patch new file mode 100644 index 0000000..04c8d34 --- /dev/null +++ b/files/default_patches/0005-fix-interfaces-scope-list.patch @@ -0,0 +1,158 @@ +Subject: https://github.com/openslp-org/openslp/compare/1bc8dadd446ffca391422da6e924f1395c7008bc...forssea-robotics:openslp:667b30026d90e0e9e87763663b18bfa75c72e1e3?diff=unified&w +diff --git a/libslp/libslp_dereg.c b/libslp/libslp_dereg.c +index 1eb7c03..e764224 100644 +--- a/libslp/libslp_dereg.c ++++ b/libslp/libslp_dereg.c +@@ -212,6 +212,7 @@ static SLPError AsyncProcessSrvDeReg(SLPHandleInfo * handle) + SLPError SLPAPI SLPDereg( + SLPHandle hSLP, + const char * srvUrl, ++ const char * pcScopeList, + SLPRegReport callback, + void * cookie) + { +@@ -244,8 +245,11 @@ SLPError SLPAPI SLPDereg( + if (inuse) + return SLP_HANDLE_IN_USE; + ++ if (!pcScopeList || *pcScopeList == 0) ++ pcScopeList = SLPPropertyGet("net.slp.useScopes", 0, 0); ++ + /* Set the handle up to reference parameters. */ +- handle->params.dereg.scopelist = SLPPropertyGet("net.slp.useScopes", 0, 0); ++ handle->params.dereg.scopelist = pcScopeList; + handle->params.dereg.scopelistlen = strlen(handle->params.dereg.scopelist); + handle->params.dereg.urllen = strlen(srvUrl); + handle->params.dereg.url = srvUrl; +diff --git a/libslp/libslp_reg.c b/libslp/libslp_reg.c +index dffc8b9..3894aef 100644 +--- a/libslp/libslp_reg.c ++++ b/libslp/libslp_reg.c +@@ -315,6 +315,7 @@ SLPEXP SLPError SLPAPI SLPReg( + unsigned short lifetime, + const char * srvType, + const char * attrList, ++ const char * pcScopeList, + SLPBoolean fresh, + SLPRegReport callback, + void * cookie) +@@ -363,6 +364,9 @@ SLPEXP SLPError SLPAPI SLPReg( + return serr == SLP_PARSE_ERROR? SLP_INVALID_REGISTRATION: serr; + } + ++ if (!pcScopeList || *pcScopeList == 0) ++ pcScopeList = SLPPropertyGet("net.slp.useScopes", 0, 0); ++ + /* Set the handle up to reference parameters. */ + handle->params.reg.fresh = fresh; + handle->params.reg.lifetime = lifetime; +@@ -370,7 +374,7 @@ SLPEXP SLPError SLPAPI SLPReg( + handle->params.reg.url = srvUrl; + handle->params.reg.srvtype = parsedurl->s_pcSrvType; + handle->params.reg.srvtypelen = strlen(handle->params.reg.srvtype); +- handle->params.reg.scopelist = SLPPropertyGet("net.slp.useScopes", 0, 0); ++ handle->params.reg.scopelist = pcScopeList; + handle->params.reg.scopelistlen = strlen(handle->params.reg.scopelist); + handle->params.reg.attrlistlen = strlen(attrList); + handle->params.reg.attrlist = attrList; +diff --git a/libslp/slp.h b/libslp/slp.h +index 4568fb6..0aaa202 100644 +--- a/libslp/slp.h ++++ b/libslp/slp.h +@@ -251,7 +251,7 @@ typedef enum { + * + * The SLPBoolean enum is used as a boolean flag. + */ +-typedef enum { ++typedef enum SLPBoolean { + SLP_FALSE = 0, + SLP_TRUE = 1 + } SLPBoolean; +@@ -470,6 +470,7 @@ SLPEXP SLPError SLPAPI SLPReg( + unsigned short usLifetime, + const char * pcSrvType, + const char * pcAttrs, ++ const char * pcScopeList, + SLPBoolean fresh, + SLPRegReport callback, + void * pvCookie); +@@ -480,6 +481,7 @@ SLPEXP SLPError SLPAPI SLPReg( + SLPEXP SLPError SLPAPI SLPDereg( + SLPHandle hSLP, + const char * pcSrvURL, ++ const char * pcScopeList, + SLPRegReport callback, + void * pvCookie); + +diff --git a/slpd/slpd_main.c b/slpd/slpd_main.c +index 130497e..d7fa705 100644 +--- a/slpd/slpd_main.c ++++ b/slpd/slpd_main.c +@@ -653,7 +653,14 @@ int main(int argc, char * argv[]) + || SLPDOutgoingInit() + || SLPDKnownDAInit()) + SLPDFatal("slpd initialization failed\n"); +- SLPDLog("Agent Interfaces = %s\n", G_SlpdProperty.interfaces); ++ ++ /* Stop slpd until interfaces is null (unknown) */ ++ if (G_SlpdProperty.interfaces == NULL) { ++ SLPDFatal("No agent interfaces found\n"); ++ } else { ++ SLPDLog("Agent Interfaces = %s\n", G_SlpdProperty.interfaces); ++ } ++ + if (G_SlpdProperty.port != SLP_RESERVED_PORT) + SLPDLog("Using port %d instead of default %d\n", G_SlpdProperty.port, SLP_RESERVED_PORT); + +diff --git a/slptool/slptool.c b/slptool/slptool.c +index 6fe9329..81572e2 100644 +--- a/slptool/slptool.c ++++ b/slptool/slptool.c +@@ -261,6 +261,7 @@ void Register(SLPToolCommandLine * cmdline) + char srvtype[80] = "", * s; + size_t len = 0; + unsigned int lt = 0; ++ const char *scopes; + + if (cmdline->time) { + lt = atoi(cmdline->time); +@@ -283,16 +284,18 @@ void Register(SLPToolCommandLine * cmdline) + SLPSetProperty("net.slp.watchRegistrationPID", 0); + + if ((cmdline->scopes != 0) && (*cmdline->scopes != 0)) +- SLPSetProperty("net.slp.useScopes", cmdline->scopes); ++ scopes = cmdline->scopes; ++ else ++ scopes = "DEFAULT"; + + if (SLPOpen(cmdline->lang, SLP_FALSE, &hslp) == SLP_OK) + { + if (!lt || lt > SLP_LIFETIME_MAXIMUM) + result = SLPReg(hslp, cmdline->cmdparam1, SLP_LIFETIME_MAXIMUM, srvtype, +- cmdline->cmdparam2, SLP_TRUE, mySLPRegReport, 0); ++ cmdline->cmdparam2, scopes, SLP_TRUE, mySLPRegReport, 0); + else + result = SLPReg(hslp, cmdline->cmdparam1, (unsigned short)lt, srvtype, +- cmdline->cmdparam2, SLP_TRUE, mySLPRegReport, 0); ++ cmdline->cmdparam2, scopes, SLP_TRUE, mySLPRegReport, 0); + if (result != SLP_OK) + printf("errorcode: %i\n", result); + SLPClose(hslp); +@@ -303,10 +306,16 @@ void Deregister(SLPToolCommandLine * cmdline) + { + SLPError result; + SLPHandle hslp; ++ const char *scopes; ++ ++ if ((cmdline->scopes != 0) && (*cmdline->scopes != 0)) ++ scopes = cmdline->scopes; ++ else ++ scopes = "DEFAULT"; + + if (SLPOpen(cmdline->lang, SLP_FALSE, &hslp) == SLP_OK) + { +- result = SLPDereg(hslp, cmdline->cmdparam1, mySLPRegReport, 0); ++ result = SLPDereg(hslp, cmdline->cmdparam1, scopes, mySLPRegReport, 0); + if (result != SLP_OK) + printf("errorcode: %i\n", result); + SLPClose(hslp); diff --git a/files/series b/files/series index 4dd407d..1c5ae4f 100644 --- a/files/series +++ b/files/series @@ -2,3 +2,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 +default_patches/0005-fix-interfaces-scope-list.patch diff --git a/package.yml b/package.yml index 78ecc3b..2a4feda 100644 --- a/package.yml +++ b/package.yml @@ -1,11 +1,11 @@ name : openslp version : 2.0.0 -release : 2 +release : 3 source : # 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 + - git|https://github.com/openslp-org/openslp.git : 1bc8dadd446ffca391422da6e924f1395c7008bc homepage : http://www.openslp.org license : BSD component : system.utils