Sync from SUSE:SLFO:Main openslp revision 45a0db9f6a9857d98989ef60d8bfd092

This commit is contained in:
Adrian Schröter 2024-05-03 17:30:59 +02:00
commit be842227c6
34 changed files with 5032 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

55
README.SUSE Normal file
View File

@ -0,0 +1,55 @@
#
# Service Location Protocol on SUSE
#
The Service Location Protcol (SLP) is part of the zerconf concept to provide
service informations inside a local network.
#
# The client side
#
Your client can search for avaible services using the slp library or via
using the slptool binary (for scripting).
WARNING: Have in mind that you can usually NOT trust the results.
It is up to the service client to validate the server.
Do NOT authentificate to an untrusted server or it might be
possible it gets your password.
#
# The server side
#
Every system which provides a service which should get announced with SLP
in the network needs also to run the slpd. There are several possible ways
to announce the service:
1) The authors of any service daemon should directly use libslp to
register the service on the server. Documentation for this can be
found in /usr/share/doc/packages/openslp/html/ProgrammersGuide/
2) Packages without direct SLP support should provide a registration
file in the /etc/slp.reg.d/ directory. See below for a template.
You can use the pseudo attributes watch-port-tcp and watch-port-udp
to make slpd check if the service is listening on the specified port.
This way a not-running service won't get announced by slpd.
3) Administrators can add service lines in the /etc/slp.reg file.
4) The slptool can be used to register a service in any script.
Example of a registration file.
This could be used to announce the sane daemon running on port 6566
------------------------------------------------------------------------
## Register a saned service on this system
## en means english language
## 65535 disables the timeout, so the service registration does
## not need refreshs
service:scanner.sane://$HOSTNAME:6566,en,65535
# only announce the service if a daemon is listening on tcp port 6566
watch-port-tcp=6566
description=SANE scanner daemon
------------------------------------------------------------------------

1
baselibs.conf Normal file
View File

@ -0,0 +1 @@
openslp

925
extensions.diff Normal file
View File

@ -0,0 +1,925 @@
--- ./common/slp_compare.c.orig 2012-12-12 19:12:43.000000000 +0000
+++ ./common/slp_compare.c 2014-04-10 14:54:49.730301497 +0000
@@ -414,6 +414,16 @@ int SLPCompareNamingAuth(size_t srvtypel
if (namingauthlen == 0xffff)
return 0; /* match all naming authorities */
+ /* skip "service:" */
+ if(srvtypelen > 8 && strncasecmp(srvtype, "service:", 8) == 0)
+ {
+ srvtypelen -= 8;
+ srvtype += 8;
+ }
+ dot = memchr(srvtype, ':', srvtypelen);
+ if (dot)
+ srvtypelen = dot - srvtype;
+
dot = memchr(srvtype, '.', srvtypelen);
if (!namingauthlen)
return dot? 1: 0; /* IANA naming authority */
--- ./common/slp_message.h.orig 2012-12-07 20:13:28.000000000 +0000
+++ ./common/slp_message.h 2014-04-10 14:54:49.730301497 +0000
@@ -127,6 +127,11 @@
#define SLP_REG_SOURCE_LOCAL 2 /* from localhost or IPC */
#define SLP_REG_SOURCE_STATIC 3 /* from the slp.reg file */
+#define SLP_REG_WATCH_TCP (1<<0)
+#define SLP_REG_WATCH_UDP (1<<1)
+#define SLP_REG_WATCH_CHECKING (1<<8)
+#define SLP_REG_WATCH_DEAD (1<<9)
+
/** SLP Extension IDs */
/** @todo Deprecate the use of the experimental version of the PID watcher
@@ -275,6 +280,8 @@ typedef struct _SLPSrvReg
SLPAuthBlock * autharray;
/* The following are used for OpenSLP specific extensions */
uint32_t pid;
+ int watchport;
+ int watchflags;
int source; /*!< convenience */
} SLPSrvReg;
--- ./common/slp_property.c.orig 2012-12-10 23:31:53.000000000 +0000
+++ ./common/slp_property.c 2014-04-10 14:54:49.730301497 +0000
@@ -80,12 +80,17 @@ static SLPList s_PropertyList = {0, 0, 0
/** The (optional) application-specified property file - module static. */
static char s_AppPropertyFile[MAX_PATH] = "";
+static FILE *s_AppPropertyFp;
/** The (optional) environment-specified property file - module static. */
static char s_EnvPropertyFile[MAX_PATH] = "";
+static FILE *s_EnvPropertyFp;
/** The (optional) global property file - module static. */
static char s_GlobalPropertyFile[MAX_PATH] = "";
+static FILE *s_GlobalPropertyFp;
+
+static int s_UsePropertyFps = 0;
/** The database lock - module static. */
static SLPMutexHandle s_PropDbLock;
@@ -285,9 +290,9 @@ static void InitializeMTUPropertyValue()
*
* @internal
*/
-static bool ReadFileProperties(char const * conffile)
+static bool ReadFileProperties(char const * conffile, FILE *conffp)
{
- FILE * fp;
+ FILE * fp = NULL;
char * alloced;
bool retval = false;
@@ -297,8 +302,11 @@ static bool ReadFileProperties(char cons
if ((alloced = xmalloc(CONFFILE_RDBUFSZ)) == 0)
return false;
+ if (conffp)
+ rewind(conffp);
+
/* open configuration file for read - missing file returns false */
- if ((fp = fopen(conffile, "r")) != 0)
+ if ((fp = s_UsePropertyFps ? conffp : fopen(conffile, "r")) != 0)
{
/* read a line at a time - max 4k characters per line */
while (fgets(alloced, CONFFILE_RDBUFSZ, fp))
@@ -356,7 +364,8 @@ static bool ReadFileProperties(char cons
if (*valuestart)
SLPPropertySet(namestart, valuestart, 0);
}
- fclose(fp);
+ if (!s_UsePropertyFps)
+ fclose(fp);
retval = true;
}
xfree(alloced);
@@ -383,21 +392,32 @@ static int ReadPropertyFiles(void)
if (SetDefaultValues() != 0)
return -1;
+ if (s_UsePropertyFps == 1)
+ {
+ if (*s_GlobalPropertyFile)
+ s_GlobalPropertyFp = fopen(s_GlobalPropertyFile, "r");
+ if (*s_EnvPropertyFile)
+ s_EnvPropertyFp = fopen(s_EnvPropertyFile, "r");
+ if (*s_AppPropertyFile)
+ s_AppPropertyFp = fopen(s_AppPropertyFile, "r");
+ s_UsePropertyFps = 2;
+ }
+
/* read global, and then app configuration files */
if (*s_GlobalPropertyFile)
- if (ReadFileProperties(s_GlobalPropertyFile))
+ if (ReadFileProperties(s_GlobalPropertyFile, s_GlobalPropertyFp))
SLPPropertySet("net.slp.OpenSLPConfigFile",
s_GlobalPropertyFile, SLP_PA_READONLY);
/* read environment specified configuration file */
if (*s_EnvPropertyFile)
- if (ReadFileProperties(s_EnvPropertyFile))
+ if (ReadFileProperties(s_EnvPropertyFile, s_EnvPropertyFp))
SLPPropertySet("net.slp.EnvConfigFile",
s_EnvPropertyFile, SLP_PA_READONLY);
/* if set, read application-specified configuration file */
if (*s_AppPropertyFile)
- if (ReadFileProperties(s_AppPropertyFile))
+ if (ReadFileProperties(s_AppPropertyFile, s_AppPropertyFp))
SLPPropertySet("net.slp.AppConfigFile",
s_AppPropertyFile, SLP_PA_READONLY);
@@ -865,6 +885,11 @@ int SLPPropertyInit(const char * gconffi
return sts;
}
+void SLPPropertyKeepFps()
+{
+ s_UsePropertyFps = 1;
+}
+
/** Release all globally held resources held by the property module.
*
* Free all associated property database memory, and destroy the database
@@ -878,6 +903,14 @@ int SLPPropertyInit(const char * gconffi
void SLPPropertyExit(void)
{
SLPPropertyCleanup();
+ if (s_GlobalPropertyFp)
+ fclose(s_GlobalPropertyFp);
+ if (s_EnvPropertyFp)
+ fclose(s_EnvPropertyFp);
+ if (s_AppPropertyFp)
+ fclose(s_AppPropertyFp);
+ s_GlobalPropertyFp = s_EnvPropertyFp = s_AppPropertyFp = NULL;
+ s_UsePropertyFps = 0;
SLPMutexDestroy(s_PropDbLock);
s_PropertiesInitialized = false;
}
--- ./common/slp_property.h.orig 2012-11-28 17:07:04.000000000 +0000
+++ ./common/slp_property.h 2014-04-10 14:54:49.730301497 +0000
@@ -66,6 +66,7 @@ int SLPPropertySetAppConfFile(const char
int SLPPropertyReinit(void);
int SLPPropertyInit(const char * gconffile);
void SLPPropertyExit(void);
+void SLPPropertyKeepFps(void);
/*! Special function to access MTU configuration property value. This provides
* fast access to the MTU value both in client libraries and server program.
--- ./common/slp_spi.c.orig 2012-11-28 17:07:04.000000000 +0000
+++ ./common/slp_spi.c 2014-04-10 14:54:49.730301497 +0000
@@ -426,6 +426,17 @@ int SLPSpiCanSign(SLPSpiHandle hspi, siz
spistrlen, spistr) != 0;
}
+void SLPSpiFill(SLPSpiHandle hspi)
+{
+ SLPSpiEntry* entry = (SLPSpiEntry*)hspi->cache.head;
+ while (entry)
+ {
+ if (entry->keytype != SLPSPI_KEY_TYPE_PRIVATE || hspi->cacheprivate)
+ entry->key = SLPSpiReadKeyFile(entry->keyfilename, entry->keytype);
+ entry = (SLPSpiEntry*)entry->listitem.next;
+ }
+}
+
#endif /* ENABLE_SLPv2_SECURITY */
/*=========================================================================*/
--- ./common/slp_spi.h.orig 2012-11-28 17:07:04.000000000 +0000
+++ ./common/slp_spi.h 2014-04-10 14:54:49.730301497 +0000
@@ -106,6 +106,8 @@ int SLPSpiCanVerify(SLPSpiHandle hspi, s
int SLPSpiCanSign(SLPSpiHandle hspi, size_t spistrlen, const char * spistr);
+void SLPSpiFill(SLPSpiHandle hspi);
+
#endif /* ENABLE_SLPv2_SECURITY */
/*! @} */
--- ./libslp/libslp_findsrvs.c.orig 2012-11-28 17:07:04.000000000 +0000
+++ ./libslp/libslp_findsrvs.c 2014-04-10 14:54:49.731301477 +0000
@@ -64,7 +64,7 @@
*/
static SLPBoolean CollateToSLPSrvURLCallback(SLPHandle hSLP,
const char * pcSrvURL, unsigned short sLifetime,
- SLPError errorcode)
+ SLPError errorcode, void *peeraddr)
{
int maxResults;
SLPHandleInfo * handle = hSLP;
@@ -110,13 +110,19 @@ static SLPBoolean CollateToSLPSrvURLCall
if (collateditem == 0)
{
collateditem = xmalloc(sizeof(SLPSrvUrlCollatedItem)
- + strlen(pcSrvURL) + 1);
+ + strlen(pcSrvURL) + 1 + sizeof(struct sockaddr_storage));
if (collateditem)
{
memset(collateditem, 0, sizeof(SLPSrvUrlCollatedItem));
collateditem->srvurl = (char *)(collateditem + 1);
strcpy(collateditem->srvurl, pcSrvURL);
collateditem->lifetime = sLifetime;
+ if (((struct sockaddr_storage *)peeraddr)->ss_family == AF_INET)
+ memcpy(collateditem->srvurl + strlen(pcSrvURL) + 1, peeraddr, sizeof(struct sockaddr_in));
+ else if (((struct sockaddr_storage *)peeraddr)->ss_family == AF_INET6)
+ memcpy(collateditem->srvurl + strlen(pcSrvURL) + 1, peeraddr, sizeof(struct sockaddr_in6));
+ else
+ memset(collateditem->srvurl + strlen(pcSrvURL) + 1, 0, sizeof(struct sockaddr_storage));
/* Add the new item to the collated list. */
SLPListLinkTail(&handle->collatedsrvurls,
@@ -144,6 +150,37 @@ CLEANUP:
return SLP_FALSE;
}
+char * SLPAPI SLPGetPeer(SLPHandle hSLP, const char *pcURL)
+{
+ SLPHandleInfo * handle = hSLP;
+ SLPSrvUrlCollatedItem * collateditem;
+ struct sockaddr_storage addr;
+
+ /*------------------------------*/
+ /* check for invalid parameters */
+ /*------------------------------*/
+ if(handle == 0 || handle->sig != SLP_HANDLE_SIG
+ || pcURL == 0 || pcURL[0] == 0)
+ return 0;
+
+ collateditem = (SLPSrvUrlCollatedItem *)handle->collatedsrvurls.head;
+ while (collateditem)
+ {
+ if (strcmp(collateditem->srvurl, pcURL) == 0)
+ {
+ memcpy((char *)&addr, collateditem->srvurl + strlen(collateditem->srvurl) + 1, sizeof(struct sockaddr_storage));
+ if (addr.ss_family == AF_INET || addr.ss_family == AF_INET6)
+ {
+ char addr_str[INET6_ADDRSTRLEN];
+ return xstrdup(SLPNetSockAddrStorageToString(&addr, addr_str, sizeof(addr_str)));
+ }
+ return 0;
+ }
+ collateditem = (SLPSrvUrlCollatedItem*)collateditem->listitem.next;
+ }
+ return 0;
+}
+
/** SLPFindSrvs callback routine for NetworkRqstRply.
*
* @param[in] errorcode - The network operation error code.
@@ -168,7 +205,7 @@ static SLPBoolean ProcessSrvRplyCallback
/* Check the errorcode and bail if it is set. */
if (errorcode != SLP_OK)
- return CollateToSLPSrvURLCallback(handle, 0, 0, errorcode);
+ return CollateToSLPSrvURLCallback(handle, 0, 0, errorcode, peeraddr);
/* parse the replybuf */
replymsg = SLPMessageAlloc();
@@ -191,7 +228,7 @@ static SLPBoolean ProcessSrvRplyCallback
continue; /* Authentication failed, skip this URLEntry. */
#endif
result = CollateToSLPSrvURLCallback(handle, urlentry[i].url,
- (unsigned short)urlentry[i].lifetime, SLP_OK);
+ (unsigned short)urlentry[i].lifetime, SLP_OK, peeraddr);
if (result == SLP_FALSE)
break;
}
@@ -210,7 +247,7 @@ static SLPBoolean ProcessSrvRplyCallback
#endif
result = CollateToSLPSrvURLCallback(handle,
replymsg->body.daadvert.url, SLP_LIFETIME_MAXIMUM,
- SLP_OK);
+ SLP_OK, peeraddr);
}
else if (replymsg->header.functionid == SLP_FUNCT_SAADVERT)
{
@@ -225,7 +262,7 @@ static SLPBoolean ProcessSrvRplyCallback
#endif
result = CollateToSLPSrvURLCallback(handle,
replymsg->body.saadvert.url, SLP_LIFETIME_MAXIMUM,
- SLP_OK);
+ SLP_OK, peeraddr);
}
}
SLPMessageFree(replymsg);
--- ./libslp/slp.h.orig 2012-11-28 17:07:04.000000000 +0000
+++ ./libslp/slp.h 2014-04-10 14:54:49.731301477 +0000
@@ -606,6 +606,15 @@ SLPEXP SLPError SLPAPI SLPAssociateIP(
SLPHandle hSLP,
const char * unicast_ip);
+/*=========================================================================
+ * SLPGetPeer() - return the peer info corresponding to a service url.
+ * may only be called from SLPSrvURLCallback.
+ * the returned memory needs to be freed with SLPFree()
+ */
+SLPEXP char * SLPAPI SLPGetPeer(
+ SLPHandle hSLP,
+ const char *pcURL);
+
#if __cplusplus
}
#endif
--- ./libslpattr/libslpattr.c.orig 2012-12-10 23:31:53.000000000 +0000
+++ ./libslpattr/libslpattr.c 2014-04-10 14:54:49.731301477 +0000
@@ -393,6 +393,9 @@ static char * unescape_into(char * dest,
(*cur)++;
}
+ if (type_guess == TYPE_UNKNOWN)
+ return 0; /* parse error */
+
*type = type_guess;
return 1;
}
--- ./slpd/slpd_database.c.orig 2012-12-10 23:31:53.000000000 +0000
+++ ./slpd/slpd_database.c 2014-04-10 14:54:49.731301477 +0000
@@ -49,6 +49,7 @@
#define _GNU_SOURCE
#include <string.h>
+#include <dirent.h>
#include "../libslpattr/libslpattr.h"
#include "slpd_database.h"
@@ -75,6 +76,9 @@
static IndexTreeNode *srvtype_index_tree = (IndexTreeNode *)0;
+extern char *reg_file_dir;
+static FILE *regfileFP;
+
#ifdef ENABLE_PREDICATES
/** A structure to hold a tag and its index tree
*/
@@ -793,6 +797,9 @@ static int SLPDDatabaseSrvRqstTestEntry(
/* entry reg is the SrvReg message from the database */
entryreg = &entry->msg->body.srvreg;
+ if ((entryreg->watchflags & SLP_REG_WATCH_DEAD) != 0)
+ return 0;
+
/* check the service type */
if (SLPCompareSrvType(srvrqst->srvtypelen, srvrqst->srvtype,
entryreg->srvtypelen, entryreg->srvtype) == 0
@@ -1347,6 +1354,8 @@ int SLPDDatabaseSrvTypeRqstStart(SLPMess
/* entry reg is the SrvReg message from the database */
entryreg = &entry->msg->body.srvreg;
+ if ((entryreg->watchflags & SLP_REG_WATCH_DEAD) != 0)
+ continue;
if (SLPCompareNamingAuth(entryreg->srvtypelen, entryreg->srvtype,
srvtyperqst->namingauthlen, srvtyperqst->namingauth) == 0
@@ -1416,6 +1425,8 @@ static int SLPDDatabaseAttrRqstProcessEn
int i;
#endif
+ if ((entryreg->watchflags & SLP_REG_WATCH_DEAD) != 0)
+ return 0;
if (SLPCompareString(attrrqst->urllen, attrrqst->url,
entryreg->urlentry.urllen, entryreg->urlentry.url) == 0
|| SLPCompareSrvType(attrrqst->urllen, attrrqst->url,
@@ -1689,18 +1700,18 @@ void * SLPDDatabaseEnumStart(void)
SLPMessage * SLPDDatabaseEnum(void * eh, SLPMessage ** msg, SLPBuffer * buf)
{
SLPDatabaseEntry * entry;
- entry = SLPDatabaseEnum((SLPDatabaseHandle)eh);
- if (entry)
+
+ while ((entry = SLPDatabaseEnum((SLPDatabaseHandle)eh)) != 0)
{
+ if ((entry->msg->body.srvreg.watchflags & SLP_REG_WATCH_DEAD) != 0)
+ continue;
*msg = entry->msg;
*buf = entry->buf;
+ return *msg;
}
- else
- {
- *msg = 0;
- *buf = 0;
- }
- return *msg;
+ *msg = 0;
+ *buf = 0;
+ return 0;
}
/** End an enumeration started by SLPDDatabaseEnumStart.
@@ -1826,7 +1837,10 @@ int SLPDDatabaseInit(const char * regfil
#endif /* ENABLE_PREDICATES */
/* Call the reinit function */
- return SLPDDatabaseReInit(regfile);
+ if (regfileFP)
+ fclose(regfileFP);
+ regfileFP = fopen(regfile, "r");
+ return SLPDDatabaseReInit();
}
/** Re-initialize the database with changed registrations from a regfile.
@@ -1835,13 +1849,14 @@ int SLPDDatabaseInit(const char * regfil
*
* @return Zzero on success, or a non-zero value on error.
*/
-int SLPDDatabaseReInit(const char * regfile)
+int SLPDDatabaseReInit()
{
SLPDatabaseHandle dh;
SLPDatabaseEntry * entry;
SLPMessage * msg;
SLPBuffer buf;
- FILE * fd;
+ DIR * dirfp;
+ struct dirent * direntry;
/* open the database handle and remove all the static registrations
(the registrations from the /etc/slp.reg) file. */
@@ -1861,26 +1876,170 @@ int SLPDDatabaseReInit(const char * regf
}
/* read static registration file if any */
- if (regfile)
+ if (regfileFP)
{
- fd = fopen(regfile, "rb");
- if (fd)
+ rewind(regfileFP);
+ while (SLPDRegFileReadSrvReg(regfileFP, &msg, &buf) == 0)
{
- while (SLPDRegFileReadSrvReg(fd, &msg, &buf) == 0)
+ if (SLPDDatabaseReg(msg, buf) != SLP_ERROR_OK)
{
- if (SLPDDatabaseReg(msg, buf) != SLP_ERROR_OK)
+ /* Only if the reg *didn't* succeed do we free the memory */
+ SLPMessageFree(msg);
+ SLPBufferFree(buf);
+ }
+ }
+ }
+ dirfp = opendir(reg_file_dir);
+ while (dirfp && (direntry = readdir(dirfp)) != 0)
+ {
+ if (direntry->d_name && direntry->d_name[0] != '.' )
+ {
+ FILE * fp;
+ char filename[1024];
+ snprintf( filename, 1023, "%s/%s", reg_file_dir, direntry->d_name );
+ if (strlen(filename)>4 &&
+ strcmp(filename+strlen(filename)-4, ".reg") == 0 &&
+ (fp = fopen(filename,"rb")) != 0)
+ {
+ while (SLPDRegFileReadSrvReg(fp, &msg, &buf) == 0)
{
- /* Only if the reg *didn't* succeed do we free the memory */
- SLPMessageFree(msg);
- SLPBufferFree(buf);
+ if (SLPDDatabaseReg(msg, buf) != SLP_ERROR_OK)
+ {
+ /* Only if the reg *didn't* succeed do we free the memory */
+ SLPMessageFree(msg);
+ SLPBufferFree(buf);
+ }
}
+ fclose(fp);
}
- fclose(fd);
}
}
+ if (dirfp)
+ closedir(dirfp);
return 0;
}
+static void SLPDDatabaseWatcher_fd(int fd, int flag, unsigned char *porthash)
+{
+ SLPDatabaseHandle dh;
+ SLPDatabaseEntry * entry;
+ SLPSrvReg * srvreg;
+ char buf[4096], *p[6];
+ int l, o, i, j, k, c, n, port;
+
+ if (fd < 0)
+ return;
+ lseek(fd, (off_t)0, SEEK_SET);
+ o = 0;
+ while ((l = read(fd, buf + o, sizeof(buf) - o)) > 0) {
+ l += o;
+ n = 0;
+ for (;;) {
+ for (i = n; i < l; i++)
+ if (buf[i] == '\n')
+ break;
+ if (i == l) {
+ if (l > n)
+ memmove(buf, buf + n, l - n);
+ o = l > n ? l - n : 0;
+ break;
+ }
+ k = 0;
+ for (j = n; j < i; j++) {
+ c = buf[j];
+ if (!(c >= '0' && c <= '9') && !(c >= 'A' && c <= 'F') && !(c >= 'a' && c <= 'f'))
+ buf[j] = 0;
+ else if ((j == n || buf[j - 1] == 0) && k < 6)
+ p[k++] = buf + j;
+ }
+ n = i + 1;
+ if (k < 6 || strlen(p[1]) < 8)
+ continue;
+ if (strlen(p[1]) == 8 && strtol(p[1], (char **)0, 16) == htonl(0x7f000001))
+ continue;
+ if ((flag & SLP_REG_WATCH_TCP) != 0 && strtol(p[5], (char **)0, 16) != 10)
+ continue;
+ port = strtol(p[2], (char **)0, 16);
+ if (!(porthash[(port / 8) & 255] & (1 << (port & 7))))
+ continue;
+ dh = SLPDatabaseOpen(&G_SlpdDatabase.database);
+ while ((entry = SLPDatabaseEnum(dh)) != 0) {
+ srvreg = &(entry->msg->body.srvreg);
+ if (!(srvreg->watchflags & flag))
+ continue;
+ if (port == srvreg->watchport)
+ srvreg->watchflags &= ~SLP_REG_WATCH_CHECKING;
+ }
+ SLPDatabaseClose(dh);
+ }
+ }
+}
+
+void SLPDDatabaseWatcher(void)
+{
+ static int initialized = 0;
+ static int proctcp, procudp, proctcp6, procudp6;
+ unsigned char porthash[256];
+ int flags, port;
+ SLPDatabaseHandle dh;
+ SLPDatabaseEntry* entry;
+ SLPSrvReg* srvreg;
+
+ if (!initialized) {
+ proctcp = open("/proc/net/tcp_listen", O_RDONLY);
+ if (proctcp == -1)
+ proctcp = open("/proc/net/tcp", O_RDONLY);
+ procudp = open("/proc/net/udp", O_RDONLY);
+ proctcp6 = open("/proc/net/tcp6_listen", O_RDONLY);
+ if (proctcp6 == -1)
+ proctcp6 = open("/proc/net/tcp6", O_RDONLY);
+ procudp6 = open("/proc/net/udp6", O_RDONLY);
+ initialized = 1;
+ }
+ flags = 0;
+ memset(porthash,0,sizeof(porthash));
+ dh = SLPDatabaseOpen(&G_SlpdDatabase.database);
+ while ((entry = SLPDatabaseEnum(dh)) != 0) {
+ srvreg = &(entry->msg->body.srvreg);
+ if (!srvreg->watchflags)
+ continue;
+ flags |= srvreg->watchflags;
+ port = srvreg->watchport;
+ porthash[(port / 8) & 255] |= 1 << (port & 7);
+ srvreg->watchflags |= SLP_REG_WATCH_CHECKING;
+ }
+ SLPDatabaseClose(dh);
+ if ((flags & SLP_REG_WATCH_TCP) != 0) {
+ SLPDDatabaseWatcher_fd(proctcp, SLP_REG_WATCH_TCP, porthash);
+ SLPDDatabaseWatcher_fd(proctcp6, SLP_REG_WATCH_TCP, porthash);
+ }
+ if ((flags & SLP_REG_WATCH_UDP) != 0) {
+ SLPDDatabaseWatcher_fd(procudp, SLP_REG_WATCH_UDP, porthash);
+ SLPDDatabaseWatcher_fd(procudp6, SLP_REG_WATCH_UDP, porthash);
+ }
+ dh = SLPDatabaseOpen(&G_SlpdDatabase.database);
+ while ((entry = SLPDatabaseEnum(dh)) != 0) {
+ srvreg = &(entry->msg->body.srvreg);
+ if (!srvreg->watchflags)
+ continue;
+ switch (srvreg->watchflags & (SLP_REG_WATCH_CHECKING | SLP_REG_WATCH_DEAD)) {
+ case SLP_REG_WATCH_CHECKING:
+ srvreg->watchflags |= SLP_REG_WATCH_DEAD;
+ SLPDKnownDADeRegisterWithAllDas(entry->msg, entry->buf);
+ SLPDLogRegistration("port dead",entry);
+ break;
+ case SLP_REG_WATCH_DEAD:
+ srvreg->watchflags ^= SLP_REG_WATCH_DEAD;
+ SLPDKnownDARegisterWithAllDas(entry->msg, entry->buf);
+ SLPDLogRegistration("port living",entry);
+ break;
+ }
+ srvreg->watchflags &= ~SLP_REG_WATCH_CHECKING;
+ }
+ SLPDatabaseClose(dh);
+}
+
+
#ifdef DEBUG
/** Cleans up all resources used by the database.
*/
--- ./slpd/slpd_database.h.orig 2012-11-28 17:07:04.000000000 +0000
+++ ./slpd/slpd_database.h 2014-04-10 14:54:49.732301459 +0000
@@ -103,7 +103,9 @@ SLPMessage * SLPDDatabaseEnum(void * eh,
void SLPDDatabaseEnumEnd(void * eh);
int SLPDDatabaseIsEmpty(void);
int SLPDDatabaseInit(const char * regfile);
-int SLPDDatabaseReInit(const char * regfile);
+int SLPDDatabaseReInit();
+void SLPDDatabaseWatcher(void);
+
#ifdef DEBUG
void SLPDDatabaseDeinit(void);
--- ./slpd/slpd_knownda.c.orig 2012-12-10 23:31:53.000000000 +0000
+++ ./slpd/slpd_knownda.c 2014-04-10 14:54:49.732301459 +0000
@@ -1836,7 +1836,7 @@ void SLPDKnownDARegisterWithAllDas(SLPMe
/* Returns: None */
/*=========================================================================*/
{
- if (msg->header.functionid == SLP_FUNCT_SRVDEREG)
+ if (msg->header.functionid == SLP_FUNCT_SRVREG)
{
/* Simply echo the message through as is */
SLPDKnownDAEcho(msg, buf);
--- ./slpd/slpd_log.c.orig 2012-11-28 17:07:04.000000000 +0000
+++ ./slpd/slpd_log.c 2014-04-10 14:54:49.732301459 +0000
@@ -298,6 +298,7 @@ static void SLPDLogSrvTypeRqstMessage(SL
{
(void)srvtyperqst;
SLPDLog("Message SRVTYPERQST:\n");
+ SLPDLogBuffer(" scope = ", srvtyperqst->scopelistlen, srvtyperqst->scopelist);
}
/** Logs information about a SrvTypeReply message to the log file.
--- ./slpd/slpd_main.c.orig 2012-12-10 23:31:53.000000000 +0000
+++ ./slpd/slpd_main.c 2014-04-10 14:54:49.732301459 +0000
@@ -66,6 +66,8 @@ int G_SIGINT; /* Signal being used f
int G_SIGUSR1; /* Signal being used to dump information about the database */
#endif
+char *reg_file_dir = "/etc/slp.reg.d";
+
/** Configures fd_set objects with sockets.
*
* @param[in] socklist - The list of sockets that is being currently
@@ -288,11 +290,13 @@ void HandleSigHup(void)
#ifdef ENABLE_SLPv2_SECURITY
/* Re-initialize SPI stuff*/
+#if 0 /* does not work in chroot, sorry */
SLPDSpiInit(G_SlpdCommandLine.spifile);
#endif
+#endif
/* Re-read the static registration file (slp.reg)*/
- SLPDDatabaseReInit(G_SlpdCommandLine.regfile);
+ SLPDDatabaseReInit();
/* Reopen listening sockets */
SLPDIncomingReinit();
@@ -318,6 +322,7 @@ void HandleSigAlrm(void)
SLPDKnownDAStaleDACheck(SLPD_AGE_INTERVAL);
SLPDKnownDAActiveDiscovery(SLPD_AGE_INTERVAL);
SLPDDatabaseAge(SLPD_AGE_INTERVAL, G_SlpdProperty.isDA);
+ SLPDDatabaseWatcher();
}
#ifdef DEBUG
@@ -487,11 +492,18 @@ static int DropPrivileges()
struct passwd * pwent = getpwnam("daemon");
if (pwent)
{
+ if (chroot(reg_file_dir))
+ return 1;
+ reg_file_dir = ".";
+
if (setgroups(1, &pwent->pw_gid) < 0 || setgid(pwent->pw_gid) < 0
|| setuid(pwent->pw_uid) < 0)
{
/* TODO: should we log here and return fail */
+ return 1;
}
+ } else {
+ return 1;
}
#endif
return 0;
@@ -639,6 +651,7 @@ int main(int argc, char * argv[])
#endif
/* initialize for the first time */
+ SLPPropertyKeepFps(); /* do not close file descriptors */
SLPDPropertyReinit(); /*So we get any property-related log messages*/
if (
#ifdef ENABLE_SLPv2_SECURITY
@@ -653,6 +666,9 @@ int main(int argc, char * argv[])
if (G_SlpdProperty.port != SLP_RESERVED_PORT)
SLPDLog("Using port %d instead of default %d\n", G_SlpdProperty.port, SLP_RESERVED_PORT);
+ /* init watcher */
+ SLPDDatabaseWatcher();
+
/* drop privileges to reduce security risk */
if (DropPrivileges())
SLPDFatal("Could not drop privileges\n");
--- ./slpd/slpd_property.c.orig 2012-11-28 17:07:04.000000000 +0000
+++ ./slpd/slpd_property.c 2014-04-10 14:55:49.894966122 +0000
@@ -50,6 +50,24 @@
*/
SLPDProperty G_SlpdProperty;
+static char *SLPDGetCanonHostname()
+{
+ char host[MAX_HOST_NAME];
+
+ if(gethostname(host, MAX_HOST_NAME) == 0)
+ {
+ struct addrinfo hints, * ifaddr;
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_family = AF_UNSPEC;
+ hints.ai_flags = AI_CANONNAME;
+ if (getaddrinfo(host, 0, &hints, &ifaddr) == 0 && ifaddr->ai_canonname && strchr(ifaddr->ai_canonname, '.') != 0)
+ return xstrdup(ifaddr->ai_canonname);
+ }
+ return xstrdup("localhost");
+}
+
/** Reinitialize the slpd property management subsystem.
*
* Clears and rereads configuration parameters from files into the system.
@@ -226,6 +244,9 @@ void SLPDPropertyReinit(void)
G_SlpdProperty.nextActiveDiscovery = 0; /* ensures xmit on first call to SLPDKnownDAActiveDiscovery() */
G_SlpdProperty.nextPassiveDAAdvert = 0; /* ensures xmit on first call to SLPDKnownDAPassiveDiscovery()*/
+ /* set up hostname */
+ G_SlpdProperty.myHostname = SLPDGetCanonHostname();
+ G_SlpdProperty.myHostnameLen = strlen(G_SlpdProperty.myHostname);
}
/** Initialize the slpd property management subsystem.
@@ -266,6 +287,7 @@ void SLPDPropertyDeinit(void)
xfree(G_SlpdProperty.ifaceInfo.iface_addr);
xfree(G_SlpdProperty.ifaceInfo.bcast_addr);
+ xfree(G_SlpdProperty.myHostname);
SLPPropertyExit();
}
--- ./slpd/slpd_property.h.orig 2012-11-28 17:07:04.000000000 +0000
+++ ./slpd/slpd_property.h 2014-04-10 14:54:49.732301459 +0000
@@ -73,6 +73,8 @@ typedef struct _SLPDProperty
uint16_t port;
size_t localeLen;
char * locale;
+ size_t myHostnameLen;
+ char * myHostname;
int indexingPropertiesSet; /** Indexes are only maintained from startup,
* and may not be switched on and off without
--- ./slpd/slpd_regfile.c.orig 2012-12-10 23:31:53.000000000 +0000
+++ ./slpd/slpd_regfile.c 2014-04-10 14:54:49.732301459 +0000
@@ -130,6 +130,7 @@ int SLPDRegFileReadSrvReg(FILE * fd, SLP
{
char * slider1;
char * slider2;
+ char * p;
char line[4096];
struct sockaddr_storage peer;
@@ -154,6 +155,8 @@ int SLPDRegFileReadSrvReg(FILE * fd, SLP
unsigned char * attrauth = 0;
int attrauthlen = 0;
#endif
+ int watchport = 0;
+ int watchflags = 0;
/* give the out params an initial NULL value */
*buf = 0;
@@ -180,8 +183,18 @@ int SLPDRegFileReadSrvReg(FILE * fd, SLP
result = SLP_ERROR_INTERNAL_ERROR;
goto CLEANUP;
}
+ /* replace "$HOSTNAME" string in url */
+ while ((p = strchr(url, '$')) && !strncmp(p, "$HOSTNAME", 9))
+ {
+ char *_url = xmalloc(strlen(url) - 9 + G_SlpdProperty.myHostnameLen + 1);
+ strncpy(_url, url, p - url);
+ strncpy(_url + (p - url), G_SlpdProperty.myHostname, G_SlpdProperty.myHostnameLen);
+ strcpy(_url + (p - url) + G_SlpdProperty.myHostnameLen, url + (p - url) + 9);
+ xfree(url);
+ url = _url;
+ }
urllen = strlen(url);
-
+
/* derive srvtype from srvurl */
srvtype = strstr(slider1, "://");
if (srvtype == 0)
@@ -313,6 +326,24 @@ int SLPDRegFileReadSrvReg(FILE * fd, SLP
}
}
}
+ else if(strncasecmp(slider1, "tcp-port", 8) == 0 || strncasecmp(slider1, "watch-port-tcp", 14) == 0)
+ {
+ slider2 = strchr(slider1,'=');
+ if (slider2)
+ {
+ watchport = atoi(slider2 + 1);
+ watchflags |= SLP_REG_WATCH_TCP;
+ }
+ }
+ else if(strncasecmp(slider1, "watch-port-udp", 14) == 0)
+ {
+ slider2 = strchr(slider1,'=');
+ if (slider2)
+ {
+ watchport = atoi(slider2 + 1);
+ watchflags |= SLP_REG_WATCH_UDP;
+ }
+ }
else
{
/* line contains an attribute (slow but it works)*/
@@ -517,6 +548,8 @@ int SLPDRegFileReadSrvReg(FILE * fd, SLP
((struct sockaddr_in *)&peer)->sin_addr.s_addr = htonl(INADDR_LOOPBACK);
result = SLPMessageParseBuffer(&peer, &peer, *buf, *msg);
(*msg)->body.srvreg.source = SLP_REG_SOURCE_STATIC;
+ (*msg)->body.srvreg.watchflags = watchflags ? (watchflags | SLP_REG_WATCH_DEAD) : 0;
+ (*msg)->body.srvreg.watchport = watchport;
CLEANUP:
--- ./slpd/slpd_spi.c.orig 2012-11-28 17:07:04.000000000 +0000
+++ ./slpd/slpd_spi.c 2014-04-10 14:54:49.733301445 +0000
@@ -66,6 +66,8 @@ int SLPDSpiInit(const char * spifile)
G_SlpdSpiHandle = 0;
}
G_SlpdSpiHandle = SLPSpiOpen(spifile,1);
+ if (G_SlpdSpiHandle)
+ SLPSpiFill(G_SlpdSpiHandle);
return G_SlpdSpiHandle == 0;
}
--- ./slptool/slptool.c.orig 2013-06-08 02:50:38.000000000 +0000
+++ ./slptool/slptool.c 2014-04-10 14:54:49.733301445 +0000
@@ -187,7 +187,17 @@ static SLPBoolean mySrvUrlCallback(SLPHa
(void)cookie;
if (errcode == SLP_OK)
+ {
+ SLPToolCommandLine* cmdline = cookie;
+ if (cmdline->printpeerinfo)
+ {
+ char *peer = SLPGetPeer(hslp, srvurl);
+ printf("%s\t", peer ? peer : "?");
+ if (peer)
+ SLPFree(peer);
+ }
printf("%s,%i\n", srvurl, lifetime);
+ }
return SLP_TRUE;
}
@@ -218,7 +228,7 @@ void FindSrvs(SLPToolCommandLine * cmdli
}
#endif
result = SLPFindSrvs(hslp, cmdline->cmdparam1, cmdline->scopes,
- cmdline->cmdparam2, mySrvUrlCallback, 0);
+ cmdline->cmdparam2, mySrvUrlCallback, cmdline);
if (result != SLP_OK)
printf("errorcode: %i\n", result);
SLPClose(hslp);
@@ -413,6 +423,11 @@ int ParseCommandLine(int argc, char * ar
return 1;
}
#endif
+ else if (strcasecmp(argv[i], "-p") == 0
+ || strcasecmp(argv[i], "--peerinfo") == 0)
+ {
+ cmdline->printpeerinfo = SLP_TRUE;
+ }
else if (strcasecmp(argv[i], "findsrvs") == 0)
{
cmdline->cmd = FINDSRVS;
@@ -519,6 +534,7 @@ void DisplayUsage()
#ifndef UNICAST_NOT_SUPPORTED
printf(" -u (or --unicastifc) followed by a single interface.\n");
#endif
+ printf(" -p (or --peerinfo) also display the address of the answering server.\n");
printf("\n");
printf(" command-and-arguments may be:\n");
printf(" findsrvs service-type [filter]\n");
--- ./slptool/slptool.h.orig 2012-11-28 17:07:04.000000000 +0000
+++ ./slptool/slptool.h 2014-04-10 14:54:49.733301445 +0000
@@ -107,6 +107,7 @@ typedef struct _SLPToolCommandLine
const char * cmdparam1;
const char * cmdparam2;
const char * cmdparam3;
+ SLPBoolean printpeerinfo;
} SLPToolCommandLine;
void FindSrvs(SLPToolCommandLine * cmdline);

View File

@ -0,0 +1,14 @@
Index: openslp-2.0.0/slpd/slpd_process.c
===================================================================
--- openslp-2.0.0.orig/slpd/slpd_process.c
+++ openslp-2.0.0/slpd/slpd_process.c
@@ -1055,7 +1055,9 @@ RESPOND:
if (truncate && size > truncate && G_SlpdProperty.hardMTU)
{
attrlistlen = 0;
+#ifdef ENABLE_SLPv2_SECURITY
opaqueauth = 0;
+#endif
size = message->header.langtaglen + 19; /* 14 bytes for header */
truncated = 1;
}

BIN
openslp-2.0.0.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

4
openslp-devel.desktop Normal file
View File

@ -0,0 +1,4 @@
[Desktop Entry]
Name=Open SLP Developer Guide
DocPath=/usr/share/doc/packages/openslp/html/ProgrammersGuide/index.html
X-DOC-SearchMethod=htdig

33
openslp.audit.diff Normal file
View File

@ -0,0 +1,33 @@
--- ./common/slp_network.c.orig 2014-02-13 15:14:30.020870347 +0000
+++ ./common/slp_network.c 2014-02-13 15:36:48.344867978 +0000
@@ -303,6 +303,8 @@ int SLPNetworkRecvMessage(sockfd_t sockf
{
/* Allocate the receive buffer as large as necessary. */
recvlen = PEEK_LENGTH(peek);
+ if (recvlen <= 0)
+ recvlen = 1;
*buf = SLPBufferRealloc(*buf, recvlen);
if (*buf)
{
--- ./slpd/slpd_incoming.c.orig 2014-02-13 15:14:30.022870347 +0000
+++ ./slpd/slpd_incoming.c 2014-02-13 15:36:12.992868041 +0000
@@ -241,6 +241,8 @@ static void IncomingStreamRead(SLPList *
if (bytesread > 0 && bytesread >= (*peek == 2? 5: 4))
{
recvlen = PEEK_LENGTH(peek);
+ if (recvlen <= 0)
+ recvlen = 1;
/* allocate the recvbuf big enough for the whole message */
sock->recvbuf = SLPBufferRealloc(sock->recvbuf, recvlen);
--- ./slpd/slpd_outgoing.c.orig 2014-02-13 15:14:30.022870347 +0000
+++ ./slpd/slpd_outgoing.c 2014-02-13 15:34:49.984868188 +0000
@@ -211,6 +211,8 @@ void OutgoingStreamRead(SLPList * sockli
{
/* allocate the recvbuf big enough for the whole message */
msglen = PEEK_LENGTH(peek);
+ if (msglen <= 0)
+ msglen = 1;
sock->recvbuf = SLPBufferRealloc(sock->recvbuf, msglen);
if (sock->recvbuf)

652
openslp.changes Normal file
View File

@ -0,0 +1,652 @@
-------------------------------------------------------------------
Wed Aug 31 14:21:40 UTC 2022 - Stefan Schubert <schubi@suse.com>
- Migration to /usr/etc: Saving user changed configuration files
in /etc and restoring them while an RPM update.
-------------------------------------------------------------------
Tue Jun 21 12:38:51 UTC 2022 - Stefan Schubert <schubi@suse.com>
- Moved logrotate files from user specific directory /etc/logrotate.d
to vendor specific directory /usr/etc/logrotate.d.
-------------------------------------------------------------------
Wed Oct 13 11:13:47 UTC 2021 - Johannes Segitz <jsegitz@suse.com>
- Added hardening to systemd service(s) (bsc#1181400). Modified:
* slpd.service
-------------------------------------------------------------------
Tue Mar 24 17:07:52 CET 2020 - mls@suse.de
- Add missing openslp requires to the openslp-server package
[bnc#1165121]
-------------------------------------------------------------------
Thu Jul 25 11:11:16 UTC 2019 - matthias.gerstner@suse.com
- removal of SuSEfirewall2 service, since SuSEfirewall2 has been replaced by
firewalld, see [1].
[1]: https://lists.opensuse.org/opensuse-factory/2019-01/msg00490.html
-------------------------------------------------------------------
Wed Jun 12 11:32:40 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Explicitely require library on develpackage and do not pull
in the base package with slptool binary
-------------------------------------------------------------------
Sun Jun 9 14:53:07 UTC 2019 - Jan Engelhardt <jengelh@inai.de>
- Fixup summaries: SDK already includes "development",
and shared library is unspecific. Remove marketing wording
from descriptions.
-------------------------------------------------------------------
Fri Jun 7 16:00:46 CEST 2019 - mls@suse.de
- Use tcp connects to talk with other DAs [bnc#1117969]
new patch: openslp.tcpknownda.diff
- Fix segfault in predicate match if a registered service has
a malformed attribute list [bnc#1136136]
new patch: openslp.nullattr.diff
-------------------------------------------------------------------
Thu Jun 6 16:17:45 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Remove < SLE12 as it is no longer supported
- Remove obsolete conditions/etc.
* dropped file: slpd.init
- Cleanup with spec-cleaner
- Split out shared library properly
-------------------------------------------------------------------
Thu Jun 6 09:31:19 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Drop the omc config fate#301838:
* it is obsolete since SLE11
-------------------------------------------------------------------
Mon Aug 27 22:13:24 UTC 2018 - Jason Sikes <jsikes@suse.de>
- Fixed failure to compile when ENABLE_SLPv2_SECURITY is not set
new patch: openslp-2.0.0-ifdef-slpv2.diff
-------------------------------------------------------------------
Wed Apr 11 14:39:03 CEST 2018 - mls@suse.de
- move systemd notification before the chroot() call, otherwise
the notify function cannot reach systend's unix domain socket
[bnc#1089097]
-------------------------------------------------------------------
Thu Mar 1 16:59:01 CET 2018 - mls@suse.de
- Use %license (boo#1082318)
- fix slpd using the peer address as local address for TCP
connections [bnc#1076035]
new patch: openslp.localaddr.diff
- use tcp connections for unicast requests [bnc#1080964]
new patch: openslp.tcpunicast.diff
-------------------------------------------------------------------
Wed Nov 29 17:25:48 CET 2017 - ro@suse.de
- add separate source openslp.logrotate.systemd to
use systemctl reload for logrotate configuration
-------------------------------------------------------------------
Tue Jun 13 08:28:35 UTC 2017 - daniel.molkentin@suse.com
- Add support for OpenSSL 1.1. Commit from upstream [bsc#1042665]
new patch: openslp.openssl-1.1.diff
-------------------------------------------------------------------
Mon Jan 9 10:43:57 UTC 2017 - fbui@suse.com
- Also update openslp.sd_notify.diff to use the new systemd lib
-------------------------------------------------------------------
Mon Dec 12 17:17:22 UTC 2016 - fbui@suse.com
- Replace pkgconfig(libsystemd-*) with pkgconfig(libsystemd)
Nowadays pkgconfig(libsystemd) replaces all libsystemd-* libs, which
are obsolete.
-------------------------------------------------------------------
Wed Oct 12 13:53:08 CEST 2016 - mls@suse.de
- Fix bounds check in SLPFoldWhiteSpace
[bnc#1001600] [CVE-2016-7567]
new patch: openslp.foldws.diff
-------------------------------------------------------------------
Mon Sep 12 14:23:15 CEST 2016 - mls@suse.de
- remove convenience code as changes bytes in the message
buffer breaking the verification code [bnc#994989]
new patch: openslp.noconvenience.diff
- fix storage handling in predicate code, it clashed with gcc's
fortify_source extension [bnc#909195]
new patch: openslp.predicatestorage.diff
- bring back allowDoubleEqualInPredicate option
new patch: openslp.doubleequal.diff
- fix bug in openslp.initda.diff patch
- fix rcopenslp helper
- fix _xrealloc not checking the malloc return value
[bnc#980722] [CVE-2016-4912]
new patch: openslp.xrealloc.diff
-------------------------------------------------------------------
Sun Mar 8 00:39:27 UTC 2015 - p.drouand@gmail.com
- Do not depend on fillup and insserv if the package build with
systemd support; the dependencies are not needed in that case
-------------------------------------------------------------------
Mon Sep 1 15:58:06 CEST 2014 - mls@suse.de
- fix last commit
-------------------------------------------------------------------
Mon Jul 28 02:36:48 UTC 2014 - crrodriguez@opensuse.org
- Do not apply previous patch to distros without systemd.
- Limit init script usage only to legacy products.
-------------------------------------------------------------------
Sun Jul 27 21:18:25 UTC 2014 - crrodriguez@opensuse.org
- openslp.sd_notify.diff make slpd systemd service of type
notify instead of simple, to avoid startup races.
-------------------------------------------------------------------
Thu Apr 10 16:56:24 CEST 2014 - mls@suse.de
- use AI_CANONNAME when looking up the canonical name
-------------------------------------------------------------------
Wed Feb 19 18:37:01 CET 2014 - mls@suse.de
- update to openslp-2.0.0 to get IPv6 support
* dropped patches:
v1dadiscovery.diff, openslp.clrflags.diff
openslp.fixdsareturn.diff, openslp.dereg.diff,
openslp.tcpclearovr.diff, openslp.lifetime.diff,
slptool-timeout.diff, openslp.poll.diff,
openslp.ignorespaces.diff, openslp.checkovr.diff,
openslp.fixaddrcheck.diff, openslp.loopbacksocket.diff,
openslp.diff, openslp.doubleequal.diff, openslp.discovery.diff,
openslp.parseext.diff, openslp.knowndafree.diff,
openslp.emptyanswer.diff, openslp.v1sladdr.diff, hppa.diff
* renamed patches:
openslp-1.2.0-visibility.patch -> openslp.visibility.diff
openslp-1.2.0-daemon.diff -> openslp.daemon.diff
openslp.use-TCPDIAG-for-checking-listeners -> openslp.netlink.diff
openslp-ocloexec.patch -> openslp.cloexec.diff
- always use localtime in the log file [bnc#855385]
patch: openslp.localtime.diff
- use tcp to connect to the local SA
patch: openslp.tcplocal.diff
- drop unused mdns support
- rename README.SuSE to README.SUSE
-------------------------------------------------------------------
Thu Feb 13 15:03:15 CET 2014 - mls@suse.de
- frontport SLE11 patches:
* add hardMTU option to limit the datagram package size to
1400 bytes [bnc#648384].
patch: openslp.hardmtu.diff
* fix double free in SLPDKnownDAAdd error case [bnc#667953]
patch: openslp.knowndafree.diff
* fix libslp socket handling, check if socket is still alive
and fix socket close code [bnc#693756]
patch: openslp.loopbacksocket.diff
* make openslpd reconnect to DAs if they closed the connection
[bnc#723385]
patch: openslp.slpdreconnect.diff
* fixup lifetime of registrations a bit so that they
don't get removed too early [bnc#658972]
patch: openslp.lifetime.diff
-------------------------------------------------------------------
Tue Jul 16 13:44:12 CEST 2013 - mls@suse.de
- fix wrong dir modifier in filelist
-------------------------------------------------------------------
Mon Apr 15 12:50:48 UTC 2013 - idonmez@suse.com
- Add Source URL, see https://en.opensuse.org/SourceUrls
-------------------------------------------------------------------
Thu Oct 18 11:48:34 UTC 2012 - coolo@suse.com
- buildrequire systemd through the pkgconfig provide to get
systemd-mini in build environments (to break cycles)
-------------------------------------------------------------------
Sat Aug 25 15:56:43 UTC 2012 - crrodriguez@opensuse.org
- openslp-ocloexec.patch: open all internal fds with O_CLOEXEC
so we do not leak them on fork() .. execve() particulary
important in the shared library.
-------------------------------------------------------------------
Wed Feb 8 20:14:48 UTC 2012 - coolo@suse.com
- move the systemd requires to the server subpackage
-------------------------------------------------------------------
Thu Dec 22 23:42:12 UTC 2011 - crrodriguez@opensuse.org
- Add native systemd unit
-------------------------------------------------------------------
Wed Nov 16 08:19:02 UTC 2011 - coolo@suse.com
- add libtool as buildrequire to avoid implicit dependency
-------------------------------------------------------------------
Mon Feb 28 12:12:37 UTC 2011 - lnussel@suse.de
- use dedicated user instead of 'daemon' (bnc#656780)
-------------------------------------------------------------------
Fri Nov 5 22:06:43 UTC 2010 - cristian.rodriguez@opensuse.org
- libslp: export only functions of the public interface
defined in slp.h
-------------------------------------------------------------------
Tue Oct 12 17:46:47 CEST 2010 - mls@suse.de
- fix extension parsing code, CVE-2010-3609 [bnc#642571]
-------------------------------------------------------------------
Fri Oct 1 13:36:48 CEST 2010 - mls@suse.de
- ignore leading and trailing spaces when comparing strings
[bnc#626444]
-------------------------------------------------------------------
Thu Sep 30 12:35:54 CEST 2010 - mls@suse.de
- change DA pull code to not use the pulled-from-de prediacte, but
instead don't overwrite non-pulled registrations
-------------------------------------------------------------------
Thu Jul 29 13:28:41 CEST 2010 - mls@suse.de
- add DABackupLocalReg option to enable backup of local services
[bnc#597215]
-------------------------------------------------------------------
Tue May 11 18:09:09 CEST 2010 - jeffm@suse.de
- avoid CPU usage spike while while reading /proc/net/tcp
on systems with many connections (bnc#601002)
-------------------------------------------------------------------
Wed Apr 28 17:03:14 CEST 2010 - mls@suse.de
- do not ignore DA answers if active and passive DA detection is off
[bnc#564504]
- add DASyncReg and isDABackup options for OES folks
-------------------------------------------------------------------
Fri Mar 12 13:55:47 UTC 2010 - kkaempf@novell.com
- Add SuSEfirewall2 description file
-------------------------------------------------------------------
Mon Dec 14 17:04:29 CET 2009 - jengelh@medozas.de
- add baselibs.conf as a source
-------------------------------------------------------------------
Wed Nov 18 14:53:24 CET 2009 - mls@suse.de
- clear mcast flag from DAAdverts [bnc#533432]
-------------------------------------------------------------------
Fri Jan 30 14:17:01 CET 2009 - mls@suse.de
- fix DSA_verify return code test [bnc#465270]
-------------------------------------------------------------------
Thu Jan 22 02:48:00 CET 2009 - crrodriguez@suse.de
- remove static libraries and "la" files
-------------------------------------------------------------------
Wed Jan 7 12:34:56 CET 2009 - olh@suse.de
- obsolete old -XXbit packages (bnc#437293)
-------------------------------------------------------------------
Fri Nov 14 15:27:34 CET 2008 - mrueckert@suse.de
- enable service only on sles 9 and 10 by default
- remove deprecated usage of run_ldconfig
- recommend logrotate in the server package
-------------------------------------------------------------------
Mon Aug 18 16:20:22 CEST 2008 - ro@suse.de
- move prereq to server subpackage
- fix init script
-------------------------------------------------------------------
Fri May 9 16:46:20 CEST 2008 - schwab@suse.de
- Fix use of libtool.
-------------------------------------------------------------------
Thu Apr 10 12:54:45 CEST 2008 - ro@suse.de
- added baselibs.conf file to build xxbit packages
for multilib support
-------------------------------------------------------------------
Tue Apr 1 16:14:25 CEST 2008 - mkoenig@suse.de
- remove dir /usr/share/omc/svcinfo.d as it is provided now
by filesystem
-------------------------------------------------------------------
Tue Mar 25 19:27:21 CET 2008 - mls@suse.de
- fix non-intel little-endian platforms [bnc#372179]
-------------------------------------------------------------------
Wed Mar 19 16:45:21 CET 2008 - mls@suse.de
- initialize peeraddr in unicast case [bnc#370374]
-------------------------------------------------------------------
Tue Sep 4 15:12:28 CEST 2007 - mls@suse.de
- fix typo in dereg code [#290333]
-------------------------------------------------------------------
Thu Mar 29 14:30:08 CEST 2007 - rguenther@suse.de
- add bison and flex BuildRequires
-------------------------------------------------------------------
Thu Jan 11 12:27:25 CET 2007 - ro@suse.de
- move omc xml file to /usr/share/omc
-------------------------------------------------------------------
Mon Jan 8 18:15:10 CET 2007 - ro@suse.de
- move srvinfo.d to svcinfo.d (typo in fate entry)
-------------------------------------------------------------------
Mon Dec 18 18:43:07 CET 2006 - ro@suse.de
- added slpd.xml to /etc/omc/srvinfo.d (fate#301831)
-------------------------------------------------------------------
Thu Nov 16 17:13:01 CET 2006 - mls@suse.de
- truncate oversized udp messages, finally fixes [#185483]
(can be turned of with "net.slp.oversizedUDP" option)
- do not try to send back empty answers
- add option "net.slp.allowDoubleEqualInPredicate" to make openslp
work with some buggy clients that use "==" for comparison [#95043]
- changed SLPGetPeer interface to support IPv6
-------------------------------------------------------------------
Tue Sep 12 15:23:43 CEST 2006 - mls@suse.de
- obey OVERFLOW bit of incoming udp messages [#185483]
- use right length in send() calls [#185483]
- fix errno check in IncomingStreamWrite
- add SLPGetPeer method in libslp
- add --peerinfo option to slptool to print peerinfo
-------------------------------------------------------------------
Wed May 10 20:41:30 CEST 2006 - mls@suse.de
- fix unaligned memory access on ia64 [#171932]
-------------------------------------------------------------------
Fri Mar 24 14:23:39 CET 2006 - mls@suse.de
- fix listening on multiple interfaces [#160008]
-------------------------------------------------------------------
Sat Mar 18 03:33:51 CET 2006 - schwab@suse.de
- Fix file descritor leak [#159303].
-------------------------------------------------------------------
Mon Jan 30 16:35:37 CET 2006 - mls@suse.de
- fix bug in DropSLPMulticastGroup
- add -fstack-protector to CFLAGS
- added logrotate script [#143069]
-------------------------------------------------------------------
Wed Jan 25 21:30:39 CET 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
-------------------------------------------------------------------
Fri Dec 23 15:41:12 CET 2005 - mls@suse.de
- clear overflow bit on TCP connections [#135248]
-------------------------------------------------------------------
Thu Sep 29 03:15:17 CEST 2005 - dmueller@suse.de
- add norootforbuild
-------------------------------------------------------------------
Mon Aug 22 19:31:23 CEST 2005 - mls@suse.de
- also listen on SLPv1 General Multicast address [#64138]
- use poll instead of select [#65673]
-------------------------------------------------------------------
Tue Feb 15 19:52:01 CET 2005 - mls@suse.de
- update to version 1.2.0
- fixed security audit findings
- disable mdns in slpd for now, libslp still supports it
-------------------------------------------------------------------
Fri Dec 3 12:39:40 CET 2004 - mls@suse.de
- fix slpv DA discovery scope handling (#48728)
- use _dns-sd instead of _mdns in mdns findsrvtypes query (#48325)
-------------------------------------------------------------------
Thu Oct 14 13:55:00 CEST 2004 - adrian@suse.de
- add meta information for suse help.
-------------------------------------------------------------------
Sun Jun 13 14:27:28 CEST 2004 - bg@suse.de
- reduce hardcoded optimization from -O3 to -O2 to circumvent
ICE on hppa
-------------------------------------------------------------------
Tue Jun 1 16:17:17 CEST 2004 - mls@suse.de
- added fillup and insserv prereq
-------------------------------------------------------------------
Thu May 27 14:30:41 CEST 2004 - mls@suse.de
- use /proc/net/tcp_listen and /proc/net/tcp6_listen if
available to keep things fast on systems with lots of
network connections [#40888]
-------------------------------------------------------------------
Wed May 5 20:08:02 CEST 2004 - mls@suse.de
- treat empty attributes as illegal [#39669]
- always start slpd on SLES [#39863]
-------------------------------------------------------------------
Fri Apr 23 12:04:20 CEST 2004 - mls@suse.de
- libslp: use configured TTL settings [#39030]
-------------------------------------------------------------------
Fri Apr 2 12:17:42 CEST 2004 - mls@suse.de
- beta is over, don't always start slpd
-------------------------------------------------------------------
Fri Apr 2 09:18:03 CEST 2004 - kukuk@suse.de
- Fix init script
-------------------------------------------------------------------
Wed Mar 31 13:03:35 CEST 2004 - mls@suse.de
- fix sighup processing
- clean up spi code
- fix spi null pointer reference
- fix namingauth comparison
- added try-restart to rcslpd
- fix slp.conf re-read
- fix prlist buffer overrun
-------------------------------------------------------------------
Mon Mar 29 14:58:00 CEST 2004 - mls@suse.de
- turn around srvtypes order in mdns
-------------------------------------------------------------------
Thu Mar 18 17:12:34 CET 2004 - mls@suse.de
- code cleanup
- provide A RR with SRV RRs
- don't pack .xvpics
-------------------------------------------------------------------
Fri Mar 12 15:48:09 CET 2004 - mls@suse.de
- added missing SLPGetMDNSName prototype to slp.h
-------------------------------------------------------------------
Fri Mar 12 12:38:38 CET 2004 - mls@suse.de
- slpd: fix hostname detection segfault
- slpd: use ttl 255 for mdns
- slpd: put attrs in mdns TXT RR
- libslp: check mdns ttl
- libslp: make getattr work with mdns
- libslp: make mdns name available via new SLPGetMDNSName() function
-------------------------------------------------------------------
Thu Mar 4 18:45:35 CET 2004 - mls@suse.de
- libslp: add scope/nameingauth/predicate to query
- slpd: reply to mdns service requests
- slpd: don't play DA if our hostname expands to loopback
- slpd: fix null pointer reference if SrvReg request is sent
over tcp (as done by apple)
-------------------------------------------------------------------
Fri Feb 27 18:07:46 CET 2004 - mls@suse.de
- slpd: check port status every 15 seconds for watch-port-tcp/udp
entries
- libslp: send MDNS queries for scope _mdns
-------------------------------------------------------------------
Sun Feb 15 18:17:19 CET 2004 - adrian@suse.de
- export full qualified hostnames for $HOSTNAME
- replace several $HOSTNAME tags in a srvurl
- do only accept .reg files (no .rpmsave for instance)
-------------------------------------------------------------------
Sat Feb 14 01:33:22 CET 2004 - adrian@suse.de
- fix /proc/net/tcp* parsing
- ONLY FOR BETA: start slpd always
-------------------------------------------------------------------
Thu Jan 29 13:59:26 CET 2004 - adrian@suse.de
- fix reading from slpd.reg.d directory
(was broken since chroot run)
-------------------------------------------------------------------
Wed Jan 14 13:42:41 CET 2004 - adrian@suse.de
- slptool register now services with max timeout.
-------------------------------------------------------------------
Tue Dec 16 09:14:12 CET 2003 - adrian@suse.de
- fix sig11 when using the library without spi file
-------------------------------------------------------------------
Mon Dec 8 12:06:21 CET 2003 - adrian@suse.de
- security enhancements:
* use chroot and open needed file descriptors before
* panic if chroot or setuid fails
* pid-file= option in reg files is useless now, so
tcp-port= must be used for this now
- add SSL support again
-------------------------------------------------------------------
Wed Nov 26 15:53:52 CET 2003 - adrian@suse.de
- add buffer fix from cvs
- add README.SuSE with config howto
-------------------------------------------------------------------
Thu Nov 20 13:06:13 CET 2003 - adrian@suse.de
- drop the multicast route creation in runlevel script.
we do not need it anymore with 1.1.5
-------------------------------------------------------------------
Wed Nov 19 16:45:08 CET 2003 - adrian@suse.de
- update to version 1.1.5
* development version, but it contains lots of fixes
- use $HOSTNAME instead of $LOCALHOST in reg files
-------------------------------------------------------------------
Fri Nov 14 10:53:01 CET 2003 - adrian@suse.de
- use correct keyword "X-UnitedLinux-Should-Start" in init script
(seen by Martin Vidner)
-------------------------------------------------------------------
Thu Nov 13 22:58:49 CET 2003 - adrian@suse.de
- add "tcp-port=" option to test services running via (x)inted
- start after (x)inetd
-------------------------------------------------------------------
Wed Nov 12 13:28:17 CET 2003 - adrian@suse.de
- add code to parse .reg files from any package below /etc/slp.reg.d/
-------------------------------------------------------------------
Sun Nov 9 23:26:04 CET 2003 - adrian@suse.de
- fix security issue in init script
-------------------------------------------------------------------
Sat Nov 8 17:56:38 CET 2003 - adrian@suse.de
- initial package of version 1.0.11

211
openslp.cloexec.diff Normal file
View File

@ -0,0 +1,211 @@
--- ./common/slp_dhcp.c.orig 2014-02-17 18:16:57.883239271 +0000
+++ ./common/slp_dhcp.c 2014-02-17 18:20:16.386238920 +0000
@@ -101,7 +101,7 @@ static sockfd_t dhcpCreateBCSkt(void * p
so_bool_t on = 1;
/* setup dhcp broadcast-to-server address structure */
- if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) != SLP_INVALID_SOCKET)
+ if ((sockfd = socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC, 0)) != SLP_INVALID_SOCKET)
{
int addr = INADDR_ANY;
struct sockaddr_storage localaddr;
@@ -355,7 +355,7 @@ static int dhcpGetAddressInfo(unsigned c
struct arpreq arpreq;
struct sockaddr_in * sin;
- if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) == SLP_INVALID_SOCKET)
+ if ((sockfd = socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC, 0)) == SLP_INVALID_SOCKET)
return -1;
*hlen = 0;
--- ./common/slp_iface.c.orig 2014-02-17 18:16:57.886239271 +0000
+++ ./common/slp_iface.c 2014-02-17 18:21:25.194238798 +0000
@@ -457,7 +457,7 @@ static int GetV6Scope(struct sockaddr_in
family = AF_INET6;
/* Check if address is a global address and if it is then assign a scope ID as zero */
- fd = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP);
+ fd = socket(AF_INET6, SOCK_STREAM|SOCK_CLOEXEC, IPPROTO_TCP);
if (fd != INVALID_SOCKET)
{
if (addr != NULL )
@@ -552,7 +552,7 @@ static int GetV6Scope(struct sockaddr_in
xfree(pAddr);
#else
sockfd_t fd;
- fd = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP);
+ fd = socket(AF_INET6, SOCK_STREAM|SOCK_CLOEXEC, IPPROTO_TCP);
if (fd != SLP_INVALID_SOCKET)
{
/* This loop attempts to find the proper scope value
@@ -698,7 +698,7 @@ int SLPIfaceGetDefaultInfo(SLPIfaceInfo
#ifdef LINUX
SLPIfaceGetV6Addr(ifaceinfo);
#else
- fd = socket(AF_INET6, SOCK_DGRAM, 0);
+ fd = socket(AF_INET6, SOCK_DGRAM|SOCK_CLOEXEC, 0);
if (fd != -1)
{
#ifdef AIX
@@ -739,7 +739,7 @@ int SLPIfaceGetDefaultInfo(SLPIfaceInfo
if ((family == AF_INET) || (family == AF_UNSPEC))
{
- fd = socket(AF_INET, SOCK_DGRAM, 0);
+ fd = socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC, 0);
if (fd != -1)
{
#ifdef AIX
@@ -813,7 +813,7 @@ int SLPIfaceGetDefaultInfo(SLPIfaceInfo*
SOCKET_ADDRESS_LIST * plist = 0;
int i;
- if ((fd = socket(AF_INET6, SOCK_DGRAM, 0)) != INVALID_SOCKET)
+ if ((fd = socket(AF_INET6, SOCK_DGRAM|SOCK_CLOEXEC, 0)) != INVALID_SOCKET)
{
/* We want to get a reasonable length buffer, so call empty first to fill in buflen, ignoring errors*/
WSAIoctl(fd, SIO_ADDRESS_LIST_QUERY, 0, 0, buffer, buflen, &buflen, 0, 0);
@@ -850,7 +850,7 @@ int SLPIfaceGetDefaultInfo(SLPIfaceInfo*
SOCKET_ADDRESS_LIST * plist = 0;
int i;
- if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) != INVALID_SOCKET)
+ if ((fd = socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC, 0)) != INVALID_SOCKET)
{
/* We want to get a reasonable length buffer, so call empty first to fill in buflen, ignoring errors */
WSAIoctl(fd, SIO_ADDRESS_LIST_QUERY, 0, 0, buffer, buflen, &buflen, 0, 0);
@@ -1054,7 +1054,7 @@ int SLPIfaceGetInfo(const char * useifac
{
if (SLPNetIsIPV4() && ((family == AF_INET) || (family == AF_UNSPEC)))
{
- fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+ fd = socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, IPPROTO_TCP);
if (fd != SLP_INVALID_SOCKET)
{
v4addr.sin_family = AF_INET;
--- ./common/slp_network.c.orig 2014-02-17 18:16:57.884239271 +0000
+++ ./common/slp_network.c 2014-02-17 18:21:48.434238757 +0000
@@ -88,7 +88,7 @@ sockfd_t SLPNetworkConnectStream(void *
(void)timeout;
/** @todo Make the socket non-blocking so we can timeout on connect. */
- result = socket(a->sa_family, SOCK_STREAM, IPPROTO_TCP);
+ result = socket(a->sa_family, SOCK_STREAM|SOCK_CLOEXEC, IPPROTO_TCP);
if (result != SLP_INVALID_SOCKET)
{
if (connect(result, peeraddr, sizeof(struct sockaddr_storage)) == 0)
@@ -127,7 +127,7 @@ sockfd_t SLPNetworkCreateDatagram(short
recvfrom will fail on some platforms*/
sockfd_t result;
- result = socket(family, SOCK_DGRAM, IPPROTO_UDP);
+ result = socket(family, SOCK_DGRAM|SOCK_CLOEXEC, IPPROTO_UDP);
if (result != SLP_INVALID_SOCKET)
{
#ifndef _WIN32
--- ./common/slp_property.c.orig 2014-02-17 18:16:53.361239279 +0000
+++ ./common/slp_property.c 2014-02-17 18:23:39.306238561 +0000
@@ -217,7 +217,7 @@ static void InitializeMTUPropertyValue()
#ifndef _WIN32
family = SLPPropertyAsBoolean("net.slp.useIPv4") ? AF_INET : AF_INET6;
- if ((sock = socket(family, SOCK_DGRAM, 0)) != SLP_INVALID_SOCKET)
+ if ((sock = socket(family, SOCK_DGRAM|SOCK_CLOEXEC, 0)) != SLP_INVALID_SOCKET)
{
if (getsockopt(sock, SOL_SOCKET, SO_RCVBUF, &value, &valSize) != -1)
{
@@ -311,7 +311,7 @@ static bool ReadFileProperties(char cons
rewind(conffp);
/* open configuration file for read - missing file returns false */
- if ((fp = s_UsePropertyFps ? conffp : fopen(conffile, "r")) != 0)
+ if ((fp = s_UsePropertyFps ? conffp : fopen(conffile, "re")) != 0)
{
/* read a line at a time - max 4k characters per line */
while (fgets(alloced, CONFFILE_RDBUFSZ, fp))
@@ -400,11 +400,11 @@ static int ReadPropertyFiles(void)
if (s_UsePropertyFps == 1)
{
if (*s_GlobalPropertyFile)
- s_GlobalPropertyFp = fopen(s_GlobalPropertyFile, "r");
+ s_GlobalPropertyFp = fopen(s_GlobalPropertyFile, "re");
if (*s_EnvPropertyFile)
- s_EnvPropertyFp = fopen(s_EnvPropertyFile, "r");
+ s_EnvPropertyFp = fopen(s_EnvPropertyFile, "re");
if (*s_AppPropertyFile)
- s_AppPropertyFp = fopen(s_AppPropertyFile, "r");
+ s_AppPropertyFp = fopen(s_AppPropertyFile, "re");
s_UsePropertyFps = 2;
}
--- ./common/slp_spi.c.orig 2014-02-17 18:16:57.885239271 +0000
+++ ./common/slp_spi.c 2014-02-17 18:23:08.570238615 +0000
@@ -124,7 +124,7 @@ static SLPCryptoDSAKey * SLPSpiReadKeyFi
FILE * fp;
SLPCryptoDSAKey * result = 0;
- fp = fopen(keyfile, "r");
+ fp = fopen(keyfile, "re");
if (fp)
{
if (keytype == SLPSPI_KEY_TYPE_PUBLIC)
@@ -262,7 +262,7 @@ SLPSpiHandle SLPSpiOpen(const char * spi
SLPSpiHandle result = 0;
SLPSpiEntry * spientry;
- fp = fopen(spifile,"r");
+ fp = fopen(spifile,"re");
if (fp)
{
result = xmalloc(sizeof(struct _SLPSpiHandle));
--- ./common/slp_xcast.c.orig 2014-02-17 18:16:57.882239271 +0000
+++ ./common/slp_xcast.c 2014-02-17 18:22:40.010238666 +0000
@@ -79,7 +79,7 @@ int SLPBroadcastSend(const SLPIfaceInfo
if (ifaceinfo[socks->sock_count].bcast_addr->ss_family == AF_INET)
{
socks->sock[socks->sock_count] = socket(ifaceinfo[socks->sock_count]
- .bcast_addr->ss_family, SOCK_DGRAM, 0);
+ .bcast_addr->ss_family, SOCK_DGRAM|SOCK_CLOEXEC, 0);
if (socks->sock[socks->sock_count] == SLP_INVALID_SOCKET)
return -1; /* error creating socket */
@@ -190,7 +190,7 @@ int SLPMulticastSend(const SLPIfaceInfo
{
int family = ifaceinfo->iface_addr[socks->sock_count].ss_family;
- socks->sock[socks->sock_count] = socket(family, SOCK_DGRAM, 0);
+ socks->sock[socks->sock_count] = socket(family, SOCK_DGRAM|SOCK_CLOEXEC, 0);
if((socks->sock[socks->sock_count] == SLP_INVALID_SOCKET) ||
(SetMulticastIF(family, socks->sock[socks->sock_count], &ifaceinfo->iface_addr[socks->sock_count]) ||
(SetMulticastTTL(family, socks->sock[socks->sock_count], SLPPropertyAsInteger("net.slp.multicastTTL")))))
--- ./common/slp_xmalloc.c.orig 2014-02-17 18:16:57.884239271 +0000
+++ ./common/slp_xmalloc.c 2014-02-17 18:23:17.506238600 +0000
@@ -292,7 +292,7 @@ void _xfree(const char * file, int line,
*/
int xmalloc_init(const char * filename, size_t freemem)
{
- G_xmalloc_fh = fopen(filename, "w");
+ G_xmalloc_fh = fopen(filename, "we");
if (G_xmalloc_fh == 0)
return 0;
G_xmalloc_freemem = freemem;
--- ./libslp/libslp_network.c.orig 2014-02-17 18:16:57.888239271 +0000
+++ ./libslp/libslp_network.c 2014-02-17 18:18:05.498239152 +0000
@@ -1618,7 +1618,7 @@ SLPError NetworkMultiUcastRqstRply(
/*----------------------------------------*/
/* Create a UDP socket to use */
/*----------------------------------------*/
- udp_socket = socket(AF_INET, SOCK_DGRAM, 0);
+ udp_socket = socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC, 0);
if (udp_socket < 0)
{
result = SLP_NETWORK_ERROR;
@@ -2092,7 +2092,7 @@ SLPError NetworkMultiUcastRqstRply(
if (result == SLP_ERROR_RETRY_UNICAST)
{
result = SLP_OK;
- pconn->socket = socket(AF_INET, SOCK_STREAM, 0);
+ pconn->socket = socket(AF_INET, SOCK_STREAM||SOCK_CLOEXEC, 0);
if (pconn->socket < 0)
{
result = SLP_NETWORK_ERROR;

11
openslp.daemon.diff Normal file
View File

@ -0,0 +1,11 @@
--- ./slpd/slpd_main.c.orig 2014-02-17 18:14:08.220239572 +0000
+++ ./slpd/slpd_main.c 2014-02-17 18:14:37.546239520 +0000
@@ -520,7 +520,7 @@ static int DropPrivileges()
/* TODO: warn if 'daemon' user has insufficient privileges and ipv6 requested.*/
/* TODO: allow different user to be specified as process owner. */
- struct passwd * pwent = getpwnam("daemon");
+ struct passwd * pwent = getpwnam("openslp");
if (pwent)
{
if (chroot(reg_file_dir))

4
openslp.desktop Normal file
View File

@ -0,0 +1,4 @@
[Desktop Entry]
Name=Open SLP User Guide
DocPath=/usr/share/doc/packages/openslp/html/UsersGuide/index.html
X-DOC-SearchMethod=htdig

42
openslp.doubleequal.diff Normal file
View File

@ -0,0 +1,42 @@
--- ./slpd/slpd_predicate.c.orig 2014-12-15 14:11:36.181812237 +0000
+++ ./slpd/slpd_predicate.c 2014-12-15 14:20:00.441759165 +0000
@@ -66,6 +66,7 @@
#include "slp_xmalloc.h"
#include "slpd_predicate.h"
+#include "slpd_property.h"
/* Parse character definitions. */
#define BRACKET_OPEN '('
@@ -1633,6 +1634,11 @@ SLPDPredicateParseResult createPredicate
op = EQUAL;
}
+ if (op == EQUAL && G_SlpdProperty.allowDoubleEqualInPredicate && operator[1] == '=')
+ {
+ val_start++;
+ }
+
/***** Get operands. *****/
/**** Left. ****/
lhs_len = operator - cur;
--- ./slpd/slpd_property.c.orig 2014-12-15 14:09:49.294246247 +0000
+++ ./slpd/slpd_property.c 2014-12-15 14:11:21.587871548 +0000
@@ -250,6 +250,7 @@ void SLPDPropertyReinit(void)
G_SlpdProperty.myHostnameLen = strlen(G_SlpdProperty.myHostname);
G_SlpdProperty.hardMTU = SLPPropertyAsBoolean("net.slp.hardMTU");
+ G_SlpdProperty.allowDoubleEqualInPredicate = SLPPropertyAsBoolean("net.slp.allowDoubleEqualInPredicate");
G_SlpdProperty.DASyncReg = SLPPropertyAsBoolean("net.slp.DASyncReg");
G_SlpdProperty.isDABackup = SLPPropertyAsBoolean("net.slp.isDABackup");
--- ./slpd/slpd_property.h.orig 2014-12-15 14:09:43.647269171 +0000
+++ ./slpd/slpd_property.h 2014-12-15 14:10:24.932101603 +0000
@@ -118,6 +118,7 @@ typedef struct _SLPDProperty
int useDHCP;
int oversizedUDP;
int hardMTU;
+ int allowDoubleEqualInPredicate;
int DASyncReg;
int isDABackup;

11
openslp.foldws.diff Normal file
View File

@ -0,0 +1,11 @@
--- ./common/slp_compare.c.orig 2016-10-12 11:44:17.925163946 +0000
+++ ./common/slp_compare.c 2016-10-12 11:50:22.658115399 +0000
@@ -204,7 +204,7 @@ 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. */
+ 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. */

246
openslp.hardmtu.diff Normal file
View File

@ -0,0 +1,246 @@
--- ./common/slp_property.c.orig 2014-02-18 17:14:52.119092941 +0000
+++ ./common/slp_property.c 2014-02-18 17:15:01.462092925 +0000
@@ -181,6 +181,8 @@ static int SetDefaultValues(void)
{"net.slp.isDABackup", "false", 0},
{"net.slp.DABackupInterval", "900", 0},
{"net.slp.DABackupLocalReg", "false", 0},
+
+ {"net.slp.hardMTU", "false", 0},
};
int i;
--- ./etc/slp.conf.orig 2014-02-18 17:14:52.109092941 +0000
+++ ./etc/slp.conf 2014-02-18 17:15:01.463092925 +0000
@@ -168,6 +168,12 @@
# A integer giving the network packet MTU in bytes. (Default is 1400)
;net.slp.MTU = 1400
+# make sure that UDP packets really are smaller than the MTU. Normally
+# openslp will truncate packets so that they are a bit bigger than
+# the MTU, as a workaround for bugs in old openslp implementations.
+# (Default is false)
+;net.slp.hardMTU = false
+
#
# If operating as an SA or DA, this specifies the maximum number of interfaces
# that can be active. (Default is 100)
--- ./slpd/slpd_incoming.c.orig 2014-02-18 17:14:52.103092941 +0000
+++ ./slpd/slpd_incoming.c 2014-02-18 17:15:01.464092925 +0000
@@ -89,6 +89,8 @@ static void IncomingDatagramRead(SLPList
truncate = G_SlpdProperty.MTU;
if (G_SlpdProperty.oversizedUDP)
truncate = 0;
+ if (G_SlpdProperty.hardMTU)
+ truncate = G_SlpdProperty.MTU - 28;
if (!sock->sendbuf)
/* Some of the error handling code expects a sendbuf to be available
--- ./slpd/slpd_process.c.orig 2014-02-18 17:14:52.104092941 +0000
+++ ./slpd/slpd_process.c 2014-02-18 17:19:11.508092482 +0000
@@ -406,6 +406,7 @@ static int ProcessSrvRqst(SLPMessage * m
SLPUrlEntry * urlentry;
SLPDDatabaseSrvRqstResult * db = 0;
size_t size = 0;
+ int truncated = 0;
SLPBuffer result = *sendbuf;
/* If errorcode is set, we can not be sure that message is good
@@ -509,9 +510,14 @@ RESPOND:
{
for (i = 0; i < db->urlcount; i++)
{
+ int oldsize = size;
+
/* check size limitation */
if (truncate && size > truncate)
+ {
+ truncated = 1;
break;
+ }
/* urlentry is the url from the db result */
urlentry = db->urlarray[i];
@@ -529,6 +535,12 @@ RESPOND:
{
size += urlentry->opaquelen;
}
+ if (G_SlpdProperty.hardMTU && truncate && size > truncate)
+ {
+ size = oldsize;
+ truncated = 1;
+ break;
+ }
}
}
@@ -552,7 +564,7 @@ RESPOND:
PutUINT24(&result->curpos, size);
/* flags */
- PutUINT16(&result->curpos, (size > (size_t)G_SlpdProperty.MTU?
+ PutUINT16(&result->curpos, (truncated || size > (size_t)G_SlpdProperty.MTU?
SLP_FLAG_OVERFLOW: 0));
/* ext offset */
@@ -580,8 +592,12 @@ RESPOND:
for (i = 0; i < db->urlcount; i++)
{
/* check size limitation */
- if (truncate && result->curpos - result->start > truncate)
+ if (result->curpos - result->start >= size)
+ {
+ /* reached size limit due to truncation. fix up url count */
+ TO_UINT16(result->start + 14 + message->header.langtaglen + 2, i);
break;
+ }
/* urlentry is the url from the db result */
urlentry = db->urlarray[i];
@@ -880,10 +896,12 @@ static int ProcessSrvAck(SLPMessage * me
* @internal
*/
static int ProcessAttrRqst(SLPMessage * message, SLPBuffer * sendbuf,
- int errorcode)
+ int errorcode, int truncate)
{
SLPDDatabaseAttrRqstResult * db = 0;
size_t size = 0;
+ int truncated = 1;
+ size_t attrlistlen = 0;
SLPBuffer result = *sendbuf;
#ifdef ENABLE_SLPv2_SECURITY
@@ -1032,6 +1050,15 @@ RESPOND:
}
#endif
+ /* truncate if needed */
+ attrlistlen = db->attrlistlen;
+ if (truncate && size > truncate && G_SlpdProperty.hardMTU)
+ {
+ attrlistlen = 0;
+ opaqueauth = 0;
+ size = message->header.langtaglen + 19; /* 14 bytes for header */
+ truncated = 1;
+ }
}
/* alloc the buffer */
@@ -1054,7 +1081,7 @@ RESPOND:
PutUINT24(&result->curpos, size);
/* flags */
- PutUINT16(&result->curpos, (size > (size_t)G_SlpdProperty.MTU?
+ PutUINT16(&result->curpos, (truncated || size > (size_t)G_SlpdProperty.MTU?
SLP_FLAG_OVERFLOW: 0));
/* ext offset */
@@ -1078,10 +1105,10 @@ RESPOND:
if (errorcode == 0)
{
/* attr-list len */
- PutUINT16(&result->curpos, db->attrlistlen);
- if (db->attrlistlen)
- memcpy(result->curpos, db->attrlist, db->attrlistlen);
- result->curpos += db->attrlistlen;
+ PutUINT16(&result->curpos, attrlistlen);
+ if (attrlistlen)
+ memcpy(result->curpos, db->attrlist, attrlistlen);
+ result->curpos += attrlistlen;
/* authentication block */
#ifdef ENABLE_SLPv2_SECURITY
@@ -1187,9 +1214,11 @@ RESPOND:
* @internal
*/
static int ProcessSrvTypeRqst(SLPMessage * message, SLPBuffer * sendbuf,
- int errorcode)
+ int errorcode, int truncate)
{
size_t size = 0;
+ int truncated = 0;
+ size_t typelistlen = 0;
SLPDDatabaseSrvTypeRqstResult * db = 0;
SLPBuffer result = *sendbuf;
@@ -1233,7 +1262,18 @@ RESPOND:
/* 2 bytes for error code */
/* 2 bytes for srvtype len */
if (errorcode == 0)
+ {
size += db->srvtypelistlen;
+ typelistlen = db->srvtypelistlen;
+
+ /* truncate result if needed */
+ if (truncate && size > truncate && G_SlpdProperty.hardMTU)
+ {
+ typelistlen = 0;
+ size -= db->srvtypelistlen;
+ truncated = 1;
+ }
+ }
/* Reallocate the result buffer */
result = SLPBufferRealloc(result, size);
@@ -1255,7 +1295,7 @@ RESPOND:
PutUINT24(&result->curpos, size);
/* flags */
- PutUINT16(&result->curpos, (size > (size_t)G_SlpdProperty.MTU?
+ PutUINT16(&result->curpos, (truncated || size > (size_t)G_SlpdProperty.MTU?
SLP_FLAG_OVERFLOW: 0));
/* ext offset */
@@ -1279,9 +1319,10 @@ RESPOND:
if (errorcode == 0)
{
/* length of srvtype-list */
- PutUINT16(&result->curpos, db->srvtypelistlen);
- memcpy(result->curpos, db->srvtypelist, db->srvtypelistlen);
- result->curpos += db->srvtypelistlen;
+ PutUINT16(&result->curpos, typelistlen);
+ if (typelistlen)
+ memcpy(result->curpos, db->srvtypelist, typelistlen);
+ result->curpos += typelistlen;
}
FINISHED:
@@ -1412,7 +1453,7 @@ int SLPDProcessMessage(struct sockaddr_s
break;
case SLP_FUNCT_ATTRRQST:
- errorcode = ProcessAttrRqst(message, sendbuf, errorcode);
+ errorcode = ProcessAttrRqst(message, sendbuf, errorcode, truncate);
break;
case SLP_FUNCT_DAADVERT:
@@ -1421,7 +1462,7 @@ int SLPDProcessMessage(struct sockaddr_s
break;
case SLP_FUNCT_SRVTYPERQST:
- errorcode = ProcessSrvTypeRqst(message, sendbuf, errorcode);
+ errorcode = ProcessSrvTypeRqst(message, sendbuf, errorcode, truncate);
break;
case SLP_FUNCT_SAADVERT:
--- ./slpd/slpd_property.c.orig 2014-02-18 17:14:52.112092941 +0000
+++ ./slpd/slpd_property.c 2014-02-18 17:15:01.465092925 +0000
@@ -250,6 +250,8 @@ void SLPDPropertyReinit(void)
G_SlpdProperty.myHostname = SLPDGetCanonHostname();
G_SlpdProperty.myHostnameLen = strlen(G_SlpdProperty.myHostname);
+ G_SlpdProperty.hardMTU = SLPPropertyAsBoolean("net.slp.hardMTU");
+
G_SlpdProperty.DASyncReg = SLPPropertyAsBoolean("net.slp.DASyncReg");
G_SlpdProperty.isDABackup = SLPPropertyAsBoolean("net.slp.isDABackup");
G_SlpdProperty.DABackupInterval = SLPPropertyAsInteger("net.slp.DABackupInterval");
--- ./slpd/slpd_property.h.orig 2014-02-18 17:14:52.113092941 +0000
+++ ./slpd/slpd_property.h 2014-02-18 17:15:01.465092925 +0000
@@ -117,6 +117,7 @@ typedef struct _SLPDProperty
int MTU;
int useDHCP;
int oversizedUDP;
+ int hardMTU;
int DASyncReg;
int isDABackup;

1354
openslp.initda.diff Normal file

File diff suppressed because it is too large Load Diff

11
openslp.localaddr.diff Normal file
View File

@ -0,0 +1,11 @@
--- ./slpd/slpd_incoming.c.orig 2018-03-01 15:55:45.008171255 +0000
+++ ./slpd/slpd_incoming.c 2018-03-01 15:56:23.183054003 +0000
@@ -354,7 +354,7 @@ static void IncomingSocketListen(SLPList
connsock->fd = fd;
memcpy(&connsock->peeraddr, &peeraddr,
sizeof(struct sockaddr_storage));
- memcpy(&connsock->localaddr, &peeraddr,
+ memcpy(&connsock->localaddr, &sock->localaddr,
sizeof(struct sockaddr_storage));
connsock->state = STREAM_READ_FIRST;
#ifndef _WIN32

13
openslp.localtime.diff Normal file
View File

@ -0,0 +1,13 @@
--- ./slpd/slpd_log.c.orig 2014-02-19 17:30:21.682938372 +0000
+++ ./slpd/slpd_log.c 2014-02-19 17:32:04.664938189 +0000
@@ -182,7 +182,9 @@ void SLPDLogBuffer(const char * prefix,
void SLPDLogTime(void)
{
time_t curtime = time(0);
- SLPDLog("%s", ctime(&curtime));
+ struct tm ltm;
+ /* we use localtime_r so that glibc does not re-init the timezone */
+ SLPDLog("%s", asctime(localtime_r(&curtime, &ltm)));
}
/** Logs information about a SrvRequest message to the log file.

14
openslp.logrotate Normal file
View File

@ -0,0 +1,14 @@
/var/log/slpd.log {
compress
dateext
maxage 14
rotate 99
size +1024k
notifempty
missingok
create 600 root root
sharedscripts
postrotate
/etc/init.d/slpd restart
endscript
}

14
openslp.logrotate.systemd Normal file
View File

@ -0,0 +1,14 @@
/var/log/slpd.log {
compress
dateext
maxage 14
rotate 99
size +1024k
notifempty
missingok
create 600 root root
sharedscripts
postrotate
systemctl reload slpd.service
endscript
}

214
openslp.netlink.diff Normal file
View File

@ -0,0 +1,214 @@
--- ./slpd/slpd_database.c.orig 2014-02-19 18:04:09.926934782 +0000
+++ ./slpd/slpd_database.c 2014-02-19 18:04:34.553934738 +0000
@@ -50,6 +50,10 @@
#define _GNU_SOURCE
#include <string.h>
#include <dirent.h>
+#include <sys/socket.h>
+#include <linux/netlink.h>
+#include <linux/inet_diag.h>
+#include <sched.h>
#include "../libslpattr/libslpattr.h"
#include "slpd_database.h"
@@ -1919,6 +1923,168 @@ int SLPDDatabaseReInit()
return 0;
}
+enum {
+ SS_UNKNOWN,
+ SS_ESTABLISHED,
+ SS_SYN_SENT,
+ SS_SYN_RECV,
+ SS_FIN_WAIT1,
+ SS_FIN_WAIT2,
+ SS_TIME_WAIT,
+ SS_CLOSE,
+ SS_CLOSE_WAIT,
+ SS_LAST_ACK,
+ SS_LISTEN,
+ SS_CLOSING,
+ SS_MAX
+};
+
+#define SS_ALL ((1<<SS_MAX)-1)
+
+static int reconnect_nl(int *fd)
+{
+ int new_fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_INET_DIAG);
+ close (*fd);
+ if (new_fd < 0)
+ return errno;
+ *fd = new_fd;
+ return 0;
+}
+
+static void SLPDDatabaseWatcher_nl(int *fd, int flag, unsigned char *porthash)
+{
+ char buf[8192];
+ int port, status = 0;
+ SLPDatabaseHandle dh;
+
+ struct sockaddr_nl nladdr = {
+ .nl_family = AF_NETLINK
+ };
+
+ struct {
+ struct nlmsghdr nlh;
+ struct inet_diag_req r;
+ } req = {
+ .nlh = {
+ .nlmsg_len = sizeof(req),
+ .nlmsg_type = TCPDIAG_GETSOCK,
+ .nlmsg_flags = NLM_F_ROOT|NLM_F_MATCH|NLM_F_REQUEST,
+ .nlmsg_pid = 0,
+ .nlmsg_seq = 123456,
+ },
+ .r = {
+ .idiag_family = AF_INET,
+ .idiag_states = 1 << SS_LISTEN,
+ .idiag_ext = ((1 << (INET_DIAG_INFO - 1)) |
+ (1 << (INET_DIAG_VEGASINFO - 1)) |
+ (1 << (INET_DIAG_CONG - 1))),
+ }
+ };
+
+ struct iovec iov = {
+ .iov_base = &req,
+ .iov_len = sizeof(req),
+ };
+
+ struct msghdr msg = {
+ .msg_name = (void *)&nladdr,
+ .msg_namelen = sizeof(nladdr),
+ .msg_iov = &iov,
+ .msg_iovlen = 1,
+ };
+ struct in_addr ipv4_loopback = { htonl(INADDR_LOOPBACK) };
+ struct in6_addr ipv6_loopback = IN6ADDR_LOOPBACK_INIT;
+ int retries;
+
+ /* If the socket shuts down for whatever reason, we need to
+ * reopen it. Since we can't listen to a socket for which we have
+ * made a request, we reissue the request and listen again. */
+retry_sendmsg:
+ retries = 2;
+ while (retries-- > 0) {
+ if (sendmsg(*fd, &msg, 0) >= 0)
+ break;
+
+ if (reconnect_nl(fd)) {
+ SLPDLog("Lost TCPDIAG netlink connection and attempts to "
+ "re-establish have failed. Falling back to /proc/net/tcp "
+ "for dead/alive updates.\n");
+ *fd = -1;
+ return;
+ }
+ sched_yield();
+ }
+
+ iov.iov_base = buf;
+ iov.iov_len = sizeof(buf);
+
+ dh = SLPDatabaseOpen(&G_SlpdDatabase.database);
+ while (!status) {
+ struct nlmsghdr *h;
+
+ status = recvmsg(*fd, &msg, 0);
+ if (status < 0) {
+ if (errno == EINTR)
+ continue;
+ goto retry_sendmsg;
+ }
+
+ /* Socket has shut down */
+ if (status == 0)
+ goto retry_sendmsg;
+
+ for (h = (struct nlmsghdr *) buf; NLMSG_OK(h, status);
+ h = NLMSG_NEXT(h, status)) {
+ SLPDatabaseEntry *entry;
+ struct inet_diag_msg *r = NLMSG_DATA(h);
+
+ if (h->nlmsg_seq != 123456)
+ continue;
+
+ if (h->nlmsg_type == NLMSG_DONE)
+ goto close;
+
+ if (h->nlmsg_type == NLMSG_ERROR) {
+ struct nlmsgerr *err = NLMSG_DATA(h);
+ if (h->nlmsg_len >= NLMSG_LENGTH(sizeof(*err)))
+ status = EINVAL;
+ else
+ status = -err->error;
+ break;
+ }
+
+ if (r->idiag_family != AF_INET && r->idiag_family != AF_INET6)
+ continue;
+
+ if (r->idiag_family == AF_INET &&
+ ipv4_loopback.s_addr == r->id.idiag_src[0])
+ continue;
+
+ if (r->idiag_family == AF_INET6 &&
+ !memcmp(ipv6_loopback.s6_addr32, r->id.idiag_src,
+ sizeof(ipv6_loopback)))
+ continue;
+
+ port = ntohs(r->id.idiag_sport);
+ if (!(porthash[(port / 8) & 255] & (1 << (port & 7))))
+ continue;
+
+ SLPDatabaseRewind(dh);
+
+ while ((entry = SLPDatabaseEnum(dh)) != 0) {
+ SLPSrvReg *srvreg = &(entry->msg->body.srvreg);
+ if (!(srvreg->watchflags & flag))
+ continue;
+ if (port == srvreg->watchport)
+ srvreg->watchflags &= ~SLP_REG_WATCH_CHECKING;
+ }
+ }
+ }
+
+close:
+ SLPDatabaseClose(dh);
+}
+
static void SLPDDatabaseWatcher_fd(int fd, int flag, unsigned char *porthash)
{
SLPDatabaseHandle dh;
@@ -1978,7 +2144,7 @@ static void SLPDDatabaseWatcher_fd(int f
void SLPDDatabaseWatcher(void)
{
static int initialized = 0;
- static int proctcp, procudp, proctcp6, procudp6;
+ static int proctcp, procudp, proctcp6, procudp6, inet_diag = -1;
unsigned char porthash[256];
int flags, port;
SLPDatabaseHandle dh;
@@ -1986,6 +2152,7 @@ void SLPDDatabaseWatcher(void)
SLPSrvReg* srvreg;
if (!initialized) {
+ inet_diag = socket(AF_NETLINK, SOCK_RAW, NETLINK_INET_DIAG);
proctcp = open("/proc/net/tcp_listen", O_RDONLY);
if (proctcp == -1)
proctcp = open("/proc/net/tcp", O_RDONLY);
@@ -2010,8 +2177,12 @@ void SLPDDatabaseWatcher(void)
}
SLPDatabaseClose(dh);
if ((flags & SLP_REG_WATCH_TCP) != 0) {
- SLPDDatabaseWatcher_fd(proctcp, SLP_REG_WATCH_TCP, porthash);
- SLPDDatabaseWatcher_fd(proctcp6, SLP_REG_WATCH_TCP, porthash);
+ if (inet_diag >= 0)
+ SLPDDatabaseWatcher_nl(&inet_diag, SLP_REG_WATCH_TCP, porthash);
+ if (inet_diag < 0) { /* Fallback if _nl fails */
+ SLPDDatabaseWatcher_fd(proctcp, SLP_REG_WATCH_TCP, porthash);
+ SLPDDatabaseWatcher_fd(proctcp6, SLP_REG_WATCH_TCP, porthash);
+ }
}
if ((flags & SLP_REG_WATCH_UDP) != 0) {
SLPDDatabaseWatcher_fd(procudp, SLP_REG_WATCH_UDP, porthash);

210
openslp.noconvenience.diff Normal file
View File

@ -0,0 +1,210 @@
--- ./common/slp_auth.c.orig 2016-09-12 14:33:58.923718969 +0000
+++ ./common/slp_auth.c 2016-09-12 14:35:19.660448155 +0000
@@ -237,6 +237,7 @@ static int SLPAuthSignDigest(int spistrl
curpos += spistrlen;
/* sign the digest and put it in the authblock */
+ memset(curpos, 0, signaturelen);
if (SLPCryptoDSASign(key, digest, SLPAUTH_SHA1_DIGEST_SIZE,
curpos, &signaturelen))
{
--- ./common/slp_crypto.c.orig 2016-09-12 14:30:13.053476772 +0000
+++ ./common/slp_crypto.c 2016-09-12 14:31:32.443210397 +0000
@@ -153,6 +153,20 @@ int SLPCryptoDSASign(SLPCryptoDSAKey * k
int SLPCryptoDSAVerify(SLPCryptoDSAKey * key, const unsigned char * digest,
int digestlen, const unsigned char * signature, int signaturelen)
{
+ /* newer openssl versions need the exact size. trim down. */
+ if (signaturelen > 2 && *signature == 0x30)
+ {
+ int l = 0;
+ if (signature[1] < 128)
+ l = 2 + signature[1];
+ else if (signature[1] == 129)
+ l = 3 + signature[2];
+ else if (signature[1] == 130)
+ l = 4 + (signature[2] << 8 | signature[3]);
+ if (l && l < signaturelen)
+ signaturelen = l;
+ }
+
/* it does not look like the type param is used? */
/* broken DSA_verify() declaration */
return DSA_verify(0, digest, digestlen, (unsigned char *)signature,
--- ./common/slp_v2message.c.orig 2016-09-12 10:51:36.284400063 +0000
+++ ./common/slp_v2message.c 2016-09-12 10:55:19.553648752 +0000
@@ -150,13 +150,6 @@ static int v2ParseUrlEntry(SLPBuffer buf
}
urlentry->opaquelen = buffer->curpos - urlentry->opaque;
- /* Terminate the URL string for caller convenience - we're overwriting
- * the first byte of the "# of URL auths" field, but it's okay because
- * we've already read and stored it away.
- */
- if(urlentry->url)
- ((uint8_t *)urlentry->url)[urlentry->urllen] = 0;
-
return 0;
}
@@ -543,12 +536,6 @@ static int v2ParseAttrRply(SLPBuffer buf
}
}
- /* Terminate the attr list for caller convenience - overwrites the
- * first byte of the "# of AttrAuths" field, but we've processed it.
- */
- if(attrrply->attrlist)
- ((uint8_t *)attrrply->attrlist)[attrrply->attrlistlen] = 0;
-
return 0;
}
@@ -643,13 +630,6 @@ static int v2ParseDAAdvert(SLPBuffer buf
}
}
- /* Terminate the URL string for caller convenience - we're overwriting
- * the first byte of the "Length of <scope-list>" field, but it's okay
- * because we've already read and stored it away.
- */
- if(daadvert->url)
- ((uint8_t *)daadvert->url)[daadvert->urllen] = 0;
-
return 0;
}
@@ -749,14 +729,6 @@ static int v2ParseSrvTypeRply(SLPBuffer
if (buffer->curpos > buffer->end)
return SLP_ERROR_PARSE_ERROR;
- /* Terminate the service type list string for caller convenience - while
- * it appears that we're writing one byte past the end of the buffer here,
- * it's not so - message buffers are always allocated one byte larger than
- * requested for just this reason.
- */
- if(srvtyperply->srvtypelist)
- ((uint8_t *)srvtyperply->srvtypelist)[srvtyperply->srvtypelistlen] = 0;
-
return 0;
}
@@ -825,13 +797,6 @@ static int v2ParseSAAdvert(SLPBuffer buf
}
}
- /* Terminate the URL string for caller convenience - we're overwriting
- * the first byte of the "Length of <scope-list>" field, but it's okay
- * because we've already read and stored it away.
- */
- if(saadvert->url)
- ((uint8_t *)saadvert->url)[saadvert->urllen] = 0;
-
return 0;
}
--- ./libslp/libslp_findattrs.c.orig 2016-09-12 10:57:02.363303412 +0000
+++ ./libslp/libslp_findattrs.c 2016-09-12 10:58:41.416970996 +0000
@@ -98,6 +98,9 @@ static SLPBoolean ProcessAttrRplyCallbac
return SLP_TRUE; /* Authentication failure. */
}
#endif
+ /* TRICKY: null terminate the attrlist by setting the authcount to 0 */
+ ((char*)(attrrply->attrlist))[attrrply->attrlistlen] = 0;
+
/* Call the user's callback function. */
result = handle->params.findattrs.callback(handle,
attrrply->attrlist, (SLPError)(-attrrply->errorcode),
--- ./libslp/libslp_findsrvs.c.orig 2016-09-12 10:57:07.995284521 +0000
+++ ./libslp/libslp_findsrvs.c 2016-09-12 11:26:08.220430148 +0000
@@ -227,6 +227,9 @@ static SLPBoolean ProcessSrvRplyCallback
&& SLPAuthVerifyUrl(handle->hspi, 1, &urlentry[i]))
continue; /* Authentication failed, skip this URLEntry. */
#endif
+ /* TRICKY: null terminate the url by setting the authcount to 0 */
+ ((char*)(urlentry[i].url))[urlentry[i].urllen] = 0;
+
result = CollateToSLPSrvURLCallback(handle, urlentry[i].url,
(unsigned short)urlentry[i].lifetime, SLP_OK, peeraddr);
if (result == SLP_FALSE)
@@ -245,6 +248,9 @@ static SLPBoolean ProcessSrvRplyCallback
return SLP_TRUE;
}
#endif
+ /* TRICKY: null terminate the url by setting the scope list length to 0 */
+ ((char *)replymsg->body.daadvert.url)[replymsg->body.daadvert.urllen] = 0;
+
result = CollateToSLPSrvURLCallback(handle,
replymsg->body.daadvert.url, SLP_LIFETIME_MAXIMUM,
SLP_OK, peeraddr);
@@ -260,6 +266,9 @@ static SLPBoolean ProcessSrvRplyCallback
return SLP_TRUE;
}
#endif
+ /* TRICKY: null terminate the url by setting the scope list length to 0 */
+ ((char *)replymsg->body.saadvert.url)[replymsg->body.saadvert.urllen] = 0;
+
result = CollateToSLPSrvURLCallback(handle,
replymsg->body.saadvert.url, SLP_LIFETIME_MAXIMUM,
SLP_OK, peeraddr);
--- ./libslp/libslp_findsrvtypes.c.orig 2016-09-12 10:57:15.275260063 +0000
+++ ./libslp/libslp_findsrvtypes.c 2016-09-12 11:03:41.863964662 +0000
@@ -175,8 +175,13 @@ static SLPBoolean ProcessSrvTypeRplyCall
{
SLPSrvTypeRply * srvtyperply = &replymsg->body.srvtyperply;
if (srvtyperply->srvtypelistlen)
+ {
+ /* TRICKY: null terminate the srvtypelist by setting the last byte 0 */
+ ((char*)(srvtyperply->srvtypelist))[srvtyperply->srvtypelistlen] = 0;
+
result = CollateToSLPSrvTypeCallback((SLPHandle)handle,
srvtyperply->srvtypelist, srvtyperply->errorcode * -1);
+ }
}
SLPMessageFree(replymsg);
}
--- ./libslp/libslp_knownda.c.orig 2016-09-12 10:57:21.083240529 +0000
+++ ./libslp/libslp_knownda.c 2016-09-12 11:07:26.178207707 +0000
@@ -335,6 +335,8 @@ static SLPBoolean KnownDADiscoveryCallba
{
SLPParsedSrvUrl * srvurl;
+ /* TRICKY: NULL terminate the DA url */
+ ((char*)(replymsg->body.daadvert.url))[replymsg->body.daadvert.urllen] = 0;
if (SLPParseSrvUrl(replymsg->body.daadvert.urllen,
replymsg->body.daadvert.url, &srvurl) == 0)
{
@@ -993,14 +995,22 @@ void KnownDAProcessSrvRqst(SLPHandleInfo
{
SLPBoolean cb_result;
SLPDatabaseEntry * entry = SLPDatabaseEnum(dh);
+ char tmp;
if (!entry)
break;
+ /* TRICKY temporary null termination of DA url */
+ tmp = entry->msg->body.daadvert.url[entry->msg->body.daadvert.urllen];
+ ((char*)(entry->msg->body.daadvert.url))[entry->msg->body.daadvert.urllen] = 0;
+
/* Call the SrvURLCallback. */
cb_result = handle->params.findsrvs.callback(handle,
entry->msg->body.daadvert.url, SLP_LIFETIME_MAXIMUM,
SLP_OK, handle->params.findsrvs.cookie);
+ /* TRICKY: undo temporary null termination of DA url */
+ ((char*)(entry->msg->body.daadvert.url))[entry->msg->body.daadvert.urllen] = tmp;
+
/* Does the caller want more? */
if (cb_result == SLP_FALSE)
break;
--- ./slpd/slpd_regfile.c.orig 2016-09-12 11:12:02.353273706 +0000
+++ ./slpd/slpd_regfile.c 2016-09-12 14:29:17.611662818 +0000
@@ -657,7 +657,7 @@ int SLPDRegFileWriteSrvReg(FILE * fd, SL
if (fd)
{
- fprintf(fd, "%s,%s,%d\n", msg->body.srvreg.urlentry.url, msg->header.langtag, msg->body.srvreg.urlentry.lifetime);
+ fprintf(fd, "%.*s,%s,%d\n", (int)(msg->body.srvreg.urlentry.urllen), msg->body.srvreg.urlentry.url, msg->header.langtag, msg->body.srvreg.urlentry.lifetime);
if (msg->body.srvreg.source == SLP_REG_SOURCE_PULL_PEER_DA)
fprintf(fd, "slp-source=pulled-from-da-%s\n", SLPNetSockAddrStorageToString(&msg->peer, addr_str, sizeof(addr_str)));
else if (msg->body.srvreg.source == SLP_REG_SOURCE_LOCAL)

13
openslp.nullattr.diff Normal file
View File

@ -0,0 +1,13 @@
--- slpd/slpd_predicate.c.orig 2019-06-06 14:12:09.025492155 +0000
+++ slpd/slpd_predicate.c 2019-06-06 14:12:56.605386533 +0000
@@ -2111,6 +2111,10 @@ int SLPDPredicateTestTree(SLPDPredicateT
if (!parseTree)
return 1;
+ /* a NULL set of attribures is always false */
+ if (!slp_attr)
+ return 0;
+
err = treeFilter(parseTree, slp_attr);
return (err == FR_EVAL_TRUE);

106
openslp.openssl-1.1.diff Normal file
View File

@ -0,0 +1,106 @@
--- a/openslp/common/slp_crypto.c
+++ b/openslp/common/slp_crypto.c
@@ -53,6 +53,80 @@
#include "slp_crypto.h"
#include "slp_message.h"
+/* 1.1.0 -> 1.0.x compatibility layer
+ * See https://wiki.openssl.org/index.php/OpenSSL_1.1.0_Changes#Compatibility_Layer
+ * for details and additiona compatibility routines if needed in the future.
+ */
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+static void DSA_get0_pqg(const DSA *d, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g)
+{
+ if (p != NULL)
+ *p = d->p;
+ if (q != NULL)
+ *q = d->q;
+ if (g != NULL)
+ *g = d->g;
+}
+
+static int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g)
+{
+ /* If the fields p, q and g in d are NULL, the corresponding input
+ * parameters MUST be non-NULL.
+ */
+ if ((d->p == NULL && p == NULL)
+ || (d->q == NULL && q == NULL)
+ || (d->g == NULL && g == NULL))
+ return 0;
+
+ if (p != NULL)
+ {
+ BN_free(d->p);
+ d->p = p;
+ }
+ if (q != NULL)
+ {
+ BN_free(d->q);
+ d->q = q;
+ }
+ if (g != NULL)
+ {
+ BN_free(d->g);
+ d->g = g;
+ }
+ return 1;
+}
+
+static void DSA_get0_key(const DSA *d, const BIGNUM **pub_key, const BIGNUM **priv_key)
+{
+ if (pub_key != NULL)
+ *pub_key = d->pub_key;
+ if (priv_key != NULL)
+ *priv_key = d->priv_key;
+}
+
+static int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key)
+{
+ /* If the field pub_key in d is NULL, the corresponding input
+ * parameters MUST be non-NULL. The priv_key field may
+ * be left NULL.
+ */
+ if (d->pub_key == NULL && pub_key == NULL)
+ return 0;
+
+ if (pub_key != NULL)
+ {
+ BN_free(d->pub_key);
+ d->pub_key = pub_key;
+ }
+ if (priv_key != NULL)
+ {
+ BN_free(d->priv_key);
+ d->priv_key = priv_key;
+ }
+ return 1;
+}
+#endif
+
/** Generate a SHA1 digest for the specified block data.
*
* @param[in] data - The data block to be hashed.
@@ -88,11 +162,17 @@
result = DSA_new();
if (result)
{
- 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);
+ 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 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));
}
return result;
}

View File

@ -0,0 +1,48 @@
--- ./slpd/slpd_predicate.c.orig 2014-12-15 13:07:38.636640141 +0000
+++ ./slpd/slpd_predicate.c 2014-12-15 13:10:09.507004676 +0000
@@ -1643,7 +1643,7 @@ SLPDPredicateParseResult createPredicate
rhs = val_start;
/***** Create leaf node. *****/
- *ppNode = (SLPDPredicateTreeNode *)xmalloc(sizeof (SLPDPredicateTreeNode) + lhs_len + rhs_len);
+ *ppNode = (SLPDPredicateTreeNode *)xmalloc(sizeof (SLPDPredicateTreeNode) + lhs_len + 1 + rhs_len + 1);
if (!(*ppNode))
return PREDICATE_PARSE_INTERNAL_ERROR;
@@ -1653,7 +1653,7 @@ SLPDPredicateParseResult createPredicate
/* Finished with "operator" now - just use as temporary pointer to assist with copying the
* attribute name (lhs) and required value (rhs) into the node
*/
- operator = (*ppNode)->nodeBody.comparison.storage;
+ operator = (char *)((*ppNode) + 1);
strncpy(operator, lhs, lhs_len);
operator[lhs_len] = '\0';
(*ppNode)->nodeBody.comparison.tag_len = lhs_len;
@@ -1853,7 +1853,7 @@ SLPDPredicateParseResult createPredicate
rhs = val_start;
/***** Create leaf node. *****/
- *ppNode = (SLPDPredicateTreeNode *)xmalloc(sizeof (SLPDPredicateTreeNode) + lhs_len + rhs_len);
+ *ppNode = (SLPDPredicateTreeNode *)xmalloc(sizeof (SLPDPredicateTreeNode) + lhs_len + 1 + rhs_len + 1);
if (!(*ppNode))
return PREDICATE_PARSE_INTERNAL_ERROR;
@@ -1863,7 +1863,7 @@ SLPDPredicateParseResult createPredicate
/* Finished with "operator" now - just use as temporary pointer to assist with copying the
* attribute name (lhs) and required value (rhs) into the node
*/
- operator = (*ppNode)->nodeBody.comparison.storage;
+ operator = (char *)((*ppNode) + 1);
strncpy(operator, lhs, lhs_len);
operator[lhs_len] = '\0';
(*ppNode)->nodeBody.comparison.tag_len = lhs_len;
--- ./slpd/slpd_predicate.h.orig 2014-12-15 13:07:43.084621416 +0000
+++ ./slpd/slpd_predicate.h 2014-12-15 13:08:00.738547083 +0000
@@ -98,7 +98,6 @@ typedef struct __SLPDPredicateTreeNode
char *tag_str;
size_t value_len;
char *value_str;
- char storage[2];
} comparison;
} nodeBody;
} SLPDPredicateTreeNode;

43
openslp.sd_notify.diff Normal file
View File

@ -0,0 +1,43 @@
--- ./configure.ac.orig 2013-06-08 04:58:54.000000000 +0000
+++ ./configure.ac 2018-04-11 12:36:14.299642065 +0000
@@ -35,6 +35,10 @@ AC_CHECK_LIB([nsl], [gethostbyname])
AC_CHECK_LIB([m], [log10])
AC_CHECK_LIB([pthread], [pthread_create])
+PKG_PROG_PKG_CONFIG
+
+PKG_CHECK_MODULES([SYSTEMD], [libsystemd])
+
#
# Checks for header files
#
--- ./slpd/Makefile.am.orig 2018-04-11 12:35:51.810698096 +0000
+++ ./slpd/Makefile.am 2018-04-11 12:36:14.300642062 +0000
@@ -95,5 +95,5 @@ noinst_HEADERS = \
slpd_initda.h
#if you're building on Irix, replace .la with .a below
-slpd_LDADD = ../common/libcommonslpd.la ../libslpattr/libslpattr.la
+slpd_LDADD = $(SYSTEMD_LIBS) ../common/libcommonslpd.la ../libslpattr/libslpattr.la
--- ./slpd/slpd_main.c.orig 2018-04-11 12:35:51.814698086 +0000
+++ ./slpd/slpd_main.c 2018-04-11 12:38:04.513363806 +0000
@@ -59,6 +59,8 @@
#include "slp_net.h"
#include "slp_network.h"
+#include <systemd/sd-daemon.h>
+
int G_SIGALRM;
int G_SIGTERM;
int G_SIGHUP;
@@ -704,6 +706,9 @@ int main(int argc, char * argv[])
/* init watcher */
SLPDDatabaseWatcher();
+ /* tell systemd what we are ready */
+ sd_notify(0, "READY=1");
+
/* drop privileges to reduce security risk */
if (DropPrivileges())
SLPDFatal("Could not drop privileges\n");

280
openslp.spec Normal file
View File

@ -0,0 +1,280 @@
#
# spec file for package openslp
#
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define libname libslp1
Name: openslp
Version: 2.0.0
Release: 0
Summary: An Implementation of Service Location Protocol V2
License: BSD-3-Clause
Group: System/Daemons
URL: http://www.openslp.org/
Source0: http://sourceforge.net/projects/openslp/files/2.0.0/%{version}/%{name}-%{version}.tar.gz
Source2: README.SUSE
Source3: openslp.desktop
Source4: openslp-devel.desktop
Source5: openslp.logrotate
Source8: baselibs.conf
Source9: slpd.service
Source10: openslp.logrotate.systemd
Patch1: openslp.audit.diff
Patch2: extensions.diff
Patch3: openslp.truncate.diff
Patch4: openslp.netlink.diff
Patch5: openslp.initda.diff
Patch6: openslp.visibility.diff
Patch7: openslp.daemon.diff
Patch8: openslp.cloexec.diff
Patch9: openslp.hardmtu.diff
Patch10: openslp.tcplocal.diff
Patch11: openslp.localtime.diff
Patch12: openslp.sd_notify.diff
Patch13: openslp.predicatestorage.diff
Patch14: openslp.doubleequal.diff
Patch15: openslp.noconvenience.diff
Patch16: openslp.xrealloc.diff
Patch17: openslp.foldws.diff
Patch18: openslp.openssl-1.1.diff
Patch19: openslp.localaddr.diff
Patch20: openslp.tcpunicast.diff
Patch21: openslp-2.0.0-ifdef-slpv2.diff
Patch22: openslp.tcpknownda.diff
Patch23: openslp.nullattr.diff
BuildRequires: bison
BuildRequires: flex
BuildRequires: libtool
BuildRequires: openssl-devel
BuildRequires: pkgconfig
BuildRequires: pkgconfig(libsystemd)
BuildRequires: pkgconfig(systemd)
BuildRequires: pkgconfig(zlib)
%description
Service Location Protocol is an IETF standards track protocol that
provides a framework that allows networking applications to discover
the existence, location, and configuration of networked services in
networks.
OpenSLP is an open source implementation of the SLPv2 protocol as
defined by RFC 2608 and RFC 2614. This package includes the slptool
and runtime libraries.
%package server
Summary: The OpenSLP Implementation of the Service Location Protocol V2
Group: System/Daemons
Requires: openslp
Requires(pre): group(daemon)
Requires(pre): shadow
Recommends: logrotate
%{?systemd_requires}
%description server
Service Location Protocol is an IETF standards track protocol that
provides a framework that allows networking applications to discover
the existence, location, and configuration of networked services in
networks.
This package contains the SLP server. Every system, which provides any
services that should be used via an SLP client must run this server and
register the service.
%package -n %{libname}
Summary: An Implementation of the Service Location Protocol V2
Group: System/Libraries
%description -n %{libname}
Service Location Protocol is an IETF standards track protocol that
provides a framework that allows networking applications to discover
the existence, location, and configuration of networked services in
networks.
%package devel
Summary: Header files for OpenSLP
Group: Development/Libraries/C and C++
Requires: %{libname} = %{version}
Requires: openssl-devel
%description devel
Service Location Protocol is an IETF standards track protocol that
provides a framework that allows networking applications to discover
the existence, location, and configuration of networked services in
networks.
This package contains header and library files to compile applications
with SLP support. It also contains developer documentation to develop
such applications.
%prep
%setup -q
%patch1
%patch2
%patch3
%patch4
%patch5
%patch6
%patch7
%patch8
%patch9
%patch10
%patch11
%patch12
%patch13
%patch14
%patch15
%patch16
%patch17
%patch18 -p2
%patch19
%patch20
%patch21 -p1
%patch22
%patch23
%build
autoreconf -fiv
%configure \
--disable-static \
--with-pic \
--enable-slpv1 \
--enable-async-api \
--enable-slpv2-security
make %{?_smp_mflags}
%install
mkdir -p %{buildroot}%{_sysconfdir}/slp.reg.d
mkdir -p %{buildroot}%{_sysconfdir}/slp.reg.d/slpd
cp etc/slp.conf %{buildroot}%{_sysconfdir}
cp etc/slp.reg %{buildroot}%{_sysconfdir}
cp etc/slp.spi %{buildroot}%{_sysconfdir}
mkdir -p %{buildroot}/%{_libdir}
./libtool --mode=install install libslp/libslp.la %{buildroot}/%{_libdir}
rm %{buildroot}%{_libdir}/libslp.la
mkdir -p %{buildroot}%{_sbindir}
./libtool --mode=install install slpd/slpd %{buildroot}%{_sbindir}
mkdir -p %{buildroot}%{_bindir}
./libtool --mode=install install slptool/slptool %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_includedir}
cp libslp/slp.h %{buildroot}%{_includedir}
mkdir -p %{buildroot}%{_defaultdocdir}/%{name}
find . -name CVS -o -name .cvsignore -o -name .xvpics | xargs rm -rf
cp -a AUTHORS README FAQ doc/doc/rfc doc/doc/html %{SOURCE2} \
%{buildroot}%{_defaultdocdir}/%{name}
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcslpd
cat > %{buildroot}%{_sbindir}/rcopenslp <<'EOF'
#!/bin/sh
exec %{_sbindir}/rcslpd "$@"
EOF
chmod 755 %{buildroot}%{_sbindir}/rcopenslp
%if 0%{?suse_version} > 1500
mkdir -p %{buildroot}%{_distconfdir}/logrotate.d
install -D -m 0644 %{SOURCE10} %{buildroot}%{_distconfdir}/logrotate.d/openslp-server
%else
install -D -m 0644 %{SOURCE10} %{buildroot}%{_sysconfdir}/logrotate.d/openslp-server
%endif
# install susehelp file
mkdir -p %{buildroot}%{_datadir}/susehelp/meta/Administration/
install -m 0644 %{SOURCE3} \
%{buildroot}%{_datadir}/susehelp/meta/Administration/
mkdir -p %{buildroot}%{_datadir}/susehelp/meta/Development/Libraries/
install -m 0644 %{SOURCE4} \
%{buildroot}%{_datadir}/susehelp/meta/Development/Libraries/
install -D -m 644 %{SOURCE9} %{buildroot}%{_unitdir}/slpd.service
#XXX test suite requires root
#check
#make check
%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%pre server
getent passwd openslp >/dev/null || useradd -r -g daemon -d %{_localstatedir}/lib/empty -s /sbin/nologin -c "openslp daemon" openslp
%service_add_pre slpd.service
%if 0%{?suse_version} > 1500
# Prepare for migration to /usr/etc; save any old .rpmsave
for i in logrotate.d/openslp-server ; do
test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i}.rpmsave.old ||:
done
%endif
%if 0%{?suse_version} > 1500
%posttrans server
# Migration to /usr/etc, restore just created .rpmsave
for i in logrotate.d/openslp-server ; do
test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i} ||:
done
%endif
%post server
%service_add_post slpd.service
%postun server
%service_del_postun slpd.service
%preun server
%service_del_preun slpd.service
%files -n %{libname}
%{_libdir}/libslp.so.*
%files
%license COPYING
%dir %{_defaultdocdir}/%{name}
%dir %{_defaultdocdir}/%{name}/html
%doc %{_defaultdocdir}/%{name}/AUTHORS
%doc %{_defaultdocdir}/%{name}/README
%doc %{_defaultdocdir}/%{name}/README.SUSE
%{_bindir}/slptool
%config(noreplace) %{_sysconfdir}/slp.conf
%config(noreplace) %{_sysconfdir}/slp.spi
%files server
%dir %{_datadir}/susehelp
%dir %{_datadir}/susehelp/meta
%dir %{_datadir}/susehelp/meta/Administration
%doc %{_defaultdocdir}/%{name}/FAQ
%doc %{_defaultdocdir}/%{name}/html/IntroductionToSLP
%doc %{_defaultdocdir}/%{name}/html/UsersGuide
%doc %{_defaultdocdir}/%{name}/html/faq.html
%doc %{_defaultdocdir}/%{name}/rfc
%doc %{_datadir}/susehelp/meta/Administration/openslp.desktop
%dir %{_sysconfdir}/slp.reg.d/
%dir %{_sysconfdir}/slp.reg.d/slpd
%{_sbindir}/rcopenslp
%{_sbindir}/rcslpd
%{_sbindir}/slpd
%config(noreplace) %{_sysconfdir}/slp.reg
%if 0%{?suse_version} > 1500
%{_distconfdir}/logrotate.d/openslp-server
%else
%config(noreplace) %{_sysconfdir}/logrotate.d/openslp-server
%endif
%{_unitdir}/slpd.service
%files devel
%dir %{_datadir}/susehelp
%dir %{_datadir}/susehelp/meta
%dir %{_datadir}/susehelp/meta/Development
%dir %{_datadir}/susehelp/meta/Development/Libraries
%doc %{_defaultdocdir}/%{name}/html/ProgrammersGuide
%doc %{_datadir}/susehelp/meta/Development/Libraries/openslp-devel.desktop
%{_includedir}/slp.h
%{_libdir}/libslp.so
%changelog

94
openslp.tcpknownda.diff Normal file
View File

@ -0,0 +1,94 @@
--- slpd/slpd_knownda.c.orig 2018-12-06 14:03:06.033908426 +0000
+++ slpd/slpd_knownda.c 2018-12-06 14:12:30.448421700 +0000
@@ -261,7 +261,7 @@ void SLPDKnownDARegisterAll(SLPMessage *
/*----------------------------------------------*/
/* Establish a new connection with the known DA */
/*----------------------------------------------*/
- sock = SLPDOutgoingConnect(0, &(daadvert->peer));
+ sock = SLPDOutgoingConnect(1, &(daadvert->peer));
if (sock)
while (1)
{
@@ -294,7 +294,8 @@ void SLPDKnownDARegisterAll(SLPMessage *
/* link newly constructed buffer to socket resendlist, and send */
/*--------------------------------------------------------------*/
SLPListLinkTail(&(sock->sendlist), (SLPListItem *) sendbuf);
- SLPDOutgoingDatagramWrite(sock, sendbuf);
+ if (sock->state == STREAM_CONNECT_IDLE)
+ sock->state = STREAM_WRITE_FIRST;
}
}
}
@@ -433,7 +434,7 @@ void SLPDKnownDADeregisterAll(SLPMessage
return;
/* Establish a new connection with the known DA */
- sock = SLPDOutgoingConnect(0, &(daadvert->peer));
+ sock = SLPDOutgoingConnect(1, &(daadvert->peer));
if (sock)
while (1)
{
@@ -459,7 +460,8 @@ void SLPDKnownDADeregisterAll(SLPMessage
/* link newly constructed buffer to socket resendlist, and send */
/*--------------------------------------------------------------*/
SLPListLinkTail(&(sock->sendlist), (SLPListItem *) sendbuf);
- SLPDOutgoingDatagramWrite(sock, sendbuf);
+ if (sock->state == STREAM_CONNECT_IDLE)
+ sock->state = STREAM_WRITE_FIRST;
}
}
}
@@ -502,14 +504,15 @@ int SLPDKnownDAFromDHCP()
Get an outgoing socket to the DA and set it up to make
the service:directoryagent request
--------------------------------------------------------*/
- sock = SLPDOutgoingConnect(0, &daaddr);
+ sock = SLPDOutgoingConnect(1, &daaddr);
if (sock)
{
buf = 0;
if (MakeActiveDiscoveryRqst(0, &buf) == 0)
{
SLPListLinkTail(&(sock->sendlist), (SLPListItem *) buf);
- SLPDOutgoingDatagramWrite(sock, buf);
+ if (sock->state == STREAM_CONNECT_IDLE)
+ sock->state = STREAM_WRITE_FIRST;
}
}
}
@@ -601,14 +604,15 @@ int SLPKnownDAFromProperties()
/* Get an outgoing socket to the DA and set it up to make */
/* the service:directoryagent request */
/*--------------------------------------------------------*/
- sock = SLPDOutgoingConnect(0, &daaddr);
+ sock = SLPDOutgoingConnect(1, &daaddr);
if (sock)
{
buf = 0;
if (MakeActiveDiscoveryRqst(0, &buf) == 0)
{
SLPListLinkTail(&(sock->sendlist), (SLPListItem *) buf);
- SLPDOutgoingDatagramWrite(sock, buf);
+ if (sock->state == STREAM_CONNECT_IDLE)
+ sock->state = STREAM_WRITE_FIRST;
}
}
}
@@ -1470,14 +1474,15 @@ void SLPDKnownDAEcho(SLPMessage * msg, S
/*------------------------------------------*/
/* Load the socket with the message to send */
/*------------------------------------------*/
- sock = SLPDOutgoingConnect(0, &(entry->msg->peer));
+ sock = SLPDOutgoingConnect(1, &(entry->msg->peer));
if (sock)
{
dup = SLPBufferDup(buf);
if (dup)
{
SLPListLinkTail(&(sock->sendlist), (SLPListItem *) dup);
- SLPDOutgoingDatagramWrite(sock, buf);
+ if (sock->state == STREAM_CONNECT_IDLE)
+ sock->state = STREAM_WRITE_FIRST;
}
else
sock->state = SOCKET_CLOSE;

106
openslp.tcplocal.diff Normal file
View File

@ -0,0 +1,106 @@
--- ./libslp/libslp_findattrs.c.orig 2014-02-20 10:41:46.070828839 +0000
+++ ./libslp/libslp_findattrs.c 2014-02-20 10:42:44.604828735 +0000
@@ -220,7 +220,7 @@ static SLPError ProcessAttrRqst(SLPHandl
curpos - buf, ProcessAttrRplyCallback, handle, isV1);
break;
}
- if (SLPNetIsIPV4())
+ if (SLPNetIsIPV4() && handle->params.findattrs.scopelistlen && memchr(handle->params.findattrs.scopelist, ',', handle->params.findattrs.scopelistlen))
{
if (KnownDASpanningListFromCache(handle,
(int)handle->params.findattrs.scopelistlen,
--- ./libslp/libslp_findsrvs.c.orig 2014-02-20 10:41:51.558828829 +0000
+++ ./libslp/libslp_findsrvs.c 2014-02-20 10:43:06.068828697 +0000
@@ -352,7 +352,7 @@ static SLPError ProcessSrvRqst(SLPHandle
curpos - buf, ProcessSrvRplyCallback, handle, false);
break;
}
- if (SLPNetIsIPV4())
+ if (SLPNetIsIPV4() && handle->params.findsrvs.scopelistlen && memchr(handle->params.findsrvs.scopelist, ',', handle->params.findsrvs.scopelistlen))
{
if (KnownDASpanningListFromCache(handle,
(int)handle->params.findsrvs.scopelistlen,
--- ./libslp/libslp_findsrvtypes.c.orig 2014-02-20 10:41:55.765828821 +0000
+++ ./libslp/libslp_findsrvtypes.c 2014-02-20 10:44:10.708828583 +0000
@@ -238,11 +238,11 @@ static SLPError ProcessSrvTypeRqst(SLPHa
curpos - buf, ProcessSrvTypeRplyCallback, handle, false);
break;
}
- if (SLPNetIsIPV4())
+ if (SLPNetIsIPV4() && handle->params.findsrvtypes.scopelistlen && memchr(handle->params.findsrvtypes.scopelist, ',', handle->params.findsrvtypes.scopelistlen))
{
if (KnownDASpanningListFromCache(handle,
- (int)handle->params.findsrvs.scopelistlen,
- handle->params.findsrvs.scopelist,
+ (int)handle->params.findsrvtypes.scopelistlen,
+ handle->params.findsrvtypes.scopelist,
&destaddrs) > 0)
{
serr = NetworkMultiUcastRqstRply(destaddrs,
--- ./libslp/libslp_knownda.c.orig 2012-12-12 17:38:52.000000000 +0000
+++ ./libslp/libslp_knownda.c 2014-02-20 10:40:19.448828992 +0000
@@ -793,6 +793,8 @@ sockfd_t KnownDAConnect(SLPHandleInfo *
const char * scopelist, void * peeraddr)
{
sockfd_t sock = SLP_INVALID_SOCKET;
+ int maxwait = SLPPropertyAsInteger("net.slp.DADiscoveryMaximumWait");
+ struct timeval timeout;
size_t spistrlen = 0;
char * spistr = 0;
@@ -815,15 +817,11 @@ sockfd_t KnownDAConnect(SLPHandleInfo *
|| (addr->sa_family == AF_INET && SLPNetIsIPV4()))
{
SLPNetSetPort(peeraddr, (uint16_t)SLPPropertyAsInteger("net.slp.port"));
- sock = SLPNetworkCreateDatagram(addr->sa_family);
- /* Now test if the DA will actually respond */
+ timeout.tv_usec = (maxwait % 1000) * 1000;
+ timeout.tv_sec = maxwait / 1000;
+ sock = SLPNetworkConnectStream(addr, &timeout);
if (sock != SLP_INVALID_SOCKET)
- {
- if (KnownDADiscoveryRqstRply(sock, peeraddr, scopelistlen, scopelist, handle) > 0)
- break;
-
- closesocket(sock);
- }
+ break;
}
KnownDABadDA(peeraddr);
}
--- ./libslp/libslp_network.c.orig 2014-02-20 10:40:15.262828999 +0000
+++ ./libslp/libslp_network.c 2014-02-20 10:40:19.449828992 +0000
@@ -370,6 +370,8 @@ static int NetworkGetMcastAddrs(const ch
sockfd_t NetworkConnectToSlpd(void * peeraddr)
{
sockfd_t sock = SLP_INVALID_SOCKET;
+ int maxwait = SLPPropertyAsInteger("net.slp.DADiscoveryMaximumWait");
+ struct timeval timeout;
/*Note that these don't actually test the connection to slpd.
They don't have to, since all code that calls this function eventually
@@ -378,14 +380,22 @@ sockfd_t NetworkConnectToSlpd(void * pee
if (SLPNetIsIPV6())
if (!SLPNetSetAddr(peeraddr, AF_INET6, (uint16_t)SLPPropertyAsInteger("net.slp.port"),
&slp_in6addr_loopback))
- sock = SLPNetworkCreateDatagram(AF_INET6);
+ {
+ timeout.tv_sec = maxwait / 1000;
+ timeout.tv_usec = (maxwait % 1000) * 1000;
+ sock = SLPNetworkConnectStream(peeraddr, &timeout);
+ }
if (sock == SLP_INVALID_SOCKET && SLPNetIsIPV4())
{
int tempAddr = INADDR_LOOPBACK;
if (SLPNetSetAddr(peeraddr, AF_INET,
(uint16_t)SLPPropertyAsInteger("net.slp.port"), &tempAddr) == 0)
- sock = SLPNetworkCreateDatagram(AF_INET);
+ {
+ timeout.tv_sec = maxwait / 1000;
+ timeout.tv_usec = (maxwait % 1000) * 1000;
+ sock = SLPNetworkConnectStream(peeraddr, &timeout);
+ }
}
return sock;
}

17
openslp.tcpunicast.diff Normal file
View File

@ -0,0 +1,17 @@
--- libslp/libslp_network.c.orig 2018-03-01 16:08:38.813669170 +0000
+++ libslp/libslp_network.c 2018-03-05 15:59:56.140618236 +0000
@@ -1426,7 +1426,13 @@ SLPError NetworkUcastRqstRply(SLPHandleI
/*In reality, this function just sets things up for NetworkRqstRply to operate*/
if(handle->unicastsock == SLP_INVALID_SOCKET) /*The unicast code will certainly reuse this socket*/
- handle->unicastsock = SLPNetworkCreateDatagram(handle->ucaddr.ss_family);
+ {
+ struct timeval timeout;
+ int maxwait = SLPPropertyAsInteger("net.slp.unicastMaximumWait");
+ timeout.tv_sec = maxwait / 1000;
+ timeout.tv_usec = (maxwait % 1000) * 1000;
+ handle->unicastsock = SLPNetworkConnectStream(&handle->ucaddr, &timeout);
+ }
if (handle->unicastsock == SLP_INVALID_SOCKET)
return SLP_NETWORK_ERROR;

189
openslp.truncate.diff Normal file
View File

@ -0,0 +1,189 @@
--- ./slpd/slpd_incoming.c.orig 2014-02-14 14:41:40.468720908 +0000
+++ ./slpd/slpd_incoming.c 2014-02-14 14:49:02.307720126 +0000
@@ -75,6 +75,7 @@ static void IncomingDatagramRead(SLPList
socklen_t peeraddrlen = sizeof(struct sockaddr_storage);
char addr_str[INET6_ADDRSTRLEN];
sockfd_t sendsock = SLP_INVALID_SOCKET;
+ int truncate;
(void)socklist;
@@ -85,6 +86,10 @@ static void IncomingDatagramRead(SLPList
{
sock->recvbuf->end = sock->recvbuf->start + bytesread;
+ truncate = G_SlpdProperty.MTU;
+ if (G_SlpdProperty.oversizedUDP)
+ truncate = 0;
+
if (!sock->sendbuf)
/* Some of the error handling code expects a sendbuf to be available
* to be emptied, so make sure there is at least a minimal buffer
@@ -92,7 +97,7 @@ static void IncomingDatagramRead(SLPList
sock->sendbuf = SLPBufferAlloc(1);
switch (SLPDProcessMessage(&sock->peeraddr, &sock->localaddr,
- sock->recvbuf, &sock->sendbuf, 0))
+ sock->recvbuf, &sock->sendbuf, 0, truncate))
{
case SLP_ERROR_PARSE_ERROR:
case SLP_ERROR_VER_NOT_SUPPORTED:
@@ -281,7 +286,7 @@ static void IncomingStreamRead(SLPList *
*/
sock->sendbuf = SLPBufferAlloc(1);
switch (SLPDProcessMessage(&sock->peeraddr,
- &sock->localaddr, sock->recvbuf, &sock->sendbuf, 0))
+ &sock->localaddr, sock->recvbuf, &sock->sendbuf, 0, 0))
{
case SLP_ERROR_PARSE_ERROR:
case SLP_ERROR_VER_NOT_SUPPORTED:
--- ./slpd/slpd_outgoing.c.orig 2014-02-14 14:41:33.205720921 +0000
+++ ./slpd/slpd_outgoing.c 2014-02-14 14:49:31.691720074 +0000
@@ -77,7 +77,7 @@ void OutgoingDatagramRead(SLPList * sock
*/
sock->sendbuf = SLPBufferAlloc(1);
SLPDProcessMessage(&sock->peeraddr, &sock->localaddr,
- sock->recvbuf, &sock->sendbuf, &sock->sendlist);
+ sock->recvbuf, &sock->sendbuf, &sock->sendlist, 0);
/* Completely ignore the message */
@@ -267,7 +267,7 @@ void OutgoingStreamRead(SLPList * sockli
/* check to see if everything was read */
if (sock->recvbuf->curpos == sock->recvbuf->end)
switch (SLPDProcessMessage(&(sock->peeraddr), &(sock->localaddr),
- sock->recvbuf, &(sock->sendbuf), 0))
+ sock->recvbuf, &(sock->sendbuf), 0, 0))
{
case SLP_ERROR_DA_BUSY_NOW:
sock->state = STREAM_WRITE_WAIT;
--- ./slpd/slpd_process.c.orig 2014-02-14 14:31:18.532722009 +0000
+++ ./slpd/slpd_process.c 2014-02-14 14:39:14.059721168 +0000
@@ -400,7 +400,7 @@ static int ProcessDASrvRqst(SLPMessage *
* @internal
*/
static int ProcessSrvRqst(SLPMessage * message, SLPBuffer * sendbuf,
- int errorcode)
+ int errorcode, int truncate)
{
int i;
SLPUrlEntry * urlentry;
@@ -408,11 +408,6 @@ static int ProcessSrvRqst(SLPMessage * m
size_t size = 0;
SLPBuffer result = *sendbuf;
-#ifdef ENABLE_SLPv2_SECURITY
- SLPAuthBlock * authblock = 0;
- int j;
-#endif
-
/* If errorcode is set, we can not be sure that message is good
Go directly to send response code
*/
@@ -514,32 +509,26 @@ RESPOND:
{
for (i = 0; i < db->urlcount; i++)
{
+ /* check size limitation */
+ if (truncate && size > truncate)
+ break;
+
/* urlentry is the url from the db result */
urlentry = db->urlarray[i];
- 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
- && message->body.srvrqst.spistrlen)
+#ifdef ENABLE_SLPv1
+ if (urlentry->opaque == 0)
{
- for (j = 0; j < urlentry->authcount; j++)
- {
- if (SLPCompareString(urlentry->autharray[j].spistrlen,
- urlentry->autharray[j].spistr,
- message->body.srvrqst.spistrlen,
- message->body.srvrqst.spistr) == 0)
- {
- authblock = &(urlentry->autharray[j]);
- size += authblock->length;
- break;
- }
- }
+ size += urlentry->urllen + 6; /* 1 byte for reserved */
+ /* 2 bytes for lifetime */
+ /* 2 bytes for urllen */
+ /* 1 byte for authcount */
}
+ else
#endif
+ {
+ size += urlentry->opaquelen;
+ }
}
}
@@ -590,6 +579,10 @@ RESPOND:
PutUINT16(&result->curpos, db->urlcount);
for (i = 0; i < db->urlcount; i++)
{
+ /* check size limitation */
+ if (truncate && result->curpos - result->start > truncate)
+ break;
+
/* urlentry is the url from the db result */
urlentry = db->urlarray[i];
@@ -1337,7 +1330,7 @@ static int ProcessSAAdvert(SLPMessage *
*/
int SLPDProcessMessage(struct sockaddr_storage * peerinfo,
struct sockaddr_storage * localaddr, SLPBuffer recvbuf,
- SLPBuffer * sendbuf, SLPList * psendlist)
+ SLPBuffer * sendbuf, SLPList * psendlist, int truncate)
{
SLPHeader header;
SLPMessage * message = 0;
@@ -1398,7 +1391,7 @@ int SLPDProcessMessage(struct sockaddr_s
switch (message->header.functionid)
{
case SLP_FUNCT_SRVRQST:
- errorcode = ProcessSrvRqst(message, sendbuf, errorcode);
+ errorcode = ProcessSrvRqst(message, sendbuf, errorcode, truncate);
break;
case SLP_FUNCT_SRVREG:
--- ./slpd/slpd_process.h.orig 2014-02-14 14:39:26.340721146 +0000
+++ ./slpd/slpd_process.h 2014-02-14 14:39:38.538721124 +0000
@@ -55,7 +55,7 @@
int CheckAndResizeBuffer(SLPBuffer * sendbuf, SLPBuffer tmp, size_t grow_size);
int SLPDProcessMessage(struct sockaddr_storage * peerinfo,
struct sockaddr_storage * localaddr, SLPBuffer recvbuf,
- SLPBuffer * sendbuf, SLPList * psendlist);
+ SLPBuffer * sendbuf, SLPList * psendlist, int truncate);
#if defined(ENABLE_SLPv1)
int SLPDv1ProcessMessage(struct sockaddr_storage * peeraddr,
--- ./slpd/slpd_property.c.orig 2014-02-14 14:39:50.229721103 +0000
+++ ./slpd/slpd_property.c 2014-02-14 14:40:54.266720990 +0000
@@ -142,6 +142,7 @@ void SLPDPropertyReinit(void)
G_SlpdProperty.securityEnabled = SLPPropertyAsBoolean("net.slp.securityEnabled");
G_SlpdProperty.checkSourceAddr = SLPPropertyAsBoolean("net.slp.checkSourceAddr");
G_SlpdProperty.DAHeartBeat = SLPPropertyAsInteger("net.slp.DAHeartBeat");
+ G_SlpdProperty.oversizedUDP = SLPPropertyAsBoolean("net.slp.oversizedUDP");
if (G_SlpdProperty.staleDACheckPeriod > 0)
{
/* Adjust the heartbeat interval if we need to send it faster for
--- ./slpd/slpd_property.h.orig 2014-02-14 14:39:55.205721095 +0000
+++ ./slpd/slpd_property.h 2014-02-14 14:41:11.378720960 +0000
@@ -116,6 +116,7 @@ typedef struct _SLPDProperty
int appendLog;
int MTU;
int useDHCP;
+ int oversizedUDP;
} SLPDProperty;
extern SLPDProperty G_SlpdProperty;

37
openslp.visibility.diff Normal file
View File

@ -0,0 +1,37 @@
--- ./libslp/Makefile.am.orig 2014-02-17 18:11:45.472239824 +0000
+++ ./libslp/Makefile.am 2014-02-17 18:12:27.793239750 +0000
@@ -57,5 +57,5 @@ noinst_HEADERS = \
libslp_la_LIBADD = ../common/libcommonlibslp.la
-libslp_la_LDFLAGS = -version-info 1:0:0
+libslp_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libslp.map -version-info 1:0:0
--- ./libslp/libslp.map.orig 2014-02-17 18:13:11.931239671 +0000
+++ ./libslp/libslp.map 2014-02-17 18:11:45.472239824 +0000
@@ -0,0 +1,25 @@
+{
+global:
+ SLPAssociateIFList;
+ SLPAssociateIP;
+ SLPClose;
+ SLPDelAttrs;
+ SLPDereg;
+ SLPEscape;
+ SLPFindAttrs;
+ SLPFindScopes;
+ SLPFindSrvTypes;
+ SLPFindSrvs;
+ SLPFree;
+ SLPGetMDNSName;
+ SLPGetPeer;
+ SLPGetProperty;
+ SLPGetRefreshInterval;
+ SLPOpen;
+ SLPParseAttrs;
+ SLPParseSrvURL;
+ SLPReg;
+ SLPSetProperty;
+ SLPUnescape;
+local: *;
+};

11
openslp.xrealloc.diff Normal file
View File

@ -0,0 +1,11 @@
--- ./common/slp_xmalloc.c.orig 2016-09-13 11:46:35.749065088 +0000
+++ ./common/slp_xmalloc.c 2016-09-13 11:48:03.785749186 +0000
@@ -203,6 +203,8 @@ void * _xrealloc(const char * file, int
if (x->size != size)
{
newptr = _xmalloc(file, line, size);
+ if (!newptr)
+ return 0;
memcpy(newptr, ptr, x->size);
_xfree(file, line, x);
}

23
slpd.service Normal file
View File

@ -0,0 +1,23 @@
[Unit]
Description=OpenSLP daemon for the Service Location Protocol
After=network.target nss-lookup.target
[Service]
# added automatically, for details please see
# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort
ProtectSystem=full
ProtectHome=true
PrivateDevices=true
ProtectHostname=true
ProtectClock=true
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectKernelLogs=true
ProtectControlGroups=true
RestrictRealtime=true
# end of automatic additions
Type=notify
ExecStart=/usr/sbin/slpd -d
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target