miniupnpc: disable call to MiniSSDPd when -m option is used

fixes #269
This commit is contained in:
Thomas Bernard 2018-02-22 15:58:25 +01:00
parent 90b8f3711c
commit ce2673118d
3 changed files with 28 additions and 20 deletions

View File

@ -1,6 +1,9 @@
$Id: Changelog.txt,v 1.229 2017/12/12 11:26:25 nanard Exp $ $Id: Changelog.txt,v 1.229 2017/12/12 11:26:25 nanard Exp $
miniUPnP client Changelog. miniUPnP client Changelog.
2018/02/22:
Disable usage of MiniSSDPd when using -m option
2017/12/11: 2017/12/11:
Fix buffer over run in minixml.c Fix buffer over run in minixml.c
Fix uninitialized variable access in upnpreplyparse.c Fix uninitialized variable access in upnpreplyparse.c

View File

@ -299,30 +299,32 @@ upnpDiscoverDevices(const char * const deviceTypes[],
/* first try to get infos from minissdpd ! */ /* first try to get infos from minissdpd ! */
if(!minissdpdsock) if(!minissdpdsock)
minissdpdsock = "/var/run/minissdpd.sock"; minissdpdsock = "/var/run/minissdpd.sock";
for(deviceIndex = 0; deviceTypes[deviceIndex]; deviceIndex++) { if(minissdpdsock[0] != '\0') {
struct UPNPDev * minissdpd_devlist; for(deviceIndex = 0; deviceTypes[deviceIndex]; deviceIndex++) {
int only_rootdevice = 1; struct UPNPDev * minissdpd_devlist;
minissdpd_devlist = getDevicesFromMiniSSDPD(deviceTypes[deviceIndex], int only_rootdevice = 1;
minissdpdsock, 0); minissdpd_devlist = getDevicesFromMiniSSDPD(deviceTypes[deviceIndex],
if(minissdpd_devlist) { minissdpdsock, 0);
#ifdef DEBUG if(minissdpd_devlist) {
printf("returned by MiniSSDPD: %s\t%s\n",
minissdpd_devlist->st, minissdpd_devlist->descURL);
#endif /* DEBUG */
if(!strstr(minissdpd_devlist->st, "rootdevice"))
only_rootdevice = 0;
for(tmp = minissdpd_devlist; tmp->pNext != NULL; tmp = tmp->pNext) {
#ifdef DEBUG #ifdef DEBUG
printf("returned by MiniSSDPD: %s\t%s\n", printf("returned by MiniSSDPD: %s\t%s\n",
tmp->pNext->st, tmp->pNext->descURL); minissdpd_devlist->st, minissdpd_devlist->descURL);
#endif /* DEBUG */ #endif /* DEBUG */
if(!strstr(tmp->st, "rootdevice")) if(!strstr(minissdpd_devlist->st, "rootdevice"))
only_rootdevice = 0; only_rootdevice = 0;
for(tmp = minissdpd_devlist; tmp->pNext != NULL; tmp = tmp->pNext) {
#ifdef DEBUG
printf("returned by MiniSSDPD: %s\t%s\n",
tmp->pNext->st, tmp->pNext->descURL);
#endif /* DEBUG */
if(!strstr(tmp->st, "rootdevice"))
only_rootdevice = 0;
}
tmp->pNext = devlist;
devlist = minissdpd_devlist;
if(!searchalltypes && !only_rootdevice)
break;
} }
tmp->pNext = devlist;
devlist = minissdpd_devlist;
if(!searchalltypes && !only_rootdevice)
break;
} }
} }
for(tmp = devlist; tmp != NULL; tmp = tmp->pNext) { for(tmp = devlist; tmp != NULL; tmp = tmp->pNext) {

View File

@ -1,7 +1,7 @@
/* $Id: upnpc.c,v 1.117 2017/05/26 15:26:55 nanard Exp $ */ /* $Id: upnpc.c,v 1.117 2017/05/26 15:26:55 nanard Exp $ */
/* Project : miniupnp /* Project : miniupnp
* Author : Thomas Bernard * Author : Thomas Bernard
* Copyright (c) 2005-2017 Thomas Bernard * Copyright (c) 2005-2018 Thomas Bernard
* This software is subject to the conditions detailed in the * This software is subject to the conditions detailed in the
* LICENCE file provided in this distribution. */ * LICENCE file provided in this distribution. */
@ -594,7 +594,10 @@ int main(int argc, char ** argv)
if(argv[i][1] == 'u') if(argv[i][1] == 'u')
rootdescurl = argv[++i]; rootdescurl = argv[++i];
else if(argv[i][1] == 'm') else if(argv[i][1] == 'm')
{
multicastif = argv[++i]; multicastif = argv[++i];
minissdpdpath = ""; /* Disable usage of minissdpd */
}
else if(argv[i][1] == 'z') else if(argv[i][1] == 'z')
{ {
char junk; char junk;