Hello community, here is the log from the commit of package miniupnpc for openSUSE:Factory checked in at 2014-06-19 13:19:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/miniupnpc (Old) and /work/SRC/openSUSE:Factory/.miniupnpc.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "miniupnpc" Changes: -------- --- /work/SRC/openSUSE:Factory/miniupnpc/miniupnpc.changes 2013-06-11 09:34:26.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.miniupnpc.new/miniupnpc.changes 2014-06-19 13:19:56.000000000 +0200 @@ -1,0 +2,22 @@ +Wed Jun 11 07:34:30 UTC 2014 - joop.boo...@opensuse.org + +- Update to 1.9: + * added argument remoteHost to UPNP_GetSpecificPortMappingEntry() + increment API_VERSION to 10 + * --help and -h arguments in upnpc.c + * fixed potential buffer overrun in miniwget.c + bnc#881990 + CVE-2014-3985 + Modified UPNP_GetValidIGD() to check for ExternalIpAddress + * define MAXHOSTNAMELEN if not already done + * update upnpreplyparse to allow larger values (128 chars instead of 64) + * Update upnpreplyparse to take into account "empty" elements + validate upnpreplyparse.c code with "make check" + * Fix Solaris build thanks to Maciej Małecki + * Fix testminiwget.sh for BSD + * Fixed Makefile for *BSD + * Update Makefile to use JNAerator version 0.11 + * Fix testminiwget.sh for use with dash + Use $(DESTDIR) in Makefile + +------------------------------------------------------------------- Old: ---- miniupnpc-1.8.tar.gz New: ---- miniupnpc-1.9.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ miniupnpc.spec ++++++ --- /var/tmp/diff_new_pack.iA5W26/_old 2014-06-19 13:19:57.000000000 +0200 +++ /var/tmp/diff_new_pack.iA5W26/_new 2014-06-19 13:19:57.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package miniupnpc # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,10 +16,10 @@ # -%define soname 9 +%define soname 10 Name: miniupnpc -Version: 1.8 +Version: 1.9 Release: 0 Summary: Universal Plug'n'Play (UPnP) Client License: BSD-3-Clause @@ -88,6 +88,8 @@ --record-rpm="rpmfiles.lst" # Remove static libs rm -f %{buildroot}%{_libdir}/*.a +# The man page should be non executable +chmod -x %{buildroot}%{_mandir}/man3/miniupnpc.3.gz %post -n libminiupnpc%{soname} -p /sbin/ldconfig ++++++ miniupnpc-1.8.tar.gz -> miniupnpc-1.9.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/CMakeLists.txt new/miniupnpc-1.9/CMakeLists.txt --- old/miniupnpc-1.8/CMakeLists.txt 2012-06-26 01:48:57.000000000 +0200 +++ new/miniupnpc-1.9/CMakeLists.txt 2014-01-31 14:18:56.000000000 +0100 @@ -1,8 +1,8 @@ cmake_minimum_required (VERSION 2.6) project (miniupnpc C) -set (MINIUPNPC_VERSION 1.7) -set (MINIUPNPC_API_VERSION 9) +set (MINIUPNPC_VERSION 1.9) +set (MINIUPNPC_API_VERSION 10) if (NOT CMAKE_BUILD_TYPE) if (WIN32) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/Changelog.txt new/miniupnpc-1.9/Changelog.txt --- old/miniupnpc-1.8/Changelog.txt 2013-01-28 11:10:24.000000000 +0100 +++ new/miniupnpc-1.9/Changelog.txt 2014-01-31 14:18:56.000000000 +0100 @@ -1,6 +1,47 @@ -$Id: Changelog.txt,v 1.180 2012/10/16 16:49:39 nanard Exp $ +$Id: Changelog.txt,v 1.191 2014/01/31 13:18:24 nanard Exp $ miniUPnP client Changelog. +VERSION 1.9 : released 2014/01/31 + +2014/01/31: + added argument remoteHost to UPNP_GetSpecificPortMappingEntry() + increment API_VERSION to 10 + +2013/12/09: + --help and -h arguments in upnpc.c + +2013/10/07: + fixed potential buffer overrun in miniwget.c + Modified UPNP_GetValidIGD() to check for ExternalIpAddress + +2013/08/01: + define MAXHOSTNAMELEN if not already done + +2013/06/06: + update upnpreplyparse to allow larger values (128 chars instead of 64) + +2013/05/14: + Update upnpreplyparse to take into account "empty" elements + validate upnpreplyparse.c code with "make check" + +2013/05/03: + Fix Solaris build thanks to Maciej Małecki + +2013/04/27: + Fix testminiwget.sh for BSD + +2013/03/23: + Fixed Makefile for *BSD + +2013/03/11: + Update Makefile to use JNAerator version 0.11 + +2013/02/11: + Fix testminiwget.sh for use with dash + Use $(DESTDIR) in Makefile + +VERSION 1.8 : released 2013/02/06 + 2012/10/16: fix testminiwget with no IPv6 support diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/Makefile new/miniupnpc-1.9/Makefile --- old/miniupnpc-1.8/Makefile 2013-01-28 11:10:25.000000000 +0100 +++ new/miniupnpc-1.9/Makefile 2014-01-31 14:57:23.000000000 +0100 @@ -1,15 +1,15 @@ -# $Id: Makefile,v 1.100 2013/01/27 21:48:36 nanard Exp $ +# $Id: Makefile,v 1.106 2014/01/31 13:57:23 nanard Exp $ # MiniUPnP Project # http://miniupnp.free.fr/ # http://miniupnp.tuxfamily.org/ # https://github.com/miniupnp/miniupnp -# (c) 2005-2012 Thomas Bernard +# (c) 2005-2013 Thomas Bernard # to install use : -# $ PREFIX=/tmp/dummylocation make install +# $ make DESTDIR=/tmp/dummylocation install # or # $ INSTALLPREFIX=/usr/local make install # or -# make install (will go to /usr/bin, /usr/lib, etc...) +# $ make install (default INSTALLPREFIX is /usr) OS = $(shell uname -s) VERSION = $(shell cat VERSION) @@ -42,13 +42,20 @@ SH = /bin/sh JAVA = java # see http://code.google.com/p/jnaerator/ -JNAERATOR = jnaerator-0.9.7.jar +#JNAERATOR = jnaerator-0.9.7.jar +#JNAERATOR = jnaerator-0.9.8-shaded.jar +#JNAERATORARGS = -library miniupnpc +#JNAERATOR = jnaerator-0.10-shaded.jar +JNAERATOR = jnaerator-0.11-shaded.jar +JNAERATORARGS = -mode StandaloneJar -runtime JNAerator -library miniupnpc JNAERATORBASEURL = http://jnaerator.googlecode.com/files/ -#following libs are needed on Solaris -#LDLIBS=-lsocket -lnsl -lresolv + +ifeq (SunOS, $(OS)) + LDFLAGS=-lsocket -lnsl -lresolv +endif # APIVERSION is used to build SONAME -APIVERSION = 9 +APIVERSION = 10 SRCS = igd_desc_parse.c miniupnpc.c minixml.c minisoap.c miniwget.c \ upnpc.c upnpcommands.c upnpreplyparse.c testminixml.c \ @@ -80,12 +87,12 @@ SONAME = $(basename $(SHAREDLIBRARY)).$(APIVERSION).dylib CFLAGS := -DMACOSX -D_DARWIN_C_SOURCE $(CFLAGS) else -ifeq ($(OS), Linux) - SHAREDLIBRARY = libminiupnpc.so - SONAME = $(SHAREDLIBRARY).$(APIVERSION) -endif ifeq ($(JARSUFFIX), win32) SHAREDLIBRARY = miniupnpc.dll +else + # Linux/BSD/etc. + SHAREDLIBRARY = libminiupnpc.so + SONAME = $(SHAREDLIBRARY).$(APIVERSION) endif endif @@ -132,7 +139,7 @@ test: check -check: validateminixml validateminiwget +check: validateminixml validateminiwget validateupnpreplyparse everything: all $(EXECUTABLES_ADDTESTS) @@ -160,6 +167,11 @@ ./testminiwget.sh touch $@ +validateupnpreplyparse: testupnpreplyparse testupnpreplyparse.sh + @echo "upnpreplyparse validation test" + ./testupnpreplyparse.sh + touch $@ + clean: $(RM) $(LIBRARY) $(SHAREDLIBRARY) $(EXECUTABLES) $(OBJS) miniupnpcstrings.h # clean python stuff @@ -177,31 +189,34 @@ sed 's/\(.*MINIUPNPC_API_VERSION\s\+\)[0-9]\+/\1$(APIVERSION)/' < miniupnpc.h.bak > miniupnpc.h install: updateversion $(FILESTOINSTALL) - $(INSTALL) -d $(INSTALLDIRINC) - $(INSTALL) -m 644 $(HEADERS) $(INSTALLDIRINC) - $(INSTALL) -d $(INSTALLDIRLIB) - $(INSTALL) -m 644 $(LIBRARY) $(INSTALLDIRLIB) + $(INSTALL) -d $(DESTDIR)$(INSTALLDIRINC) + $(INSTALL) -m 644 $(HEADERS) $(DESTDIR)$(INSTALLDIRINC) + $(INSTALL) -d $(DESTDIR)$(INSTALLDIRLIB) + $(INSTALL) -m 644 $(LIBRARY) $(DESTDIR)$(INSTALLDIRLIB) ifneq ($(OS), AmigaOS) - $(INSTALL) -m 644 $(SHAREDLIBRARY) $(INSTALLDIRLIB)/$(SONAME) - ln -fs $(SONAME) $(INSTALLDIRLIB)/$(SHAREDLIBRARY) + $(INSTALL) -m 644 $(SHAREDLIBRARY) $(DESTDIR)$(INSTALLDIRLIB)/$(SONAME) + ln -fs $(SONAME) $(DESTDIR)$(INSTALLDIRLIB)/$(SHAREDLIBRARY) endif - $(INSTALL) -d $(INSTALLDIRBIN) + $(INSTALL) -d $(DESTDIR)$(INSTALLDIRBIN) ifeq ($(OS), AmigaOS) - $(INSTALL) -m 755 upnpc-static $(INSTALLDIRBIN)/upnpc + $(INSTALL) -m 755 upnpc-static $(DESTDIR)$(INSTALLDIRBIN)/upnpc else - $(INSTALL) -m 755 upnpc-shared $(INSTALLDIRBIN)/upnpc + $(INSTALL) -m 755 upnpc-shared $(DESTDIR)$(INSTALLDIRBIN)/upnpc endif - $(INSTALL) -m 755 external-ip.sh $(INSTALLDIRBIN)/external-ip + $(INSTALL) -m 755 external-ip.sh $(DESTDIR)$(INSTALLDIRBIN)/external-ip ifneq ($(OS), AmigaOS) - $(INSTALL) -d $(INSTALLDIRMAN)/man3 - $(INSTALL) man3/miniupnpc.3 $(INSTALLDIRMAN)/man3/miniupnpc.3 + $(INSTALL) -d $(DESTDIR)$(INSTALLDIRMAN)/man3 + $(INSTALL) man3/miniupnpc.3 $(DESTDIR)$(INSTALLDIRMAN)/man3/miniupnpc.3 +ifeq ($(OS), Linux) + gzip $(DESTDIR)$(INSTALLDIRMAN)/man3/miniupnpc.3 +endif endif cleaninstall: - $(RM) -r $(INSTALLDIRINC) - $(RM) $(INSTALLDIRLIB)/$(LIBRARY) - $(RM) $(INSTALLDIRLIB)/$(SHAREDLIBRARY) + $(RM) -r $(DESTDIR)$(INSTALLDIRINC) + $(RM) $(DESTDIR)$(INSTALLDIRLIB)/$(LIBRARY) + $(RM) $(DESTDIR)$(INSTALLDIRLIB)/$(SHAREDLIBRARY) depend: makedepend -Y -- $(CFLAGS) -- $(SRCS) 2>/dev/null @@ -217,10 +232,10 @@ $(CC) -shared $(LDFLAGS) -Wl,-soname,$(SONAME) -o $@ $^ endif -upnpc-static: upnpc.o $(LIBRARY) $(LDLIBS) +upnpc-static: upnpc.o $(LIBRARY) $(CC) $(LDFLAGS) -o $@ $^ -upnpc-shared: upnpc.o $(SHAREDLIBRARY) $(LDLIBS) +upnpc-shared: upnpc.o $(SHAREDLIBRARY) $(CC) $(LDFLAGS) -o $@ $^ testminixml: $(TESTMINIXMLOBJS) @@ -236,17 +251,14 @@ miniupnpcstrings.h: miniupnpcstrings.h.in updateminiupnpcstrings.sh VERSION $(SH) updateminiupnpcstrings.sh -jnaerator-0.9.8-shaded.jar: - wget $(JNAERATORBASEURL)/$@ || curl -o $@ $(JNAERATORBASEURL)/$@ - -jnaerator-0.9.7.jar: - wget $(JNAERATORBASEURL)/$@ || curl -o $@ $(JNAERATORBASEURL)/$@ - -jnaerator-0.9.3.jar: - wget $(JNAERATORBASEURL)/$@ || curl -o $@ $(JNAERATORBASEURL)/$@ +# ftp tool supplied with OpenBSD can download files from http. +jnaerator-%.jar: + wget $(JNAERATORBASEURL)/$@ || \ + curl -o $@ $(JNAERATORBASEURL)/$@ || \ + ftp $(JNAERATORBASEURL)/$@ jar: $(SHAREDLIBRARY) $(JNAERATOR) - $(JAVA) -jar $(JNAERATOR) -library miniupnpc \ + $(JAVA) -jar $(JNAERATOR) $(JNAERATORARGS) \ miniupnpc.h declspec.h upnpcommands.h upnpreplyparse.h \ igd_desc_parse.h miniwget.h upnperrors.h $(SHAREDLIBRARY) \ -package fr.free.miniupnp -o . -jar java/miniupnpc_$(JARSUFFIX).jar -v diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/Makefile.mingw new/miniupnpc-1.9/Makefile.mingw --- old/miniupnpc-1.8/Makefile.mingw 2013-01-28 11:10:25.000000000 +0100 +++ new/miniupnpc-1.9/Makefile.mingw 2014-01-31 14:18:56.000000000 +0100 @@ -1,7 +1,7 @@ -# $Id: Makefile.mingw,v 1.17 2012/12/02 14:12:45 nanard Exp $ +# $Id: Makefile.mingw,v 1.18 2014/01/17 09:04:01 nanard Exp $ # Miniupnp project. # http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ -# (c) 2005-2011 Thomas Bernard +# (c) 2005-2014 Thomas Bernard # This Makefile is made for MinGW # CC = gcc @@ -57,11 +57,12 @@ $(CC) $(CFLAGS) -DSTATICLIB -c -o $@ $< $(CC) $(CFLAGS) -c -o dll/$@ $< +# --enable-stdcall-fixup upnpc-static: upnpc.o libminiupnpc.a - $(CC) -enable-stdcall-fixup -o $@ $^ $(LDLIBS) + $(CC) -o $@ $^ $(LDLIBS) upnpc-shared: dll/upnpc.o miniupnpc.lib - $(CC) -enable-stdcall-fixup -o $@ $^ $(LDLIBS) + $(CC) -o $@ $^ $(LDLIBS) wingenminiupnpcstrings: wingenminiupnpcstrings.o diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/VERSION new/miniupnpc-1.9/VERSION --- old/miniupnpc-1.8/VERSION 2013-02-06 14:14:42.000000000 +0100 +++ new/miniupnpc-1.9/VERSION 2014-01-31 14:18:56.000000000 +0100 @@ -1 +1 @@ -1.8 +1.9 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/apiversions.txt new/miniupnpc-1.9/apiversions.txt --- old/miniupnpc-1.8/apiversions.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/miniupnpc-1.9/apiversions.txt 2014-01-31 14:18:56.000000000 +0100 @@ -0,0 +1,127 @@ +$Id: apiversions.txt,v 1.3 2014/01/31 13:14:32 nanard Exp $ + +Differences in API between miniUPnPc versions + +====================== miniUPnPc version 1.9 ====================== +API version 10 + +upnpcommands.h: + added argument remoteHost to UPNP_GetSpecificPortMappingEntry() + +miniupnpc.h: + updated macros : + #define MINIUPNPC_VERSION "1.9" + #define MINIUPNPC_API_VERSION 10 + +====================== miniUPnPc version 1.8 ====================== +API version 9 + +miniupnpc.h: + updated macros : + #define MINIUPNPC_VERSION "1.8" + #define MINIUPNPC_API_VERSION 9 + added "unsigned int scope_id;" to struct UPNPDev + added scope_id argument to GetUPNPUrls() + + + +====================== miniUPnPc version 1.7 ====================== +API version 8 + +miniupnpc.h : + add new macros : + #define MINIUPNPC_VERSION "1.7" + #define MINIUPNPC_API_VERSION 8 + add rootdescURL to struct UPNPUrls + + + +====================== miniUPnPc version 1.6 ====================== +API version 8 + +Adding support for IPv6. +igd_desc_parse.h : + struct IGDdatas_service : + add char presentationurl[MINIUPNPC_URL_MAXSIZE]; + struct IGDdatas : + add struct IGDdatas_service IPv6FC; +miniupnpc.h : + new macros : + #define UPNPDISCOVER_SUCCESS (0) + #define UPNPDISCOVER_UNKNOWN_ERROR (-1) + #define UPNPDISCOVER_SOCKET_ERROR (-101) + #define UPNPDISCOVER_MEMORY_ERROR (-102) + simpleUPnPcommand() prototype changed (but is normaly not used by API users) + add arguments ipv6 and error to upnpDiscover() : + struct UPNPDev * + upnpDiscover(int delay, const char * multicastif, + const char * minissdpdsock, int sameport, + int ipv6, + int * error); + add controlURL_6FC member to struct UPNPUrls : + struct UPNPUrls { + char * controlURL; + char * ipcondescURL; + char * controlURL_CIF; + char * controlURL_6FC; + }; + +upnpcommands.h : + add leaseDuration argument to UPNP_AddPortMapping() + add desc, enabled and leaseDuration arguments to UPNP_GetSpecificPortMappingEntry() + add UPNP_GetListOfPortMappings() function (IGDv2) + add IGDv2 IPv6 related functions : + UPNP_GetFirewallStatus() + UPNP_GetOutboundPinholeTimeout() + UPNP_AddPinhole() + UPNP_UpdatePinhole() + UPNP_DeletePinhole() + UPNP_CheckPinholeWorking() + UPNP_GetPinholePackets() + + + +====================== miniUPnPc version 1.5 ====================== +API version 5 + +new function : +int UPNPIGD_IsConnected(struct UPNPUrls *, struct IGDdatas *); +new macro in upnpcommands.h : +#define UPNPCOMMAND_HTTP_ERROR + +====================== miniUPnPc version 1.4 ====================== +Same API as version 1.3 + +====================== miniUPnPc version 1.3 ====================== +API version 4 + +Use UNSIGNED_INTEGER type for +UPNP_GetTotalBytesSent(), UPNP_GetTotalBytesReceived(), +UPNP_GetTotalPacketsSent(), UPNP_GetTotalPacketsReceived() +Add remoteHost argument to UPNP_AddPortMapping() and UPNP_DeletePortMapping() + +====================== miniUPnPc version 1.2 ====================== +API version 3 + +added sameport argument to upnpDiscover() +struct UPNPDev * +upnpDiscover(int delay, const char * multicastif, + const char * minissdpdsock, int sameport); + +====================== miniUPnPc Version 1.1 ====================== +Same API as 1.0 + + +====================== miniUPnPc Version 1.0 ====================== +API version 2 + + +struct UPNPDev { + struct UPNPDev * pNext; + char * descURL; + char * st; + char buffer[2]; +}; +struct UPNPDev * upnpDiscover(int delay, const char * multicastif, + const char * minissdpdsock); + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/connecthostport.c new/miniupnpc-1.9/connecthostport.c --- old/miniupnpc-1.8/connecthostport.c 2012-06-26 02:00:27.000000000 +0200 +++ new/miniupnpc-1.9/connecthostport.c 2013-08-01 23:21:27.000000000 +0200 @@ -1,7 +1,7 @@ -/* $Id: connecthostport.c,v 1.9 2012/06/26 00:00:27 nanard Exp $ */ +/* $Id: connecthostport.c,v 1.11 2013/08/01 21:21:25 nanard Exp $ */ /* Project : miniupnp * Author : Thomas Bernard - * Copyright (c) 2010-2012 Thomas Bernard + * Copyright (c) 2010-2013 Thomas Bernard * This software is subject to the conditions detailed in the * LICENCE file provided in this distribution. */ @@ -24,6 +24,7 @@ #else /* #ifdef _WIN32 */ #include <unistd.h> #include <sys/param.h> +#include <sys/select.h> #include <errno.h> #define closesocket close #include <netdb.h> @@ -50,6 +51,10 @@ #include "connecthostport.h" +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 64 +#endif + /* connecthostport() * return a socket connected (TCP) to the host and port * or -1 in case of error */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/java/JavaBridgeTest.java new/miniupnpc-1.9/java/JavaBridgeTest.java --- old/miniupnpc-1.8/java/JavaBridgeTest.java 2012-04-06 19:47:57.000000000 +0200 +++ new/miniupnpc-1.9/java/JavaBridgeTest.java 2014-01-31 14:18:59.000000000 +0100 @@ -72,7 +72,7 @@ System.out.println("AddPortMapping() failed with code " + ret); ret = miniupnpc.UPNP_GetSpecificPortMappingEntry( urls.controlURL.getString(0), new String(data.first.servicetype), - args[0], args[1], intClient, intPort, + args[0], args[1], null, intClient, intPort, desc, enabled, leaseDuration); if (ret != MiniupnpcLibrary.UPNPCOMMAND_SUCCESS) System.out.println("GetSpecificPortMappingEntry() failed with code " + ret); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/man3/miniupnpc.3 new/miniupnpc-1.9/man3/miniupnpc.3 --- old/miniupnpc-1.8/man3/miniupnpc.3 2011-07-25 20:02:15.000000000 +0200 +++ new/miniupnpc-1.9/man3/miniupnpc.3 2013-02-11 11:32:19.000000000 +0100 @@ -1,5 +1,4 @@ -\" $Id: miniupnpc.3,v 1.3 2011/07/25 18:02:11 nanard Exp $ -.TH miniupnpc 3 +.TH MINIUPNPC 3 .SH NAME miniupnpc \- UPnP client library .SH SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/miniupnpc.c new/miniupnpc-1.9/miniupnpc.c --- old/miniupnpc-1.8/miniupnpc.c 2013-01-28 11:10:25.000000000 +0100 +++ new/miniupnpc-1.9/miniupnpc.c 2013-12-13 13:22:28.000000000 +0100 @@ -1,8 +1,8 @@ -/* $Id: miniupnpc.c,v 1.111 2012/10/09 17:53:14 nanard Exp $ */ +/* $Id: miniupnpc.c,v 1.115 2013/12/13 12:02:24 nanard Exp $ */ /* Project : miniupnp * Web : http://miniupnp.free.fr/ * Author : Thomas BERNARD - * copyright (c) 2005-2012 Thomas Bernard + * copyright (c) 2005-2013 Thomas Bernard * This software is subjet to the conditions detailed in the * provided LICENSE file. */ #define __EXTENSIONS__ 1 @@ -71,6 +71,17 @@ #define TIMEVAL struct timeval #endif + +#if defined(HAS_IP_MREQN) && defined(NEED_STRUCT_IP_MREQN) +/* Several versions of glibc don't define this structure, define it here and compile with CFLAGS NEED_STRUCT_IP_MREQN */ +struct ip_mreqn +{ + struct in_addr imr_multiaddr; /* IP multicast address of group */ + struct in_addr imr_address; /* local IP address of interface */ + int imr_ifindex; /* Interface index */ +}; +#endif + #include "miniupnpc.h" #include "minissdpc.h" #include "miniwget.h" @@ -86,6 +97,10 @@ #define PRINT_SOCKET_ERROR(x) perror(x) #endif +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 64 +#endif + #define SOAPPREFIX "s" #define SERVICEPREFIX "u" #define SERVICEPREFIX2 'u' @@ -545,6 +560,10 @@ *error = UPNPDISCOVER_SUCCESS; /* Calculating maximum response time in seconds */ mx = ((unsigned int)delay) / 1000u; + if(mx == 0) { + mx = 1; + delay = 1000; + } /* receiving SSDP response packet */ for(n = 0; deviceList[deviceIndex]; deviceIndex++) { @@ -867,7 +886,7 @@ * not connected * 3 = an UPnP device has been found but was not recognized as an IGD * - * In any non zero return case, the urls and data structures + * In any positive non zero return case, the urls and data structures * passed as parameters are set. Donc forget to call FreeUPNPUrls(urls) to * free allocated memory. */ @@ -880,11 +899,14 @@ struct xml_desc { char * xml; int size; + int is_igd; } * desc = NULL; struct UPNPDev * dev; int ndev = 0; int i; int state = -1; /* state 1 : IGD connected. State 2 : IGD. State 3 : anything */ + int n_igd = 0; + char extIpAddr[16]; if(!devlist) { #ifdef DEBUG @@ -892,6 +914,7 @@ #endif return 0; } + /* counting total number of devices in the list */ for(dev = devlist; dev; dev = dev->pNext) ndev++; if(ndev > 0) @@ -900,41 +923,58 @@ if(!desc) return -1; /* memory allocation error */ } - for(state = 1; state <= 3; state++) + /* Step 1 : downloading descriptions and testing type */ + for(dev = devlist, i = 0; dev; dev = dev->pNext, i++) { - for(dev = devlist, i = 0; dev; dev = dev->pNext, i++) - { - /* we should choose an internet gateway device. - * with st == urn:schemas-upnp-org:device:InternetGatewayDevice:1 */ - if(state == 1) - { - desc[i].xml = miniwget_getaddr(dev->descURL, &(desc[i].size), - lanaddr, lanaddrlen, - dev->scope_id); + /* we should choose an internet gateway device. + * with st == urn:schemas-upnp-org:device:InternetGatewayDevice:1 */ + desc[i].xml = miniwget_getaddr(dev->descURL, &(desc[i].size), + lanaddr, lanaddrlen, + dev->scope_id); #ifdef DEBUG - if(!desc[i].xml) - { - printf("error getting XML description %s\n", dev->descURL); - } + if(!desc[i].xml) + { + printf("error getting XML description %s\n", dev->descURL); + } #endif + if(desc[i].xml) + { + memset(data, 0, sizeof(struct IGDdatas)); + memset(urls, 0, sizeof(struct UPNPUrls)); + parserootdesc(desc[i].xml, desc[i].size, data); + if(0==strcmp(data->CIF.servicetype, + "urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1")) + { + desc[i].is_igd = 1; + n_igd++; } + } + } + /* iterate the list to find a device depending on state */ + for(state = 1; state <= 3; state++) + { + for(dev = devlist, i = 0; dev; dev = dev->pNext, i++) + { if(desc[i].xml) { memset(data, 0, sizeof(struct IGDdatas)); memset(urls, 0, sizeof(struct UPNPUrls)); parserootdesc(desc[i].xml, desc[i].size, data); - if(0==strcmp(data->CIF.servicetype, - "urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1") - || state >= 3 ) + if(desc[i].is_igd || state >= 3 ) { GetUPNPUrls(urls, data, dev->descURL, dev->scope_id); + /* in state 2 and 3 we dont test if device is connected ! */ + if(state >= 2) + goto free_and_return; #ifdef DEBUG printf("UPNPIGD_IsConnected(%s) = %d\n", urls->controlURL, UPNPIGD_IsConnected(urls, data)); #endif - if((state >= 2) || UPNPIGD_IsConnected(urls, data)) + /* checks that status is connected AND there is a external IP address assigned */ + if(UPNPIGD_IsConnected(urls, data) + && (UPNP_GetExternalIPAddress(urls->controlURL, data->first.servicetype, extIpAddr) == 0)) goto free_and_return; FreeUPNPUrls(urls); if(data->second.servicetype[0] != '\0') { @@ -952,7 +992,8 @@ urls->controlURL, UPNPIGD_IsConnected(urls, data)); #endif - if((state >= 2) || UPNPIGD_IsConnected(urls, data)) + if(UPNPIGD_IsConnected(urls, data) + && (UPNP_GetExternalIPAddress(urls->controlURL, data->first.servicetype, extIpAddr) == 0)) goto free_and_return; FreeUPNPUrls(urls); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/miniupnpc.def new/miniupnpc-1.9/miniupnpc.def --- old/miniupnpc-1.8/miniupnpc.def 2011-04-18 22:05:37.000000000 +0200 +++ new/miniupnpc-1.9/miniupnpc.def 2014-01-31 14:18:57.000000000 +0100 @@ -1,5 +1,6 @@ LIBRARY ; miniupnpc library + miniupnpc EXPORTS ; miniupnpc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/miniupnpc.h new/miniupnpc-1.9/miniupnpc.h --- old/miniupnpc-1.8/miniupnpc.h 2013-02-06 15:30:27.000000000 +0100 +++ new/miniupnpc-1.9/miniupnpc.h 2014-01-31 14:57:30.000000000 +0100 @@ -1,4 +1,4 @@ -/* $Id: miniupnpc.h,v 1.31 2012/09/27 15:42:10 nanard Exp $ */ +/* $Id: miniupnpc.h,v 1.35 2014/01/31 13:26:34 nanard Exp $ */ /* Project: miniupnp * http://miniupnp.free.fr/ * Author: Thomas Bernard @@ -18,8 +18,8 @@ #define UPNPDISCOVER_MEMORY_ERROR (-102) /* versions : */ -#define MINIUPNPC_VERSION "1.8" -#define MINIUPNPC_API_VERSION 9 +#define MINIUPNPC_VERSION "1.9" +#define MINIUPNPC_API_VERSION 10 #ifdef __cplusplus extern "C" { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/miniupnpcmodule.c new/miniupnpc-1.9/miniupnpcmodule.c --- old/miniupnpc-1.8/miniupnpcmodule.c 2012-08-30 10:15:18.000000000 +0200 +++ new/miniupnpc-1.9/miniupnpcmodule.c 2014-01-31 14:18:58.000000000 +0100 @@ -1,8 +1,8 @@ -/* $Id: miniupnpcmodule.c,v 1.21 2012/08/29 07:51:30 nanard Exp $*/ +/* $Id: miniupnpcmodule.c,v 1.22 2014/01/31 13:18:25 nanard Exp $*/ /* Project : miniupnp * Author : Thomas BERNARD * website : http://miniupnp.tuxfamily.org/ - * copyright (c) 2007-2012 Thomas Bernard + * copyright (c) 2007-2014 Thomas Bernard * This software is subjet to the conditions detailed in the * provided LICENCE file. */ #include <Python.h> @@ -310,7 +310,7 @@ } } -/* GetSpecificPortMapping(ePort, proto) +/* GetSpecificPortMapping(ePort, proto, remoteHost='') * proto = 'UDP' or 'TCP' */ static PyObject * UPnP_getspecificportmapping(UPnPObject *self, PyObject *args) @@ -318,13 +318,14 @@ char extPort[6]; unsigned short ePort; const char * proto; + const char * remoteHost = ""; char intClient[40]; char intPort[6]; unsigned short iPort; char desc[80]; char enabled[4]; char leaseDuration[16]; - if(!PyArg_ParseTuple(args, "Hs", &ePort, &proto)) + if(!PyArg_ParseTuple(args, "Hs|z", &ePort, &proto, &remoteHost)) return NULL; extPort[0] = '\0'; intClient[0] = '\0'; intPort[0] = '\0'; desc[0] = '\0'; enabled[0] = '\0'; leaseDuration[0] = '\0'; @@ -332,7 +333,7 @@ sprintf(extPort, "%hu", ePort); UPNP_GetSpecificPortMappingEntry(self->urls.controlURL, self->data.first.servicetype, - extPort, proto, + extPort, proto, remoteHost, intClient, intPort, desc, enabled, leaseDuration); Py_END_ALLOW_THREADS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/miniwget.c new/miniupnpc-1.9/miniwget.c --- old/miniupnpc-1.8/miniwget.c 2012-08-21 19:11:41.000000000 +0200 +++ new/miniupnpc-1.9/miniwget.c 2013-10-07 12:07:43.000000000 +0200 @@ -1,8 +1,8 @@ -/* $Id: miniwget.c,v 1.58 2012/08/11 05:52:49 nanard Exp $ */ +/* $Id: miniwget.c,v 1.60 2013/10/07 10:03:16 nanard Exp $ */ /* Project : miniupnp * Website : http://miniupnp.free.fr/ * Author : Thomas Bernard - * Copyright (c) 2005-2012 Thomas Bernard + * Copyright (c) 2005-2013 Thomas Bernard * This software is subject to the conditions detailed in the * LICENCE file provided in this distribution. */ @@ -52,6 +52,10 @@ #include "connecthostport.h" #include "receivedata.h" +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 64 +#endif + /* * Read a HTTP response from a socket. * Process Content-Length and Transfer-encoding headers. @@ -158,7 +162,7 @@ chunked = 1; } } - while(header_buf[i]=='\r' || header_buf[i] == '\n') + while((i < (int)header_buf_used) && (header_buf[i]=='\r' || header_buf[i] == '\n')) i++; linestart = i; colon = linestart; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/receivedata.c new/miniupnpc-1.9/receivedata.c --- old/miniupnpc-1.8/receivedata.c 2012-06-26 01:48:58.000000000 +0200 +++ new/miniupnpc-1.9/receivedata.c 2013-10-07 12:07:43.000000000 +0200 @@ -1,4 +1,4 @@ -/* $Id: receivedata.c,v 1.4 2012/06/23 22:34:47 nanard Exp $ */ +/* $Id: receivedata.c,v 1.5 2013/10/07 09:48:36 nanard Exp $ */ /* Project : miniupnp * Website : http://miniupnp.free.fr/ * Author : Thomas Bernard @@ -40,7 +40,12 @@ int timeout, unsigned int * scope_id) { #if MINIUPNPC_GET_SRC_ADDR +#ifdef DEBUG + /* to shut up valgrind about uninit value */ + struct sockaddr_storage src_addr = {0}; +#else struct sockaddr_storage src_addr; +#endif socklen_t src_addr_len = sizeof(src_addr); #endif int n; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/testminiwget.sh new/miniupnpc-1.9/testminiwget.sh --- old/miniupnpc-1.8/testminiwget.sh 2013-01-28 11:10:25.000000000 +0100 +++ new/miniupnpc-1.9/testminiwget.sh 2013-11-26 09:48:04.000000000 +0100 @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: testminiwget.sh,v 1.7 2012/10/16 16:49:40 nanard Exp $ +# $Id: testminiwget.sh,v 1.10 2013/11/13 15:08:08 nanard Exp $ # project miniupnp : http://miniupnp.free.fr/ # (c) 2011-2012 Thomas Bernard # @@ -13,12 +13,12 @@ # 4 - kills the local HTTP server and exits # # The script was tested and works with ksh, bash -# It fails to run with dash 0.5.5.1 because of "kill %1" +# it should now also run with dash -TMPDIR=`mktemp -d` -HTTPSERVEROUT="${TMPDIR}/httpserverout" -EXPECTEDFILE="${TMPDIR}/expectedfile" -DOWNLOADEDFILE="${TMPDIR}/downloadedfile" +TMPD=`mktemp -d miniwgetXXXXXXXXXX` +HTTPSERVEROUT="${TMPD}/httpserverout" +EXPECTEDFILE="${TMPD}/expectedfile" +DOWNLOADEDFILE="${TMPD}/downloadedfile" PORT= RET=0 @@ -39,6 +39,7 @@ # launching the test HTTP server ./minihttptestserver $SERVERARGS -e $EXPECTEDFILE > $HTTPSERVEROUT & +SERVERPID=$! while [ -z "$PORT" ]; do sleep 1 PORT=`cat $HTTPSERVEROUT | sed 's/Listening on port \([0-9]*\)/\1/' ` @@ -77,8 +78,8 @@ fi # kill the test HTTP server -kill %1 -wait %1 +kill $SERVERPID +wait $SERVERPID # remove temporary files (for success cases) if [ $RET -eq 0 ]; then @@ -86,10 +87,10 @@ rm -f "${DOWNLOADEDFILE}.2" rm -f "${DOWNLOADEDFILE}.3" rm -f $EXPECTEDFILE $HTTPSERVEROUT - rmdir ${TMPDIR} + rmdir ${TMPD} else echo "at least one of the test FAILED" - echo "directory ${TMPDIR} is left intact" + echo "directory ${TMPD} is left intact" fi exit $RET diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/testminixml.c new/miniupnpc-1.9/testminixml.c --- old/miniupnpc-1.8/testminixml.c 2012-03-05 21:37:12.000000000 +0100 +++ new/miniupnpc-1.9/testminixml.c 2013-05-14 22:41:40.000000000 +0200 @@ -1,8 +1,8 @@ -/* $Id: testminixml.c,v 1.8 2012/03/05 19:42:47 nanard Exp $ +/* $Id: testminixml.c,v 1.9 2013/05/14 19:50:49 nanard Exp $ * MiniUPnP project * Website : http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ * Author : Thomas Bernard. - * Copyright (c) 2005-2012 Thomas Bernard + * Copyright (c) 2005-2013 Thomas Bernard * * testminixml.c * test program for the "minixml" functions. @@ -17,6 +17,7 @@ void printeltname1(void * d, const char * name, int l) { int i; + (void)d; printf("element "); for(i=0;i<l;i++) putchar(name[i]); @@ -24,6 +25,7 @@ void printeltname2(void * d, const char * name, int l) { int i; + (void)d; putchar('/'); for(i=0;i<l;i++) putchar(name[i]); @@ -32,6 +34,7 @@ void printdata(void *d, const char * data, int l) { int i; + (void)d; printf("data : "); for(i=0;i<l;i++) putchar(data[i]); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/testreplyparse/DeletePortMapping.namevalue new/miniupnpc-1.9/testreplyparse/DeletePortMapping.namevalue --- old/miniupnpc-1.8/testreplyparse/DeletePortMapping.namevalue 1970-01-01 01:00:00.000000000 +0100 +++ new/miniupnpc-1.9/testreplyparse/DeletePortMapping.namevalue 2013-05-14 22:34:33.000000000 +0200 @@ -0,0 +1,3 @@ +NewRemoteHost= +NewExternalPort=123 +NewProtocol=TCP diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/testreplyparse/DeletePortMapping.xml new/miniupnpc-1.9/testreplyparse/DeletePortMapping.xml --- old/miniupnpc-1.8/testreplyparse/DeletePortMapping.xml 1970-01-01 01:00:00.000000000 +0100 +++ new/miniupnpc-1.9/testreplyparse/DeletePortMapping.xml 2013-05-14 22:34:33.000000000 +0200 @@ -0,0 +1,6 @@ +<?xml version="1.0"?> +<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:DeletePortMapping xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1"><NewRemoteHost></NewRemoteHost><NewExternalPort>123</NewExternalPort> +<NewProtocol>TCP</NewProtocol></u:DeletePortMapping></s:Body> + +</s:Envelope> + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/testreplyparse/GetExternalIPAddress.namevalue new/miniupnpc-1.9/testreplyparse/GetExternalIPAddress.namevalue --- old/miniupnpc-1.8/testreplyparse/GetExternalIPAddress.namevalue 1970-01-01 01:00:00.000000000 +0100 +++ new/miniupnpc-1.9/testreplyparse/GetExternalIPAddress.namevalue 2013-05-14 22:34:33.000000000 +0200 @@ -0,0 +1,2 @@ +NewExternalIPAddress=1.2.3.4 + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/testreplyparse/GetExternalIPAddress.xml new/miniupnpc-1.9/testreplyparse/GetExternalIPAddress.xml --- old/miniupnpc-1.8/testreplyparse/GetExternalIPAddress.xml 1970-01-01 01:00:00.000000000 +0100 +++ new/miniupnpc-1.9/testreplyparse/GetExternalIPAddress.xml 2013-05-14 22:34:33.000000000 +0200 @@ -0,0 +1,2 @@ +<?xml version="1.0"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetExternalIPAddressResponse xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1"><NewExternalIPAddress>1.2.3.4</NewExternalIPAddress></u:GetExternalIPAddressResponse></s:Body></s:Envelope> + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/testreplyparse/GetSpecificPortMappingEntryReq.namevalue new/miniupnpc-1.9/testreplyparse/GetSpecificPortMappingEntryReq.namevalue --- old/miniupnpc-1.8/testreplyparse/GetSpecificPortMappingEntryReq.namevalue 1970-01-01 01:00:00.000000000 +0100 +++ new/miniupnpc-1.9/testreplyparse/GetSpecificPortMappingEntryReq.namevalue 2014-01-27 12:44:11.000000000 +0100 @@ -0,0 +1,3 @@ +NewProtocol=UDP +NewExternalPort=12345 +NewRemoteHost= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/testreplyparse/GetSpecificPortMappingEntryReq.xml new/miniupnpc-1.9/testreplyparse/GetSpecificPortMappingEntryReq.xml --- old/miniupnpc-1.8/testreplyparse/GetSpecificPortMappingEntryReq.xml 1970-01-01 01:00:00.000000000 +0100 +++ new/miniupnpc-1.9/testreplyparse/GetSpecificPortMappingEntryReq.xml 2014-01-27 12:44:11.000000000 +0100 @@ -0,0 +1,3 @@ +<?xml version="1.0"?> +<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetSpecificPortMappingEntry xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1"><NewRemoteHost></NewRemoteHost><NewExternalPort>12345</NewExternalPort><NewProtocol>UDP</NewProtocol></u:GetSpecificPortMappingEntry></s:Body></s:Envelope> + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/testreplyparse/GetSpecificPortMappingEntryResp.namevalue new/miniupnpc-1.9/testreplyparse/GetSpecificPortMappingEntryResp.namevalue --- old/miniupnpc-1.8/testreplyparse/GetSpecificPortMappingEntryResp.namevalue 1970-01-01 01:00:00.000000000 +0100 +++ new/miniupnpc-1.9/testreplyparse/GetSpecificPortMappingEntryResp.namevalue 2014-01-27 12:44:11.000000000 +0100 @@ -0,0 +1,5 @@ +NewInternalPort=12345 +NewInternalClient=192.168.10.110 +NewEnabled=1 +NewPortMappingDescription=libminiupnpc +NewLeaseDuration=0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/testreplyparse/GetSpecificPortMappingEntryResp.xml new/miniupnpc-1.9/testreplyparse/GetSpecificPortMappingEntryResp.xml --- old/miniupnpc-1.8/testreplyparse/GetSpecificPortMappingEntryResp.xml 1970-01-01 01:00:00.000000000 +0100 +++ new/miniupnpc-1.9/testreplyparse/GetSpecificPortMappingEntryResp.xml 2014-01-27 12:44:11.000000000 +0100 @@ -0,0 +1,2 @@ +<?xml version="1.0"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetSpecificPortMappingEntryResponse xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1"><NewInternalPort>12345</NewInternalPort><NewInternalClient>192.168.10.110</NewInternalClient><NewEnabled>1</NewEnabled><NewPortMappingDescription>libminiupnpc</NewPortMappingDescription><NewLeaseDuration>0</NewLeaseDuration></u:GetSpecificPortMappingEntryResponse></s:Body></s:Envelope> + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/testreplyparse/SetDefaultConnectionService.namevalue new/miniupnpc-1.9/testreplyparse/SetDefaultConnectionService.namevalue --- old/miniupnpc-1.8/testreplyparse/SetDefaultConnectionService.namevalue 1970-01-01 01:00:00.000000000 +0100 +++ new/miniupnpc-1.9/testreplyparse/SetDefaultConnectionService.namevalue 2013-06-06 23:29:32.000000000 +0200 @@ -0,0 +1 @@ +NewDefaultConnectionService=uuid:c6c05a33-f704-48df-9910-e099b3471d81:WANConnectionDevice:1,INVALID_SERVICE_ID diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/testreplyparse/SetDefaultConnectionService.xml new/miniupnpc-1.9/testreplyparse/SetDefaultConnectionService.xml --- old/miniupnpc-1.8/testreplyparse/SetDefaultConnectionService.xml 1970-01-01 01:00:00.000000000 +0100 +++ new/miniupnpc-1.9/testreplyparse/SetDefaultConnectionService.xml 2013-06-06 23:29:32.000000000 +0200 @@ -0,0 +1 @@ +<?xml version="1.0" encoding="utf-8"?><s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><u:SetDefaultConnectionService xmlns:u="urn:schemas-upnp-org:service:Layer3Forwarding:1"><NewDefaultConnectionService>uuid:c6c05a33-f704-48df-9910-e099b3471d81:WANConnectionDevice:1,INVALID_SERVICE_ID</NewDefaultConnectionService></u:SetDefaultConnectionService></s:Body></s:Envelope> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/testreplyparse/readme.txt new/miniupnpc-1.9/testreplyparse/readme.txt --- old/miniupnpc-1.8/testreplyparse/readme.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/miniupnpc-1.9/testreplyparse/readme.txt 2013-05-14 22:34:33.000000000 +0200 @@ -0,0 +1,7 @@ +This directory contains files used for validation of upnpreplyparse.c code. + +Each .xml file to parse should give the results which are in the .namevalue +file. + +A .namevalue file contain name=value lines. + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/testupnpreplyparse.c new/miniupnpc-1.9/testupnpreplyparse.c --- old/miniupnpc-1.8/testupnpreplyparse.c 2008-02-21 14:13:06.000000000 +0100 +++ new/miniupnpc-1.9/testupnpreplyparse.c 2014-01-31 14:18:58.000000000 +0100 @@ -1,19 +1,55 @@ -/* $Id: testupnpreplyparse.c,v 1.2 2008/02/21 13:05:27 nanard Exp $ */ +/* $Id: testupnpreplyparse.c,v 1.4 2014/01/27 11:45:19 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2007 Thomas Bernard + * (c) 2006-2014 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ #include <stdio.h> +#include <string.h> #include <stdlib.h> #include "upnpreplyparse.h" -void -test_parsing(const char * buf, int len) +int +test_parsing(const char * buf, int len, FILE * f) { + char line[1024]; struct NameValueParserData pdata; + int ok = 1; ParseNameValue(buf, len, &pdata); + /* check result */ + if(f != NULL) + { + while(fgets(line, sizeof(line), f)) + { + char * value; + char * equal; + char * parsedvalue; + int l; + l = strlen(line); + while((l > 0) && ((line[l-1] == '\r') || (line[l-1] == '\n'))) + line[--l] = '\0'; + /* skip empty lines */ + if(l == 0) + continue; + equal = strchr(line, '='); + if(equal == NULL) + { + fprintf(stderr, "Warning, line does not contain '=' : %s\n", line); + continue; + } + *equal = '\0'; + value = equal + 1; + parsedvalue = GetValueFromNameValueList(&pdata, line); + if((parsedvalue == NULL) || (strcmp(parsedvalue, value) != 0)) + { + fprintf(stderr, "Element <%s> : expecting value '%s', got '%s'\n", + line, value, parsedvalue ? parsedvalue : "<null string>"); + ok = 0; + } + } + } ClearNameValueList(&pdata); + return ok; } int main(int argc, char * * argv) @@ -21,9 +57,11 @@ FILE * f; char buffer[4096]; int l; + int ok; + if(argc<2) { - fprintf(stderr, "Usage: %s file.xml\n", argv[0]); + fprintf(stderr, "Usage: %s file.xml [file.namevalues]\n", argv[0]); return 1; } f = fopen(argv[1], "r"); @@ -34,11 +72,25 @@ } l = fread(buffer, 1, sizeof(buffer)-1, f); fclose(f); + f = NULL; buffer[l] = '\0'; + if(argc > 2) + { + f = fopen(argv[2], "r"); + if(!f) + { + fprintf(stderr, "Error : can not open file %s\n", argv[2]); + return 2; + } + } #ifdef DEBUG DisplayNameValueList(buffer, l); #endif - test_parsing(buffer, l); - return 0; + ok = test_parsing(buffer, l, f); + if(f) + { + fclose(f); + } + return ok ? 0 : 3; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/testupnpreplyparse.sh new/miniupnpc-1.9/testupnpreplyparse.sh --- old/miniupnpc-1.8/testupnpreplyparse.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/miniupnpc-1.9/testupnpreplyparse.sh 2013-05-14 22:37:36.000000000 +0200 @@ -0,0 +1,14 @@ +#!/bin/sh + +for f in testreplyparse/*.xml ; do + bf="`dirname $f`/`basename $f .xml`" + if ./testupnpreplyparse $f $bf.namevalue ; then + echo "$f : passed" + else + echo "$f : FAILED" + exit 1 + fi +done + +exit 0 + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/upnpc.c new/miniupnpc-1.9/upnpc.c --- old/miniupnpc-1.8/upnpc.c 2013-02-06 14:14:42.000000000 +0100 +++ new/miniupnpc-1.9/upnpc.c 2014-01-31 14:18:58.000000000 +0100 @@ -1,4 +1,4 @@ -/* $Id: upnpc.c,v 1.99 2013/02/06 12:56:41 nanard Exp $ */ +/* $Id: upnpc.c,v 1.101 2014/01/31 13:18:25 nanard Exp $ */ /* Project : miniupnp * Author : Thomas Bernard * Copyright (c) 2005-2013 Thomas Bernard @@ -266,7 +266,7 @@ r = UPNP_GetSpecificPortMappingEntry(urls->controlURL, data->first.servicetype, - eport, proto, + eport, proto, NULL/*remoteHost*/, intClient, intPort, NULL/*desc*/, NULL/*enabled*/, duration); if(r!=UPNPCOMMAND_SUCCESS) @@ -506,6 +506,11 @@ /* command line processing */ for(i=1; i<argc; i++) { + if(0 == strcmp(argv[i], "--help") || 0 == strcmp(argv[i], "-h")) + { + command = 0; + break; + } if(argv[i][0] == '-') { if(argv[i][1] == 'u') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/upnpcommands.c new/miniupnpc-1.9/upnpcommands.c --- old/miniupnpc-1.8/upnpcommands.c 2012-06-26 01:48:58.000000000 +0200 +++ new/miniupnpc-1.9/upnpcommands.c 2014-01-31 14:18:58.000000000 +0100 @@ -1,4 +1,4 @@ -/* $Id: upnpcommands.c,v 1.40 2012/06/23 22:36:35 nanard Exp $ */ +/* $Id: upnpcommands.c,v 1.42 2014/01/31 13:18:25 nanard Exp $ */ /* Project : miniupnp * Author : Thomas Bernard * Copyright (c) 2005-2012 Thomas Bernard @@ -578,7 +578,8 @@ UPNP_GetSpecificPortMappingEntry(const char * controlURL, const char * servicetype, const char * extPort, - const char * proto, + const char * proto, + const char * remoteHost, char * intClient, char * intPort, char * desc, @@ -597,7 +598,7 @@ GetPortMappingArgs = calloc(4, sizeof(struct UPNParg)); GetPortMappingArgs[0].elt = "NewRemoteHost"; - /* TODO : add remote host ? */ + GetPortMappingArgs[0].val = remoteHost; GetPortMappingArgs[1].elt = "NewExternalPort"; GetPortMappingArgs[1].val = extPort; GetPortMappingArgs[2].elt = "NewProtocol"; @@ -759,7 +760,7 @@ char * fe, *ipa, *p; int ret = UPNPCOMMAND_UNKNOWN_ERROR; - if(!firewallEnabled && !inboundPinholeAllowed) + if(!firewallEnabled || !inboundPinholeAllowed) return UPNPCOMMAND_INVALID_ARGS; buffer = simpleUPnPcommand(-1, controlURL, servicetype, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/upnpcommands.h new/miniupnpc-1.9/upnpcommands.h --- old/miniupnpc-1.8/upnpcommands.h 2012-10-05 00:34:08.000000000 +0200 +++ new/miniupnpc-1.9/upnpcommands.h 2014-01-31 14:18:58.000000000 +0100 @@ -1,4 +1,4 @@ -/* $Id: upnpcommands.h,v 1.25 2012/09/27 15:42:10 nanard Exp $ */ +/* $Id: upnpcommands.h,v 1.26 2014/01/31 13:18:26 nanard Exp $ */ /* Miniupnp project : http://miniupnp.free.fr/ * Author : Thomas Bernard * Copyright (c) 2005-2011 Thomas Bernard @@ -150,6 +150,7 @@ * params : * in extPort * in proto + * in remoteHost * out intClient (16 bytes) * out intPort (6 bytes) * out desc (80 bytes) @@ -164,6 +165,7 @@ const char * servicetype, const char * extPort, const char * proto, + const char * remoteHost, char * intClient, char * intPort, char * desc, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/upnpreplyparse.c new/miniupnpc-1.9/upnpreplyparse.c --- old/miniupnpc-1.8/upnpreplyparse.c 2012-03-05 21:37:12.000000000 +0100 +++ new/miniupnpc-1.9/upnpreplyparse.c 2013-06-07 10:44:40.000000000 +0200 @@ -1,7 +1,7 @@ -/* $Id: upnpreplyparse.c,v 1.12 2012/03/05 19:42:48 nanard Exp $ */ +/* $Id: upnpreplyparse.c,v 1.15 2013/06/06 21:36:40 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2011 Thomas Bernard + * (c) 2006-2013 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -15,18 +15,55 @@ static void NameValueParserStartElt(void * d, const char * name, int l) { - struct NameValueParserData * data = (struct NameValueParserData *)d; + struct NameValueParserData * data = (struct NameValueParserData *)d; + data->topelt = 1; if(l>63) l = 63; memcpy(data->curelt, name, l); data->curelt[l] = '\0'; + data->cdata = NULL; + data->cdatalen = 0; } static void -NameValueParserGetData(void * d, const char * datas, int l) +NameValueParserEndElt(void * d, const char * name, int l) { struct NameValueParserData * data = (struct NameValueParserData *)d; struct NameValue * nv; + (void)name; + (void)l; + if(!data->topelt) + return; + if(strcmp(data->curelt, "NewPortListing") != 0) + { + int l; + /* standard case. Limited to n chars strings */ + l = data->cdatalen; + nv = malloc(sizeof(struct NameValue)); + if(l>=(int)sizeof(nv->value)) + l = sizeof(nv->value) - 1; + strncpy(nv->name, data->curelt, 64); + nv->name[63] = '\0'; + if(data->cdata != NULL) + { + memcpy(nv->value, data->cdata, l); + nv->value[l] = '\0'; + } + else + { + nv->value[0] = '\0'; + } + LIST_INSERT_HEAD( &(data->head), nv, entries); + } + data->cdata = NULL; + data->cdatalen = 0; + data->topelt = 0; +} + +static void +NameValueParserGetData(void * d, const char * datas, int l) +{ + struct NameValueParserData * data = (struct NameValueParserData *)d; if(strcmp(data->curelt, "NewPortListing") == 0) { /* specific case for NewPortListing which is a XML Document */ @@ -42,15 +79,9 @@ } else { - /* standard case. Limited to 63 chars strings */ - nv = malloc(sizeof(struct NameValue)); - if(l>63) - l = 63; - strncpy(nv->name, data->curelt, 64); - nv->name[63] = '\0'; - memcpy(nv->value, datas, l); - nv->value[l] = '\0'; - LIST_INSERT_HEAD( &(data->head), nv, entries); + /* standard case. */ + data->cdata = datas; + data->cdatalen = l; } } @@ -67,7 +98,7 @@ parser.xmlsize = bufsize; parser.data = data; parser.starteltfunc = NameValueParserStartElt; - parser.endeltfunc = 0; + parser.endeltfunc = NameValueParserEndElt; parser.datafunc = NameValueParserGetData; parser.attfunc = 0; parsexml(&parser); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/miniupnpc-1.8/upnpreplyparse.h new/miniupnpc-1.9/upnpreplyparse.h --- old/miniupnpc-1.8/upnpreplyparse.h 2012-10-05 00:34:08.000000000 +0200 +++ new/miniupnpc-1.9/upnpreplyparse.h 2013-06-07 10:44:40.000000000 +0200 @@ -1,7 +1,7 @@ -/* $Id: upnpreplyparse.h,v 1.14 2012/09/27 15:42:11 nanard Exp $ */ +/* $Id: upnpreplyparse.h,v 1.17 2013/06/06 21:36:40 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2012 Thomas Bernard + * (c) 2006-2013 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -21,7 +21,7 @@ struct NameValue { LIST_ENTRY(NameValue) entries; char name[64]; - char value[64]; + char value[128]; }; struct NameValueParserData { @@ -29,6 +29,9 @@ char curelt[64]; char * portListing; int portListingLength; + int topelt; + const char * cdata; + int cdatalen; }; /* ParseNameValue() */ @@ -45,10 +48,12 @@ GetValueFromNameValueList(struct NameValueParserData * pdata, const char * Name); +#if 0 /* GetValueFromNameValueListIgnoreNS() */ char * GetValueFromNameValueListIgnoreNS(struct NameValueParserData * pdata, const char * Name); +#endif /* DisplayNameValueList() */ #ifdef DEBUG -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org