Hello community,
here is the log from the commit of package miniupnpc for openSUSE:Factory checked in at 2017-06-02 10:29:54
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/miniupnpc (Old)
and /work/SRC/openSUSE:Factory/.miniupnpc.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "miniupnpc"
Fri Jun 2 10:29:54 2017 rev:14 rq:497808 version:2.0.20170509
Changes:
--------
--- /work/SRC/openSUSE:Factory/miniupnpc/miniupnpc.changes 2016-05-02 10:43:04.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.miniupnpc.new/miniupnpc.changes 2017-06-02 10:29:55.292821013 +0200
@@ -1,0 +2,7 @@
+Tue May 23 14:18:10 UTC 2017 - joop.boonen@opensuse.org
+
+- Build 2.0.20170509
+ * Fix CVE-2017-8798 Thanks to tin/Team OSTStrom
+ * bnc#1038601 fixes VUL-0: CVE-2017-8798: miniupnp: integer signedness error
+
+-------------------------------------------------------------------
Old:
----
miniupnpc-2.0.tar.gz
New:
----
miniupnpc-2.0.20170509.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ miniupnpc.spec ++++++
--- /var/tmp/diff_new_pack.mqJOA4/_old 2017-06-02 10:29:55.824745853 +0200
+++ /var/tmp/diff_new_pack.mqJOA4/_new 2017-06-02 10:29:55.824745853 +0200
@@ -1,7 +1,7 @@
#
# spec file for package miniupnpc
#
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
%define soname 16
Name: miniupnpc
-Version: 2.0
+Version: 2.0.20170509
Release: 0
Summary: Universal Plug'n'Play (UPnP) Client
License: BSD-3-Clause
++++++ miniupnpc-2.0.tar.gz -> miniupnpc-2.0.20170509.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-2.0/CMakeLists.txt new/miniupnpc-2.0.20170509/CMakeLists.txt
--- old/miniupnpc-2.0/CMakeLists.txt 2016-04-19 23:04:55.000000000 +0200
+++ new/miniupnpc-2.0.20170509/CMakeLists.txt 2016-12-16 10:04:32.000000000 +0100
@@ -30,7 +30,11 @@
if (NOT WIN32)
add_definitions (-DMINIUPNPC_SET_SOCKET_TIMEOUT)
- add_definitions (-D_BSD_SOURCE -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200112L)
+ add_definitions (-D_BSD_SOURCE -D_DEFAULT_SOURCE)
+ if (NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+ # add_definitions (-D_POSIX_C_SOURCE=200112L)
+ add_definitions (-D_XOPEN_SOURCE=600)
+ endif (NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
else (NOT WIN32)
add_definitions (-D_WIN32_WINNT=0x0501) # XP or higher for getnameinfo and friends
endif (NOT WIN32)
@@ -62,8 +66,8 @@
endif (NOT CONFIGURED)
endif ()
-configure_file (${CMAKE_SOURCE_DIR}/miniupnpcstrings.h.cmake ${CMAKE_BINARY_DIR}/miniupnpcstrings.h)
-include_directories (${CMAKE_BINARY_DIR})
+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/miniupnpcstrings.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/miniupnpcstrings.h)
+include_directories (${CMAKE_CURRENT_BINARY_DIR})
set (MINIUPNPC_SOURCES
igd_desc_parse.c
@@ -72,7 +76,6 @@
minisoap.c
minissdpc.c
miniwget.c
- upnpc.c
upnpcommands.c
upnpdev.c
upnpreplyparse.c
@@ -108,21 +111,25 @@
endif (NOT UPNPC_BUILD_STATIC AND NOT UPNPC_BUILD_SHARED)
if (UPNPC_BUILD_STATIC)
- add_library (upnpc-static STATIC ${MINIUPNPC_SOURCES})
- set_target_properties (upnpc-static PROPERTIES OUTPUT_NAME "miniupnpc")
- target_link_libraries (upnpc-static ${LDLIBS})
- set (UPNPC_INSTALL_TARGETS ${UPNPC_INSTALL_TARGETS} upnpc-static)
- set (UPNPC_LIBRARY_TARGET upnpc-static)
+ add_library (libminiupnpc-static STATIC ${MINIUPNPC_SOURCES})
+ set_target_properties (libminiupnpc-static PROPERTIES OUTPUT_NAME "miniupnpc")
+ target_link_libraries (libminiupnpc-static ${LDLIBS})
+ set (UPNPC_INSTALL_TARGETS ${UPNPC_INSTALL_TARGETS} libminiupnpc-static)
+ set (UPNPC_LIBRARY_TARGET libminiupnpc-static)
+ add_executable (upnpc-static upnpc.c)
+ target_link_libraries (upnpc-static LINK_PRIVATE libminiupnpc-static)
endif (UPNPC_BUILD_STATIC)
if (UPNPC_BUILD_SHARED)
- add_library (upnpc-shared SHARED ${MINIUPNPC_SOURCES})
- set_target_properties (upnpc-shared PROPERTIES OUTPUT_NAME "miniupnpc")
- set_target_properties (upnpc-shared PROPERTIES VERSION ${MINIUPNPC_VERSION})
- set_target_properties (upnpc-shared PROPERTIES SOVERSION ${MINIUPNPC_API_VERSION})
- target_link_libraries (upnpc-shared ${LDLIBS})
- set (UPNPC_INSTALL_TARGETS ${UPNPC_INSTALL_TARGETS} upnpc-shared)
- set (UPNPC_LIBRARY_TARGET upnpc-shared)
+ add_library (libminiupnpc-shared SHARED ${MINIUPNPC_SOURCES})
+ set_target_properties (libminiupnpc-shared PROPERTIES OUTPUT_NAME "miniupnpc")
+ set_target_properties (libminiupnpc-shared PROPERTIES VERSION ${MINIUPNPC_VERSION})
+ set_target_properties (libminiupnpc-shared PROPERTIES SOVERSION ${MINIUPNPC_API_VERSION})
+ target_link_libraries (libminiupnpc-shared ${LDLIBS})
+ set (UPNPC_INSTALL_TARGETS ${UPNPC_INSTALL_TARGETS} libminiupnpc-shared)
+ set (UPNPC_LIBRARY_TARGET libminiupnpc-shared)
+ add_executable (upnpc-shared upnpc.c)
+ target_link_libraries (upnpc-shared LINK_PRIVATE libminiupnpc-shared)
endif (UPNPC_BUILD_SHARED)
if (UPNPC_BUILD_TESTS)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-2.0/Changelog.txt new/miniupnpc-2.0.20170509/Changelog.txt
--- old/miniupnpc-2.0/Changelog.txt 2016-04-19 23:06:20.000000000 +0200
+++ new/miniupnpc-2.0.20170509/Changelog.txt 2017-05-09 12:06:52.000000000 +0200
@@ -1,6 +1,16 @@
-$Id: Changelog.txt,v 1.223 2016/04/19 21:06:20 nanard Exp $
+$Id: Changelog.txt,v 1.227 2017/05/09 10:04:56 nanard Exp $
miniUPnP client Changelog.
+2017/05/05:
+ Fix CVE-2017-8798 Thanks to tin/Team OSTStrom
+
+2016/11/11:
+ check strlen before memcmp in XML parsing portlistingparse.c
+ fix build under SOLARIS and CYGWIN
+
+2016/10/11:
+ Add python 3 compatibility to IGD test
+
VERSION 2.0 : released 2016/04/19
2016/01/24:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-2.0/LICENSE new/miniupnpc-2.0.20170509/LICENSE
--- old/miniupnpc-2.0/LICENSE 2015-01-20 14:42:39.000000000 +0100
+++ new/miniupnpc-2.0.20170509/LICENSE 2016-12-16 10:04:32.000000000 +0100
@@ -1,5 +1,5 @@
MiniUPnPc
-Copyright (c) 2005-2015, Thomas BERNARD
+Copyright (c) 2005-2016, Thomas BERNARD
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-2.0/Makefile new/miniupnpc-2.0.20170509/Makefile
--- old/miniupnpc-2.0/Makefile 2016-02-09 10:38:56.000000000 +0100
+++ new/miniupnpc-2.0.20170509/Makefile 2017-04-21 13:24:22.000000000 +0200
@@ -1,9 +1,9 @@
-# $Id: Makefile,v 1.133 2016/01/24 17:24:35 nanard Exp $
+# $Id: Makefile,v 1.136 2017/04/21 09:44:20 nanard Exp $
# MiniUPnP Project
# http://miniupnp.free.fr/
# http://miniupnp.tuxfamily.org/
# https://github.com/miniupnp/miniupnp
-# (c) 2005-2015 Thomas Bernard
+# (c) 2005-2017 Thomas Bernard
# to install use :
# $ make DESTDIR=/tmp/dummylocation install
# or
@@ -38,6 +38,9 @@
CFLAGS += -DMINIUPNPC_GET_SRC_ADDR
CFLAGS += -D_BSD_SOURCE
CFLAGS += -D_DEFAULT_SOURCE
+ifeq ($(OS), NetBSD)
+CFLAGS += -D_NETBSD_SOURCE
+endif
ifneq ($(OS), FreeBSD)
ifneq ($(OS), Darwin)
#CFLAGS += -D_POSIX_C_SOURCE=200112L
@@ -45,7 +48,7 @@
endif
endif
#CFLAGS += -ansi
-# -DNO_GETADDRINFO
+#CFLAGS += -DNO_GETADDRINFO
INSTALL = install
SH = /bin/sh
JAVA = java
@@ -62,7 +65,9 @@
JNAERATORBASEURL = https://repo1.maven.org/maven2/com/nativelibs4java/jnaerator/0.12
ifeq (SunOS, $(OS))
- LDFLAGS=-lsocket -lnsl -lresolv
+ LDLIBS=-lsocket -lnsl -lresolv
+ CFLAGS += -D__EXTENSIONS__
+ CFLAGS += -std=c99
endif
# APIVERSION is used to build SONAME
@@ -82,7 +87,9 @@
connecthostport.o portlistingparse.o receivedata.o upnpdev.o
ifneq ($(OS), AmigaOS)
+ifeq (,$(findstring CYGWIN,$(OS)))
CFLAGS := -fPIC $(CFLAGS)
+endif
LIBOBJS := $(LIBOBJS) minissdpc.o
endif
@@ -136,7 +143,11 @@
LIBDIR ?= lib
# install directories
-INSTALLPREFIX ?= $(PREFIX)/usr
+ifeq ($(strip $(PREFIX)),)
+INSTALLPREFIX ?= /usr
+else
+INSTALLPREFIX ?= $(PREFIX)
+endif
INSTALLDIRINC = $(INSTALLPREFIX)/include/miniupnpc
INSTALLDIRLIB = $(INSTALLPREFIX)/$(LIBDIR)
INSTALLDIRBIN = $(INSTALLPREFIX)/bin
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-2.0/connecthostport.c new/miniupnpc-2.0.20170509/connecthostport.c
--- old/miniupnpc-2.0/connecthostport.c 2015-10-26 18:05:52.000000000 +0100
+++ new/miniupnpc-2.0.20170509/connecthostport.c 2017-04-21 13:24:22.000000000 +0200
@@ -1,7 +1,7 @@
-/* $Id: connecthostport.c,v 1.15 2015/10/09 16:26:19 nanard Exp $ */
+/* $Id: connecthostport.c,v 1.17 2017/04/21 09:58:30 nanard Exp $ */
/* Project : miniupnp
* Author : Thomas Bernard
- * Copyright (c) 2010-2015 Thomas Bernard
+ * Copyright (c) 2010-2017 Thomas Bernard
* This software is subject to the conditions detailed in the
* LICENCE file provided in this distribution. */
@@ -36,15 +36,13 @@
/* defining MINIUPNPC_IGNORE_EINTR enable the ignore of interruptions
* during the connect() call */
#define MINIUPNPC_IGNORE_EINTR
-#ifndef USE_GETHOSTBYNAME
#include
#include
-#endif /* #ifndef USE_GETHOSTBYNAME */
#endif /* #else _WIN32 */
/* definition of PRINT_SOCKET_ERROR */
#ifdef _WIN32
-#define PRINT_SOCKET_ERROR(x) printf("Socket error: %s, %d\n", x, WSAGetLastError());
+#define PRINT_SOCKET_ERROR(x) fprintf(stderr, "Socket error: %s, %d\n", x, WSAGetLastError());
#else
#define PRINT_SOCKET_ERROR(x) perror(x)
#endif
@@ -100,13 +98,13 @@
timeout.tv_usec = 0;
if(setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(struct timeval)) < 0)
{
- PRINT_SOCKET_ERROR("setsockopt");
+ PRINT_SOCKET_ERROR("setsockopt SO_RCVTIMEO");
}
timeout.tv_sec = 3;
timeout.tv_usec = 0;
if(setsockopt(s, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(struct timeval)) < 0)
{
- PRINT_SOCKET_ERROR("setsockopt");
+ PRINT_SOCKET_ERROR("setsockopt SO_SNDTIMEO");
}
#endif /* #ifdef MINIUPNPC_SET_SOCKET_TIMEOUT */
dest.sin_family = AF_INET;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-2.0/minihttptestserver.c new/miniupnpc-2.0.20170509/minihttptestserver.c
--- old/miniupnpc-2.0/minihttptestserver.c 2015-11-18 09:25:37.000000000 +0100
+++ new/miniupnpc-2.0.20170509/minihttptestserver.c 2016-12-16 10:04:32.000000000 +0100
@@ -1,7 +1,7 @@
-/* $Id: minihttptestserver.c,v 1.19 2015/11/17 09:07:17 nanard Exp $ */
+/* $Id: minihttptestserver.c,v 1.20 2016/12/16 08:54:55 nanard Exp $ */
/* Project : miniUPnP
* Author : Thomas Bernard
- * Copyright (c) 2011-2015 Thomas Bernard
+ * Copyright (c) 2011-2016 Thomas Bernard
* This software is subject to the conditions detailed in the
* LICENCE file provided in this distribution.
* */
@@ -611,7 +611,7 @@
if(pid < 0) {
perror("wait");
} else {
- printf("child(%d) terminated with status %d\n", pid, status);
+ printf("child(%d) terminated with status %d\n", (int)pid, status);
}
--child_to_wait_for;
}
@@ -648,7 +648,7 @@
if(pid < 0) {
perror("wait");
} else {
- printf("child(%d) terminated with status %d\n", pid, status);
+ printf("child(%d) terminated with status %d\n", (int)pid, status);
}
--child_to_wait_for;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-2.0/minisoap.c new/miniupnpc-2.0.20170509/minisoap.c
--- old/miniupnpc-2.0/minisoap.c 2015-10-26 18:05:52.000000000 +0100
+++ new/miniupnpc-2.0.20170509/minisoap.c 2017-04-21 13:24:22.000000000 +0200
@@ -1,4 +1,4 @@
-/* $Id: minisoap.c,v 1.24 2015/10/26 17:05:07 nanard Exp $ */
+/* $Id: minisoap.c,v 1.25 2017/04/21 10:03:24 nanard Exp $ */
/* Project : miniupnp
* Author : Thomas Bernard
* Copyright (c) 2005-2015 Thomas Bernard
@@ -25,7 +25,7 @@
#include
#ifdef _WIN32
-#define PRINT_SOCKET_ERROR(x) printf("Socket error: %s, %d\n", x, WSAGetLastError());
+#define PRINT_SOCKET_ERROR(x) fprintf(stderr, "Socket error: %s, %d\n", x, WSAGetLastError());
#else
#define PRINT_SOCKET_ERROR(x) perror(x)
#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-2.0/minissdpc.c new/miniupnpc-2.0.20170509/minissdpc.c
--- old/miniupnpc-2.0/minissdpc.c 2016-01-19 11:26:58.000000000 +0100
+++ new/miniupnpc-2.0.20170509/minissdpc.c 2017-04-21 13:24:22.000000000 +0200
@@ -1,9 +1,9 @@
-/* $Id: minissdpc.c,v 1.31 2016/01/19 09:56:46 nanard Exp $ */
+/* $Id: minissdpc.c,v 1.34 2017/04/21 10:06:38 nanard Exp $ */
/* vim: tabstop=4 shiftwidth=4 noexpandtab
* Project : miniupnp
* Web : http://miniupnp.free.fr/
* Author : Thomas BERNARD
- * copyright (c) 2005-2015 Thomas Bernard
+ * copyright (c) 2005-2017 Thomas Bernard
* This software is subjet to the conditions detailed in the
* provided LICENCE file. */
/*#include */
@@ -11,6 +11,9 @@
#include
#include
#include
+#if defined (__NetBSD__)
+#include
+#endif
#if defined(_WIN32) || defined(__amigaos__) || defined(__amigaos4__)
#ifdef _WIN32
#include
@@ -59,7 +62,7 @@
#endif
#ifdef _WIN32
-#define PRINT_SOCKET_ERROR(x) printf("Socket error: %s, %d\n", x, WSAGetLastError());
+#define PRINT_SOCKET_ERROR(x) fprintf(stderr, "Socket error: %s, %d\n", x, WSAGetLastError());
#else
#define PRINT_SOCKET_ERROR(x) perror(x)
#endif
@@ -70,6 +73,9 @@
#if !defined(HAS_IP_MREQN) && !defined(_WIN32)
#include
+#if defined(__sun)
+#include
+#endif
#endif
#if defined(HAS_IP_MREQN) && defined(NEED_STRUCT_IP_MREQN)
@@ -166,7 +172,7 @@
{
int s;
struct sockaddr_un addr;
-#ifdef MINIUPNPC_SET_SOCKET_TIMEOUT
+#if defined(MINIUPNPC_SET_SOCKET_TIMEOUT) && !defined(__sun)
struct timeval timeout;
#endif /* #ifdef MINIUPNPC_SET_SOCKET_TIMEOUT */
@@ -177,23 +183,25 @@
perror("socket(unix)");
return MINISSDPC_SOCKET_ERROR;
}
-#ifdef MINIUPNPC_SET_SOCKET_TIMEOUT
+#if defined(MINIUPNPC_SET_SOCKET_TIMEOUT) && !defined(__sun)
/* setting a 3 seconds timeout */
+ /* not supported for AF_UNIX sockets under Solaris */
timeout.tv_sec = 3;
timeout.tv_usec = 0;
if(setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(struct timeval)) < 0)
{
- perror("setsockopt");
+ perror("setsockopt SO_RCVTIMEO unix");
}
timeout.tv_sec = 3;
timeout.tv_usec = 0;
if(setsockopt(s, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(struct timeval)) < 0)
{
- perror("setsockopt");
+ perror("setsockopt SO_SNDTIMEO unix");
}
#endif /* #ifdef MINIUPNPC_SET_SOCKET_TIMEOUT */
if(!socketpath)
socketpath = "/var/run/minissdpd.sock";
+ memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
strncpy(addr.sun_path, socketpath, sizeof(addr.sun_path));
/* TODO : check if we need to handle the EINTR */
@@ -495,6 +503,7 @@
unsigned long _ttl = (unsigned long)ttl;
#endif
int linklocal = 1;
+ int sentok;
if(error)
*error = MINISSDPC_UNKNOWN_ERROR;
@@ -605,14 +614,22 @@
return NULL;
}
+ if(ipv6) {
+ int mcastHops = ttl;
+ if(setsockopt(sudp, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &mcastHops, sizeof(mcastHops)) < 0)
+ {
+ PRINT_SOCKET_ERROR("setsockopt(IPV6_MULTICAST_HOPS,...)");
+ }
+ } else {
#ifdef _WIN32
- if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_TTL, (const char *)&_ttl, sizeof(_ttl)) < 0)
+ if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_TTL, (const char *)&_ttl, sizeof(_ttl)) < 0)
#else /* _WIN32 */
- if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl)) < 0)
+ if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl)) < 0)
#endif /* _WIN32 */
- {
- /* not a fatal error */
- PRINT_SOCKET_ERROR("setsockopt(IP_MULTICAST_TTL,...)");
+ {
+ /* not a fatal error */
+ PRINT_SOCKET_ERROR("setsockopt(IP_MULTICAST_TTL,...)");
+ }
}
if(multicastif)
@@ -625,7 +642,7 @@
unsigned int ifindex = if_nametoindex(multicastif); /* eth0, etc. */
if(setsockopt(sudp, IPPROTO_IPV6, IPV6_MULTICAST_IF, &ifindex, sizeof(ifindex)) < 0)
{
- PRINT_SOCKET_ERROR("setsockopt");
+ PRINT_SOCKET_ERROR("setsockopt IPV6_MULTICAST_IF");
}
#else
#ifdef DEBUG
@@ -640,7 +657,7 @@
((struct sockaddr_in *)&sockudp_r)->sin_addr.s_addr = mc_if.s_addr;
if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF, (const char *)&mc_if, sizeof(mc_if)) < 0)
{
- PRINT_SOCKET_ERROR("setsockopt");
+ PRINT_SOCKET_ERROR("setsockopt IP_MULTICAST_IF");
}
} else {
#ifdef HAS_IP_MREQN
@@ -650,7 +667,7 @@
reqn.imr_ifindex = if_nametoindex(multicastif);
if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF, (const char *)&reqn, sizeof(reqn)) < 0)
{
- PRINT_SOCKET_ERROR("setsockopt");
+ PRINT_SOCKET_ERROR("setsockopt IP_MULTICAST_IF");
}
#elif !defined(_WIN32)
struct ifreq ifr;
@@ -664,7 +681,7 @@
mc_if.s_addr = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr;
if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF, (const char *)&mc_if, sizeof(mc_if)) < 0)
{
- PRINT_SOCKET_ERROR("setsockopt");
+ PRINT_SOCKET_ERROR("setsockopt IP_MULTICAST_IF");
}
#else /* _WIN32 */
#ifdef DEBUG
@@ -697,6 +714,7 @@
}
/* receiving SSDP response packet */
for(deviceIndex = 0; deviceTypes[deviceIndex]; deviceIndex++) {
+ sentok = 0;
/* sending the SSDP M-SEARCH packet */
n = snprintf(bufr, sizeof(bufr),
MSearchMsgFmt,
@@ -740,7 +758,8 @@
if(error)
*error = MINISSDPC_SOCKET_ERROR;
PRINT_SOCKET_ERROR("sendto");
- break;
+ } else {
+ sentok = 1;
}
#else /* #ifdef NO_GETADDRINFO */
memset(&hints, 0, sizeof(hints));
@@ -772,19 +791,20 @@
#endif
PRINT_SOCKET_ERROR("sendto");
continue;
+ } else {
+ sentok = 1;
}
}
freeaddrinfo(servinfo);
- if(n < 0) {
+ if(!sentok) {
if(error)
*error = MINISSDPC_SOCKET_ERROR;
- break;
}
#endif /* #ifdef NO_GETADDRINFO */
/* Waiting for SSDP REPLY packet to M-SEARCH
* if searchalltypes is set, enter the loop only
* when the last deviceType is reached */
- if(!searchalltypes || !deviceTypes[deviceIndex + 1]) do {
+ if((sentok && !searchalltypes) || !deviceTypes[deviceIndex + 1]) do {
n = receivedata(sudp, bufr, sizeof(bufr), delay, &scope_id);
if (n < 0) {
/* error */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-2.0/miniupnpc.h new/miniupnpc-2.0.20170509/miniupnpc.h
--- old/miniupnpc-2.0/miniupnpc.h 2016-04-19 23:07:20.000000000 +0200
+++ new/miniupnpc-2.0.20170509/miniupnpc.h 2017-05-09 12:14:44.000000000 +0200
@@ -19,7 +19,7 @@
#define UPNPDISCOVER_MEMORY_ERROR (-102)
/* versions : */
-#define MINIUPNPC_VERSION "2.0"
+#define MINIUPNPC_VERSION "2.0.20170509"
#define MINIUPNPC_API_VERSION 16
/* Source port:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-2.0/miniupnpcmodule.c new/miniupnpc-2.0.20170509/miniupnpcmodule.c
--- old/miniupnpc-2.0/miniupnpcmodule.c 2015-10-26 18:05:52.000000000 +0100
+++ new/miniupnpc-2.0.20170509/miniupnpcmodule.c 2017-04-21 13:24:22.000000000 +0200
@@ -1,8 +1,8 @@
-/* $Id: miniupnpcmodule.c,v 1.29 2015/10/26 17:01:30 nanard Exp $*/
+/* $Id: miniupnpcmodule.c,v 1.30 2017/04/21 10:07:43 nanard Exp $*/
/* Project : miniupnp
* Author : Thomas BERNARD
* website : http://miniupnp.tuxfamily.org/
- * copyright (c) 2007-2014 Thomas Bernard
+ * copyright (c) 2007-2016 Thomas Bernard
* This software is subjet to the conditions detailed in the
* provided LICENCE file. */
#include
@@ -12,6 +12,10 @@
#include "upnpcommands.h"
#include "upnperrors.h"
+#ifdef _WIN32
+#include
+#endif
+
/* for compatibility with Python < 2.4 */
#ifndef Py_RETURN_NONE
#define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
@@ -669,6 +673,10 @@
PyObject* m;
#ifdef _WIN32
+ /* initialize Winsock. */
+ WSADATA wsaData;
+ int nResult = WSAStartup(MAKEWORD(2,2), &wsaData);
+
UPnPType.tp_new = PyType_GenericNew;
#endif
if (PyType_Ready(&UPnPType) < 0)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-2.0/miniwget.c new/miniupnpc-2.0.20170509/miniwget.c
--- old/miniupnpc-2.0/miniwget.c 2016-02-09 10:38:58.000000000 +0100
+++ new/miniupnpc-2.0.20170509/miniwget.c 2017-05-09 12:06:52.000000000 +0200
@@ -1,8 +1,8 @@
-/* $Id: miniwget.c,v 1.75 2016/01/24 17:24:36 nanard Exp $ */
+/* $Id: miniwget.c,v 1.77 2017/05/09 10:04:57 nanard Exp $ */
/* Project : miniupnp
* Website : http://miniupnp.free.fr/
* Author : Thomas Bernard
- * Copyright (c) 2005-2016 Thomas Bernard
+ * Copyright (c) 2005-2017 Thomas Bernard
* This software is subject to the conditions detailed in the
* LICENCE file provided in this distribution. */
@@ -83,8 +83,10 @@
unsigned int content_buf_used = 0;
char chunksize_buf[32];
unsigned int chunksize_buf_index;
+#ifdef DEBUG
char * reason_phrase = NULL;
int reason_phrase_len = 0;
+#endif
if(status_code) *status_code = -1;
header_buf = malloc(header_buf_len);
@@ -109,7 +111,7 @@
chunksize_buf[0] = '\0';
chunksize_buf_index = 0;
- while((n = receivedata(s, buf, 2048, 5000, NULL)) > 0)
+ while((n = receivedata(s, buf, sizeof(buf), 5000, NULL)) > 0)
{
if(endofheaders == 0)
{
@@ -181,8 +183,10 @@
*status_code = atoi(header_buf + sp + 1);
else
{
+#ifdef DEBUG
reason_phrase = header_buf + sp + 1;
reason_phrase_len = i - sp - 1;
+#endif
break;
}
}
@@ -280,11 +284,12 @@
goto end_of_stream;
}
}
- bytestocopy = ((int)chunksize < (n - i))?chunksize:(unsigned int)(n - i);
+ /* it is guaranteed that (n >= i) */
+ bytestocopy = (chunksize < (unsigned int)(n - i))?chunksize:(unsigned int)(n - i);
if((content_buf_used + bytestocopy) > content_buf_len)
{
char * tmp;
- if(content_length >= (int)(content_buf_used + bytestocopy)) {
+ if((content_length >= 0) && ((unsigned int)content_length >= (content_buf_used + bytestocopy))) {
content_buf_len = content_length;
} else {
content_buf_len = content_buf_used + bytestocopy;
@@ -309,14 +314,15 @@
{
/* not chunked */
if(content_length > 0
- && (int)(content_buf_used + n) > content_length) {
+ && (content_buf_used + n) > (unsigned int)content_length) {
/* skipping additional bytes */
n = content_length - content_buf_used;
}
if(content_buf_used + n > content_buf_len)
{
char * tmp;
- if(content_length >= (int)(content_buf_used + n)) {
+ if(content_length >= 0
+ && (unsigned int)content_length >= (content_buf_used + n)) {
content_buf_len = content_length;
} else {
content_buf_len = content_buf_used + n;
@@ -336,7 +342,7 @@
}
}
/* use the Content-Length header value if available */
- if(content_length > 0 && (int)content_buf_used >= content_length)
+ if(content_length > 0 && content_buf_used >= (unsigned int)content_length)
{
#ifdef DEBUG
printf("End of HTTP content\n");
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-2.0/portlistingparse.c new/miniupnpc-2.0.20170509/portlistingparse.c
--- old/miniupnpc-2.0/portlistingparse.c 2015-07-15 18:14:01.000000000 +0200
+++ new/miniupnpc-2.0.20170509/portlistingparse.c 2016-12-16 10:04:33.000000000 +0100
@@ -1,7 +1,7 @@
-/* $Id: portlistingparse.c,v 1.9 2015/07/15 12:41:13 nanard Exp $ */
+/* $Id: portlistingparse.c,v 1.10 2016/12/16 08:53:21 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
- * (c) 2011-2015 Thomas Bernard
+ * (c) 2011-2016 Thomas Bernard
* This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */
#include
@@ -55,7 +55,7 @@
pdata->curelt = PortMappingEltNone;
for(i = 0; elements[i].str; i++)
{
- if(memcmp(name, elements[i].str, l) == 0)
+ if(strlen(elements[i].str) == (size_t)l && memcmp(name, elements[i].str, l) == 0)
{
pdata->curelt = elements[i].code;
break;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-2.0/receivedata.c new/miniupnpc-2.0.20170509/receivedata.c
--- old/miniupnpc-2.0/receivedata.c 2015-11-16 20:20:49.000000000 +0100
+++ new/miniupnpc-2.0.20170509/receivedata.c 2017-04-21 13:24:22.000000000 +0200
@@ -1,4 +1,4 @@
-/* $Id: receivedata.c,v 1.7 2015/11/09 21:51:41 nanard Exp $ */
+/* $Id: receivedata.c,v 1.8 2017/04/21 10:16:45 nanard Exp $ */
/* Project : miniupnp
* Website : http://miniupnp.free.fr/
* Author : Thomas Bernard
@@ -28,7 +28,7 @@
#endif /* _WIN32 */
#ifdef _WIN32
-#define PRINT_SOCKET_ERROR(x) printf("Socket error: %s, %d\n", x, WSAGetLastError());
+#define PRINT_SOCKET_ERROR(x) fprintf(stderr, "Socket error: %s, %d\n", x, WSAGetLastError());
#else
#define PRINT_SOCKET_ERROR(x) perror(x)
#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-2.0/testupnpigd.py new/miniupnpc-2.0.20170509/testupnpigd.py
--- old/miniupnpc-2.0/testupnpigd.py 2008-10-11 12:27:20.000000000 +0200
+++ new/miniupnpc-2.0.20170509/testupnpigd.py 2016-12-16 10:04:33.000000000 +0100
@@ -1,5 +1,5 @@
#! /usr/bin/python
-# $Id: testupnpigd.py,v 1.4 2008/10/11 10:27:20 nanard Exp $
+# $Id: testupnpigd.py,v 1.5 2016/12/16 08:50:55 nanard Exp $
# MiniUPnP project
# Author : Thomas Bernard
# This Sample code is public domain.
@@ -8,7 +8,11 @@
# import the python miniupnpc module
import miniupnpc
import socket
-import BaseHTTPServer
+
+try:
+ from http.server import BaseHTTPRequestHandler, HTTPServer
+except ImportError:
+ from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
# function definition
def list_redirections():
@@ -17,11 +21,11 @@
p = u.getgenericportmapping(i)
if p==None:
break
- print i, p
+ print(i, p)
i = i + 1
#define the handler class for HTTP connections
-class handler_class(BaseHTTPServer.BaseHTTPRequestHandler):
+class handler_class(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.end_headers()
@@ -37,20 +41,20 @@
u.discoverdelay = 200;
try:
- print 'Discovering... delay=%ums' % u.discoverdelay
+ print('Discovering... delay=%ums' % u.discoverdelay)
ndevices = u.discover()
- print ndevices, 'device(s) detected'
+ print(ndevices, 'device(s) detected')
# select an igd
u.selectigd()
# display information about the IGD and the internet connection
- print 'local ip address :', u.lanaddr
+ print('local ip address :', u.lanaddr)
externalipaddress = u.externalipaddress()
- print 'external ip address :', externalipaddress
- print u.statusinfo(), u.connectiontype()
+ print('external ip address :', externalipaddress)
+ print(u.statusinfo(), u.connectiontype())
#instanciate a HTTPd object. The port is assigned by the system.
- httpd = BaseHTTPServer.HTTPServer((u.lanaddr, 0), handler_class)
+ httpd = HTTPServer((u.lanaddr, 0), handler_class)
eport = httpd.server_port
# find a free port for the redirection
@@ -59,26 +63,26 @@
eport = eport + 1
r = u.getspecificportmapping(eport, 'TCP')
- print 'trying to redirect %s port %u TCP => %s port %u TCP' % (externalipaddress, eport, u.lanaddr, httpd.server_port)
+ print('trying to redirect %s port %u TCP => %s port %u TCP' % (externalipaddress, eport, u.lanaddr, httpd.server_port))
b = u.addportmapping(eport, 'TCP', u.lanaddr, httpd.server_port,
'UPnP IGD Tester port %u' % eport, '')
if b:
- print 'Success. Now waiting for some HTTP request on http://%s:%u' % (externalipaddress ,eport)
+ print('Success. Now waiting for some HTTP request on http://%s:%u' % (externalipaddress ,eport))
try:
httpd.handle_request()
httpd.server_close()
- except KeyboardInterrupt, details:
- print "CTRL-C exception!", details
+ except KeyboardInterrupt as details:
+ print("CTRL-C exception!", details)
b = u.deleteportmapping(eport, 'TCP')
if b:
- print 'Successfully deleted port mapping'
+ print('Successfully deleted port mapping')
else:
- print 'Failed to remove port mapping'
+ print('Failed to remove port mapping')
else:
- print 'Failed'
+ print('Failed')
httpd.server_close()
-except Exception, e:
- print 'Exception :', e
+except Exception as e:
+ print('Exception :', e)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-2.0/upnpc.c new/miniupnpc-2.0.20170509/upnpc.c
--- old/miniupnpc-2.0/upnpc.c 2016-02-09 10:38:59.000000000 +0100
+++ new/miniupnpc-2.0.20170509/upnpc.c 2017-04-21 13:24:22.000000000 +0200
@@ -1,4 +1,4 @@
-/* $Id: upnpc.c,v 1.114 2016/01/22 15:04:23 nanard Exp $ */
+/* $Id: upnpc.c,v 1.116 2017/04/21 10:20:50 nanard Exp $ */
/* Project : miniupnp
* Author : Thomas Bernard
* Copyright (c) 2005-2016 Thomas Bernard
@@ -242,7 +242,7 @@
* 2 - get extenal ip address
* 3 - Add port mapping
* 4 - get this port mapping from the IGD */
-static void SetRedirectAndTest(struct UPNPUrls * urls,
+static int SetRedirectAndTest(struct UPNPUrls * urls,
struct IGDdatas * data,
const char * iaddr,
const char * iport,
@@ -262,13 +262,13 @@
if(!iaddr || !iport || !eport || !proto)
{
fprintf(stderr, "Wrong arguments\n");
- return;
+ return -1;
}
proto = protofix(proto);
if(!proto)
{
fprintf(stderr, "invalid protocol\n");
- return;
+ return -1;
}
r = UPNP_GetExternalIPAddress(urls->controlURL,
@@ -292,9 +292,11 @@
r = UPNP_AddPortMapping(urls->controlURL, data->first.servicetype,
eport, iport, iaddr, description,
proto, 0, leaseDuration);
- if(r!=UPNPCOMMAND_SUCCESS)
+ if(r!=UPNPCOMMAND_SUCCESS) {
printf("AddPortMapping(%s, %s, %s) failed with code %d (%s)\n",
eport, iport, iaddr, r, strupnperror(r));
+ return -2;
+ }
}
r = UPNP_GetSpecificPortMappingEntry(urls->controlURL,
@@ -302,17 +304,19 @@
eport, proto, NULL/*remoteHost*/,
intClient, intPort, NULL/*desc*/,
NULL/*enabled*/, duration);
- if(r!=UPNPCOMMAND_SUCCESS)
+ if(r!=UPNPCOMMAND_SUCCESS) {
printf("GetSpecificPortMappingEntry() failed with code %d (%s)\n",
r, strupnperror(r));
- else {
+ return -2;
+ } else {
printf("InternalIP:Port = %s:%s\n", intClient, intPort);
printf("external %s:%s %s is redirected to internal %s:%s (duration=%s)\n",
externalIPAddress, eport, proto, intClient, intPort, duration);
}
+ return 0;
}
-static void
+static int
RemoveRedirect(struct UPNPUrls * urls,
struct IGDdatas * data,
const char * eport,
@@ -323,19 +327,25 @@
if(!proto || !eport)
{
fprintf(stderr, "invalid arguments\n");
- return;
+ return -1;
}
proto = protofix(proto);
if(!proto)
{
fprintf(stderr, "protocol invalid\n");
- return;
+ return -1;
}
r = UPNP_DeletePortMapping(urls->controlURL, data->first.servicetype, eport, proto, remoteHost);
- printf("UPNP_DeletePortMapping() returned : %d\n", r);
+ if(r!=UPNPCOMMAND_SUCCESS) {
+ printf("UPNP_DeletePortMapping() failed with code : %d\n", r);
+ return -2;
+ }else {
+ printf("UPNP_DeletePortMapping() returned : %d\n", r);
+ }
+ return 0;
}
-static void
+static int
RemoveRedirectRange(struct UPNPUrls * urls,
struct IGDdatas * data,
const char * ePortStart, char const * ePortEnd,
@@ -349,16 +359,22 @@
if(!proto || !ePortStart || !ePortEnd)
{
fprintf(stderr, "invalid arguments\n");
- return;
+ return -1;
}
proto = protofix(proto);
if(!proto)
{
fprintf(stderr, "protocol invalid\n");
- return;
+ return -1;
}
r = UPNP_DeletePortMappingRange(urls->controlURL, data->first.servicetype, ePortStart, ePortEnd, proto, manage);
- printf("UPNP_DeletePortMappingRange() returned : %d\n", r);
+ if(r!=UPNPCOMMAND_SUCCESS) {
+ printf("UPNP_DeletePortMappingRange() failed with code : %d\n", r);
+ return -2;
+ }else {
+ printf("UPNP_DeletePortMappingRange() returned : %d\n", r);
+ }
+ return 0;
}
/* IGD:2, functions for service WANIPv6FirewallControl:1 */
@@ -711,29 +727,33 @@
NewListRedirections(&urls, &data);
break;
case 'a':
- SetRedirectAndTest(&urls, &data,
+ if (SetRedirectAndTest(&urls, &data,
commandargv[0], commandargv[1],
commandargv[2], commandargv[3],
(commandargc > 4)?commandargv[4]:"0",
- description, 0);
+ description, 0) < 0)
+ retcode = 2;
break;
case 'd':
- RemoveRedirect(&urls, &data, commandargv[0], commandargv[1],
- commandargc > 2 ? commandargv[2] : NULL);
+ if (RemoveRedirect(&urls, &data, commandargv[0], commandargv[1],
+ commandargc > 2 ? commandargv[2] : NULL) < 0)
+ retcode = 2;
break;
case 'n': /* aNy */
- SetRedirectAndTest(&urls, &data,
+ if (SetRedirectAndTest(&urls, &data,
commandargv[0], commandargv[1],
commandargv[2], commandargv[3],
(commandargc > 4)?commandargv[4]:"0",
- description, 1);
+ description, 1) < 0)
+ retcode = 2;
break;
case 'N':
if (commandargc < 3)
fprintf(stderr, "too few arguments\n");
- RemoveRedirectRange(&urls, &data, commandargv[0], commandargv[1], commandargv[2],
- commandargc > 3 ? commandargv[3] : NULL);
+ if (RemoveRedirectRange(&urls, &data, commandargv[0], commandargv[1], commandargv[2],
+ commandargc > 3 ? commandargv[3] : NULL) < 0)
+ retcode = 2;
break;
case 's':
GetConnectionStatus(&urls, &data);
@@ -749,17 +769,19 @@
break;
} else if(is_int(commandargv[i+1])){
/* 2nd parameter is an integer : <port> <protocol> */
- SetRedirectAndTest(&urls, &data,
+ if (SetRedirectAndTest(&urls, &data,
lanaddr, commandargv[i],
commandargv[i+1], commandargv[i+2], "0",
- description, 0);
+ description, 0) < 0)
+ retcode = 2;
i+=3; /* 3 parameters parsed */
} else {
/* 2nd parameter not an integer : <port> <protocol> */
- SetRedirectAndTest(&urls, &data,
+ if (SetRedirectAndTest(&urls, &data,
lanaddr, commandargv[i],
commandargv[i], commandargv[i+1], "0",
- description, 0);
+ description, 0) < 0)
+ retcode = 2;
i+=2; /* 2 parameters parsed */
}
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-2.0/upnpcommands.c new/miniupnpc-2.0.20170509/upnpcommands.c
--- old/miniupnpc-2.0/upnpcommands.c 2016-04-19 23:01:04.000000000 +0200
+++ new/miniupnpc-2.0.20170509/upnpcommands.c 2017-04-21 13:24:22.000000000 +0200
@@ -1,7 +1,8 @@
-/* $Id: upnpcommands.c,v 1.47 2016/03/07 12:26:48 nanard Exp $ */
-/* Project : miniupnp
+/* $Id: upnpcommands.c,v 1.48 2017/04/21 10:22:40 nanard Exp $ */
+/* vim: tabstop=4 shiftwidth=4 noexpandtab
+ * Project : miniupnp
* Author : Thomas Bernard
- * Copyright (c) 2005-2015 Thomas Bernard
+ * Copyright (c) 2005-2017 Thomas Bernard
* This software is subject to the conditions detailed in the
* LICENCE file provided in this distribution.
* */
@@ -372,10 +373,11 @@
AddPortMappingArgs[6].val = desc?desc:"libminiupnpc";
AddPortMappingArgs[7].elt = "NewLeaseDuration";
AddPortMappingArgs[7].val = leaseDuration?leaseDuration:"0";
- if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
- "AddPortMapping", AddPortMappingArgs,
- &bufsize))) {
- free(AddPortMappingArgs);
+ buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "AddPortMapping", AddPortMappingArgs,
+ &bufsize);
+ free(AddPortMappingArgs);
+ if(!buffer) {
return UPNPCOMMAND_HTTP_ERROR;
}
/*DisplayNameValueList(buffer, bufsize);*/
@@ -392,7 +394,6 @@
ret = UPNPCOMMAND_SUCCESS;
}
ClearNameValueList(&pdata);
- free(AddPortMappingArgs);
return ret;
}
@@ -436,10 +437,11 @@
AddPortMappingArgs[6].val = desc?desc:"libminiupnpc";
AddPortMappingArgs[7].elt = "NewLeaseDuration";
AddPortMappingArgs[7].val = leaseDuration?leaseDuration:"0";
- if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
- "AddAnyPortMapping", AddPortMappingArgs,
- &bufsize))) {
- free(AddPortMappingArgs);
+ buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "AddAnyPortMapping", AddPortMappingArgs,
+ &bufsize);
+ free(AddPortMappingArgs);
+ if(!buffer) {
return UPNPCOMMAND_HTTP_ERROR;
}
ParseNameValue(buffer, bufsize, &pdata);
@@ -461,7 +463,6 @@
}
}
ClearNameValueList(&pdata);
- free(AddPortMappingArgs);
return ret;
}
@@ -490,10 +491,11 @@
DeletePortMappingArgs[1].val = extPort;
DeletePortMappingArgs[2].elt = "NewProtocol";
DeletePortMappingArgs[2].val = proto;
- if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
- "DeletePortMapping",
- DeletePortMappingArgs, &bufsize))) {
- free(DeletePortMappingArgs);
+ buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "DeletePortMapping",
+ DeletePortMappingArgs, &bufsize);
+ free(DeletePortMappingArgs);
+ if(!buffer) {
return UPNPCOMMAND_HTTP_ERROR;
}
/*DisplayNameValueList(buffer, bufsize);*/
@@ -507,7 +509,6 @@
ret = UPNPCOMMAND_SUCCESS;
}
ClearNameValueList(&pdata);
- free(DeletePortMappingArgs);
return ret;
}
@@ -539,10 +540,11 @@
DeletePortMappingArgs[3].elt = "NewManage";
DeletePortMappingArgs[3].val = manage;
- if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
- "DeletePortMappingRange",
- DeletePortMappingArgs, &bufsize))) {
- free(DeletePortMappingArgs);
+ buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "DeletePortMappingRange",
+ DeletePortMappingArgs, &bufsize);
+ free(DeletePortMappingArgs);
+ if(!buffer) {
return UPNPCOMMAND_HTTP_ERROR;
}
ParseNameValue(buffer, bufsize, &pdata);
@@ -555,7 +557,6 @@
ret = UPNPCOMMAND_SUCCESS;
}
ClearNameValueList(&pdata);
- free(DeletePortMappingArgs);
return ret;
}
@@ -587,10 +588,11 @@
return UPNPCOMMAND_MEM_ALLOC_ERROR;
GetPortMappingArgs[0].elt = "NewPortMappingIndex";
GetPortMappingArgs[0].val = index;
- if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
- "GetGenericPortMappingEntry",
- GetPortMappingArgs, &bufsize))) {
- free(GetPortMappingArgs);
+ buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "GetGenericPortMappingEntry",
+ GetPortMappingArgs, &bufsize);
+ free(GetPortMappingArgs);
+ if(!buffer) {
return UPNPCOMMAND_HTTP_ERROR;
}
ParseNameValue(buffer, bufsize, &pdata);
@@ -652,7 +654,6 @@
sscanf(p, "%d", &r);
}
ClearNameValueList(&pdata);
- free(GetPortMappingArgs);
return r;
}
@@ -728,10 +729,11 @@
GetPortMappingArgs[1].val = extPort;
GetPortMappingArgs[2].elt = "NewProtocol";
GetPortMappingArgs[2].val = proto;
- if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
- "GetSpecificPortMappingEntry",
- GetPortMappingArgs, &bufsize))) {
- free(GetPortMappingArgs);
+ buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "GetSpecificPortMappingEntry",
+ GetPortMappingArgs, &bufsize);
+ free(GetPortMappingArgs);
+ if(!buffer) {
return UPNPCOMMAND_HTTP_ERROR;
}
/*DisplayNameValueList(buffer, bufsize);*/
@@ -779,7 +781,6 @@
}
ClearNameValueList(&pdata);
- free(GetPortMappingArgs);
return ret;
}
@@ -824,13 +825,13 @@
GetListOfPortMappingsArgs[4].elt = "NewNumberOfPorts";
GetListOfPortMappingsArgs[4].val = numberOfPorts?numberOfPorts:"1000";
- if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
- "GetListOfPortMappings",
- GetListOfPortMappingsArgs, &bufsize))) {
- free(GetListOfPortMappingsArgs);
+ buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "GetListOfPortMappings",
+ GetListOfPortMappingsArgs, &bufsize);
+ free(GetListOfPortMappingsArgs);
+ if(!buffer) {
return UPNPCOMMAND_HTTP_ERROR;
}
- free(GetListOfPortMappingsArgs);
/*DisplayNameValueList(buffer, bufsize);*/
ParseNameValue(buffer, bufsize, &pdata);
@@ -954,6 +955,7 @@
GetOutboundPinholeTimeoutArgs[4].val = intClient;
buffer = simpleUPnPcommand(-1, controlURL, servicetype,
"GetOutboundPinholeTimeout", GetOutboundPinholeTimeoutArgs, &bufsize);
+ free(GetOutboundPinholeTimeoutArgs);
if(!buffer)
return UPNPCOMMAND_HTTP_ERROR;
ParseNameValue(buffer, bufsize, &pdata);
@@ -972,7 +974,6 @@
*opTimeout = my_atoui(p);
}
ClearNameValueList(&pdata);
- free(GetOutboundPinholeTimeoutArgs);
return ret;
}
@@ -1031,6 +1032,7 @@
AddPinholeArgs[5].val = leaseTime;
buffer = simpleUPnPcommand(-1, controlURL, servicetype,
"AddPinhole", AddPinholeArgs, &bufsize);
+ free(AddPinholeArgs);
if(!buffer)
return UPNPCOMMAND_HTTP_ERROR;
ParseNameValue(buffer, bufsize, &pdata);
@@ -1053,7 +1055,6 @@
ret = UPNPCOMMAND_SUCCESS;
}
ClearNameValueList(&pdata);
- free(AddPinholeArgs);
return ret;
}
@@ -1081,6 +1082,7 @@
UpdatePinholeArgs[1].val = leaseTime;
buffer = simpleUPnPcommand(-1, controlURL, servicetype,
"UpdatePinhole", UpdatePinholeArgs, &bufsize);
+ free(UpdatePinholeArgs);
if(!buffer)
return UPNPCOMMAND_HTTP_ERROR;
ParseNameValue(buffer, bufsize, &pdata);
@@ -1097,7 +1099,6 @@
ret = UPNPCOMMAND_SUCCESS;
}
ClearNameValueList(&pdata);
- free(UpdatePinholeArgs);
return ret;
}
@@ -1122,6 +1123,7 @@
DeletePinholeArgs[0].val = uniqueID;
buffer = simpleUPnPcommand(-1, controlURL, servicetype,
"DeletePinhole", DeletePinholeArgs, &bufsize);
+ free(DeletePinholeArgs);
if(!buffer)
return UPNPCOMMAND_HTTP_ERROR;
/*DisplayNameValueList(buffer, bufsize);*/
@@ -1138,7 +1140,6 @@
ret = UPNPCOMMAND_SUCCESS;
}
ClearNameValueList(&pdata);
- free(DeletePinholeArgs);
return ret;
}
@@ -1163,8 +1164,11 @@
CheckPinholeWorkingArgs[0].val = uniqueID;
buffer = simpleUPnPcommand(-1, controlURL, servicetype,
"CheckPinholeWorking", CheckPinholeWorkingArgs, &bufsize);
+ free(CheckPinholeWorkingArgs);
if(!buffer)
+ {
return UPNPCOMMAND_HTTP_ERROR;
+ }
ParseNameValue(buffer, bufsize, &pdata);
free(buffer); buffer = NULL;
@@ -1185,7 +1189,6 @@
}
ClearNameValueList(&pdata);
- free(CheckPinholeWorkingArgs);
return ret;
}
@@ -1210,6 +1213,7 @@
GetPinholePacketsArgs[0].val = uniqueID;
buffer = simpleUPnPcommand(-1, controlURL, servicetype,
"GetPinholePackets", GetPinholePacketsArgs, &bufsize);
+ free(GetPinholePacketsArgs);
if(!buffer)
return UPNPCOMMAND_HTTP_ERROR;
ParseNameValue(buffer, bufsize, &pdata);
@@ -1230,7 +1234,6 @@
}
ClearNameValueList(&pdata);
- free(GetPinholePacketsArgs);
return ret;
}