miniupnpc 2.3.1__tar.gz → 2.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/Makefile +4 -3
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/PKG-INFO +1 -1
- miniupnpc-2.3.2/VERSION +1 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/include/miniupnpc.h +3 -3
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/include/miniupnpctypes.h +1 -6
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/include/miniwget.h +0 -25
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/include/upnpreplyparse.h +2 -9
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/miniupnpc.egg-info/PKG-INFO +1 -1
- miniupnpc-2.3.2/src/miniwget_private.h +54 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/upnpcommands.c +56 -51
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/upnpreplyparse.c +18 -3
- miniupnpc-2.3.1/VERSION +0 -1
- miniupnpc-2.3.1/src/miniwget_private.h +0 -15
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/DESCRIPTION +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/LICENSE +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/MANIFEST.in +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/README +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/external-ip.sh +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/include/igd_desc_parse.h +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/include/miniupnpc_declspec.h +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/include/portlistingparse.h +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/include/upnpcommands.h +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/include/upnpdev.h +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/include/upnperrors.h +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/miniupnpc.egg-info/SOURCES.txt +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/miniupnpc.egg-info/dependency_links.txt +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/miniupnpc.egg-info/top_level.txt +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/miniupnpcstrings.h.in +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/setup.cfg +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/setup.py +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/setupmingw32.py +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/addr_is_reserved.c +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/addr_is_reserved.h +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/codelength.h +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/connecthostport.c +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/connecthostport.h +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/igd_desc_parse.c +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/listdevices.c +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/minihttptestserver.c +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/minisoap.c +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/minisoap.h +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/minissdpc.c +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/minissdpc.h +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/miniupnpc.c +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/miniupnpc_socketdef.h +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/miniupnpcmodule.c +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/miniwget.c +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/minixml.c +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/minixml.h +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/minixmlvalid.c +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/portlistingparse.c +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/receivedata.c +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/receivedata.h +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/testaddr_is_reserved.c +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/testigddescparse.c +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/testminiwget.c +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/testminixml.c +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/testportlistingparse.c +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/testupnpreplyparse.c +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/upnpc.c +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/upnpdev.c +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/upnperrors.c +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/src/win32_snprintf.h +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/testminiwget.sh +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/testupnpreplyparse.sh +0 -0
- {miniupnpc-2.3.1 → miniupnpc-2.3.2}/updateminiupnpcstrings.sh +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# $Id: Makefile,v 1.
|
|
1
|
+
# $Id: Makefile,v 1.155 2025/03/02 01:17:19 nanard Exp $
|
|
2
2
|
# MiniUPnP Project
|
|
3
3
|
# http://miniupnp.free.fr/
|
|
4
4
|
# https://miniupnp.tuxfamily.org/
|
|
@@ -84,9 +84,10 @@ ifneq (, $(findstring sun, $(OS))$(findstring solaris, $(OS)))
|
|
|
84
84
|
endif
|
|
85
85
|
|
|
86
86
|
# APIVERSION is used to build SONAME
|
|
87
|
-
APIVERSION =
|
|
87
|
+
APIVERSION = 20
|
|
88
88
|
|
|
89
89
|
SRCS = $(wildcard $(SRCDIR)/*.c)
|
|
90
|
+
PRIVATE_HEADERS = $(wildcard $(SRCDIR)/*.h)
|
|
90
91
|
|
|
91
92
|
LIBOBJS = $(addprefix $(BUILD)/,miniwget.o minixml.o igd_desc_parse.o minisoap.o \
|
|
92
93
|
miniupnpc.o upnpreplyparse.o upnpcommands.o upnperrors.o \
|
|
@@ -399,7 +400,7 @@ ideb:
|
|
|
399
400
|
|
|
400
401
|
minihttptestserver: minihttptestserver.o
|
|
401
402
|
|
|
402
|
-
doxygen/html/index.html: Doxyfile $(SRCS) $(HEADERS)
|
|
403
|
+
doxygen/html/index.html: Doxyfile $(SRCS) $(HEADERS) $(PRIVATE_HEADERS)
|
|
403
404
|
doxygen
|
|
404
405
|
|
|
405
406
|
print-%:
|
miniupnpc-2.3.2/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.3.2
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* $Id: miniupnpc.h,v 1.
|
|
1
|
+
/* $Id: miniupnpc.h,v 1.76 2025/03/05 10:35:57 nanard Exp $ */
|
|
2
2
|
/* vim: tabstop=4 shiftwidth=4 noexpandtab
|
|
3
3
|
* Project: miniupnp
|
|
4
4
|
* http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
#define UPNPDISCOVER_MEMORY_ERROR (-102)
|
|
43
43
|
|
|
44
44
|
/*! \brief software version */
|
|
45
|
-
#define MINIUPNPC_VERSION "2.3.
|
|
45
|
+
#define MINIUPNPC_VERSION "2.3.2"
|
|
46
46
|
/*! \brief C API version */
|
|
47
|
-
#define MINIUPNPC_API_VERSION
|
|
47
|
+
#define MINIUPNPC_API_VERSION 20
|
|
48
48
|
|
|
49
49
|
/*! \brief any (ie system chosen) port */
|
|
50
50
|
#define UPNP_LOCAL_PORT_ANY 0
|
|
@@ -14,19 +14,14 @@
|
|
|
14
14
|
* Use unsigned long long when available :
|
|
15
15
|
* strtoull is C99
|
|
16
16
|
*
|
|
17
|
-
* \def STRTOUI
|
|
18
|
-
* \brief strtoull() if available, strtol() if not
|
|
19
|
-
* \todo should not be in the public API
|
|
20
17
|
* \def UNSIGNED_INTEGER
|
|
21
18
|
* \brief `unsigned long long` or `unsigned int`
|
|
19
|
+
* \todo int can be 16 bits, so it should be `unsigned long`
|
|
22
20
|
*/
|
|
23
21
|
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
|
24
22
|
#define UNSIGNED_INTEGER unsigned long long
|
|
25
|
-
#define STRTOUI strtoull
|
|
26
23
|
#else
|
|
27
24
|
#define UNSIGNED_INTEGER unsigned int
|
|
28
|
-
#define STRTOUI strtoul
|
|
29
25
|
#endif
|
|
30
26
|
|
|
31
27
|
#endif
|
|
32
|
-
|
|
@@ -47,31 +47,6 @@ MINIUPNP_LIBSPEC void * miniwget_getaddr(const char * url, int * size,
|
|
|
47
47
|
char * addr, int addrlen,
|
|
48
48
|
unsigned int scope_id, int * status_code);
|
|
49
49
|
|
|
50
|
-
/*! \brief parse a HTTP URL
|
|
51
|
-
*
|
|
52
|
-
* URL formats supported :
|
|
53
|
-
* - `http://192.168.1.1/path/xxx`
|
|
54
|
-
* - `http://192.168.1.1:8080/path/xxx`
|
|
55
|
-
* - `http://[2a00:1234:5678:90ab::123]/path/xxx`
|
|
56
|
-
* - `http://[2a00:1234:5678:90ab::123]:8080/path/xxx`
|
|
57
|
-
* - `http://[fe80::1234:5678:90ab%%eth0]/path/xxx`
|
|
58
|
-
* - `http://[fe80::1234:5678:90ab%%eth0]:8080/path/xxx`
|
|
59
|
-
*
|
|
60
|
-
* `%` may be encoded as `%25`
|
|
61
|
-
*
|
|
62
|
-
* \todo should probably not be exposed in the public API
|
|
63
|
-
* \param[in] url URL to parse
|
|
64
|
-
* \param[out] hostname hostname part of the URL (size of MAXHOSTNAMELEN+1)
|
|
65
|
-
* \param[out] port set to the port specified in the URL or 80
|
|
66
|
-
* \param[out] path set to the begining of the path part of the URL
|
|
67
|
-
* \param[out] scope_id set to the interface id if specified in the
|
|
68
|
-
* link-local IPv6 address
|
|
69
|
-
* \return 0 for failure, 1 for success
|
|
70
|
-
*/
|
|
71
|
-
int parseURL(const char * url,
|
|
72
|
-
char * hostname, unsigned short * port, char * * path,
|
|
73
|
-
unsigned int * scope_id);
|
|
74
|
-
|
|
75
50
|
#ifdef __cplusplus
|
|
76
51
|
}
|
|
77
52
|
#endif
|
|
@@ -17,16 +17,9 @@ extern "C" {
|
|
|
17
17
|
#endif
|
|
18
18
|
|
|
19
19
|
/*! \brief Name/Value linked list
|
|
20
|
-
*
|
|
20
|
+
* not exposed in the public API
|
|
21
21
|
*/
|
|
22
|
-
struct NameValue
|
|
23
|
-
/*! \brief pointer to the next element */
|
|
24
|
-
struct NameValue * l_next;
|
|
25
|
-
/*! \brief name */
|
|
26
|
-
char name[64];
|
|
27
|
-
/*! \brief character value */
|
|
28
|
-
char value[128];
|
|
29
|
-
};
|
|
22
|
+
struct NameValue;
|
|
30
23
|
|
|
31
24
|
/*! \brief data structure for parsing */
|
|
32
25
|
struct NameValueParserData {
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/* $Id: miniwget_private.h,v 1.1 2018/04/06 10:17:58 nanard Exp $ */
|
|
2
|
+
/* Project : miniupnp
|
|
3
|
+
* Author : Thomas Bernard
|
|
4
|
+
* Copyright (c) 2018-2025 Thomas Bernard
|
|
5
|
+
* This software is subject to the conditions detailed in the
|
|
6
|
+
* LICENCE file provided in this distribution.
|
|
7
|
+
* */
|
|
8
|
+
#ifndef MINIWGET_INTERNAL_H_INCLUDED
|
|
9
|
+
#define MINIWGET_INTERNAL_H_INCLUDED
|
|
10
|
+
|
|
11
|
+
/*! \file miniwget_private.h
|
|
12
|
+
* \brief Lightweight HTTP client private API
|
|
13
|
+
*/
|
|
14
|
+
#include "miniupnpc_socketdef.h"
|
|
15
|
+
|
|
16
|
+
/*! \brief Read a HTTP response from a socket
|
|
17
|
+
*
|
|
18
|
+
* Processed HTTP headers :
|
|
19
|
+
* - `Content-Length`
|
|
20
|
+
* - `Transfer-encoding`
|
|
21
|
+
* return a pointer to the content buffer, which length is saved
|
|
22
|
+
* to the length parameter.
|
|
23
|
+
* \param[in] s socket
|
|
24
|
+
* \param[out] size returned content buffer size
|
|
25
|
+
* \param[out] status_code HTTP Status code
|
|
26
|
+
* \return malloc'ed content buffer
|
|
27
|
+
*/
|
|
28
|
+
void * getHTTPResponse(SOCKET s, int * size, int * status_code);
|
|
29
|
+
|
|
30
|
+
/*! \brief parse a HTTP URL
|
|
31
|
+
*
|
|
32
|
+
* URL formats supported :
|
|
33
|
+
* - `http://192.168.1.1/path/xxx`
|
|
34
|
+
* - `http://192.168.1.1:8080/path/xxx`
|
|
35
|
+
* - `http://[2a00:1234:5678:90ab::123]/path/xxx`
|
|
36
|
+
* - `http://[2a00:1234:5678:90ab::123]:8080/path/xxx`
|
|
37
|
+
* - `http://[fe80::1234:5678:90ab%%eth0]/path/xxx`
|
|
38
|
+
* - `http://[fe80::1234:5678:90ab%%eth0]:8080/path/xxx`
|
|
39
|
+
*
|
|
40
|
+
* `%` may be encoded as `%25`
|
|
41
|
+
*
|
|
42
|
+
* \param[in] url URL to parse
|
|
43
|
+
* \param[out] hostname hostname part of the URL (size of MAXHOSTNAMELEN+1)
|
|
44
|
+
* \param[out] port set to the port specified in the URL or 80
|
|
45
|
+
* \param[out] path set to the begining of the path part of the URL
|
|
46
|
+
* \param[out] scope_id set to the interface id if specified in the
|
|
47
|
+
* link-local IPv6 address
|
|
48
|
+
* \return 0 for failure, 1 for success
|
|
49
|
+
*/
|
|
50
|
+
int parseURL(const char * url,
|
|
51
|
+
char * hostname, unsigned short * port, char * * path,
|
|
52
|
+
unsigned int * scope_id);
|
|
53
|
+
|
|
54
|
+
#endif
|
|
@@ -14,6 +14,17 @@
|
|
|
14
14
|
#include "portlistingparse.h"
|
|
15
15
|
#include "upnpreplyparse.h"
|
|
16
16
|
|
|
17
|
+
/*! \file upnpcommands.c
|
|
18
|
+
* \brief Internet Gateway Device methods implementations
|
|
19
|
+
* \def STRTOUI
|
|
20
|
+
* \brief strtoull() if available, strtol() if not
|
|
21
|
+
*/
|
|
22
|
+
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
|
23
|
+
#define STRTOUI strtoull
|
|
24
|
+
#else
|
|
25
|
+
#define STRTOUI strtoul
|
|
26
|
+
#endif
|
|
27
|
+
|
|
17
28
|
static UNSIGNED_INTEGER
|
|
18
29
|
my_atoui(const char * s)
|
|
19
30
|
{
|
|
@@ -158,9 +169,7 @@ UPNP_GetStatusInfo(const char * controlURL,
|
|
|
158
169
|
}
|
|
159
170
|
|
|
160
171
|
if(uptime) {
|
|
161
|
-
if(up)
|
|
162
|
-
sscanf(up,"%u",uptime);
|
|
163
|
-
else
|
|
172
|
+
if(!up || sscanf(up,"%u",uptime) != 1)
|
|
164
173
|
*uptime = 0;
|
|
165
174
|
}
|
|
166
175
|
|
|
@@ -174,8 +183,8 @@ UPNP_GetStatusInfo(const char * controlURL,
|
|
|
174
183
|
|
|
175
184
|
p = GetValueFromNameValueList(&pdata, "errorCode");
|
|
176
185
|
if(p) {
|
|
177
|
-
ret
|
|
178
|
-
|
|
186
|
+
if(sscanf(p, "%d", &ret) != 1)
|
|
187
|
+
ret = UPNPCOMMAND_UNKNOWN_ERROR;
|
|
179
188
|
}
|
|
180
189
|
ClearNameValueList(&pdata);
|
|
181
190
|
return ret;
|
|
@@ -214,8 +223,8 @@ UPNP_GetConnectionTypeInfo(const char * controlURL,
|
|
|
214
223
|
connectionType[0] = '\0';
|
|
215
224
|
p = GetValueFromNameValueList(&pdata, "errorCode");
|
|
216
225
|
if(p) {
|
|
217
|
-
ret
|
|
218
|
-
|
|
226
|
+
if(sscanf(p, "%d", &ret) != 1)
|
|
227
|
+
ret = UPNPCOMMAND_UNKNOWN_ERROR;
|
|
219
228
|
}
|
|
220
229
|
ClearNameValueList(&pdata);
|
|
221
230
|
return ret;
|
|
@@ -262,22 +271,18 @@ UPNP_GetLinkLayerMaxBitRates(const char * controlURL,
|
|
|
262
271
|
ret = UPNPCOMMAND_SUCCESS;
|
|
263
272
|
|
|
264
273
|
if(bitrateDown) {
|
|
265
|
-
if(down)
|
|
266
|
-
sscanf(down,"%u",bitrateDown);
|
|
267
|
-
else
|
|
274
|
+
if(!down || sscanf(down,"%u",bitrateDown) != 1)
|
|
268
275
|
*bitrateDown = 0;
|
|
269
276
|
}
|
|
270
277
|
|
|
271
278
|
if(bitrateUp) {
|
|
272
|
-
if(up)
|
|
273
|
-
sscanf(up,"%u",bitrateUp);
|
|
274
|
-
else
|
|
279
|
+
if(!up || sscanf(up,"%u",bitrateUp) != 1)
|
|
275
280
|
*bitrateUp = 0;
|
|
276
281
|
}
|
|
277
282
|
p = GetValueFromNameValueList(&pdata, "errorCode");
|
|
278
283
|
if(p) {
|
|
279
|
-
ret
|
|
280
|
-
|
|
284
|
+
if(sscanf(p, "%d", &ret) != 1)
|
|
285
|
+
ret = UPNPCOMMAND_UNKNOWN_ERROR;
|
|
281
286
|
}
|
|
282
287
|
ClearNameValueList(&pdata);
|
|
283
288
|
return ret;
|
|
@@ -327,8 +332,8 @@ UPNP_GetExternalIPAddress(const char * controlURL,
|
|
|
327
332
|
|
|
328
333
|
p = GetValueFromNameValueList(&pdata, "errorCode");
|
|
329
334
|
if(p) {
|
|
330
|
-
ret
|
|
331
|
-
|
|
335
|
+
if(sscanf(p, "%d", &ret) != 1)
|
|
336
|
+
ret = UPNPCOMMAND_UNKNOWN_ERROR;
|
|
332
337
|
}
|
|
333
338
|
|
|
334
339
|
ClearNameValueList(&pdata);
|
|
@@ -379,8 +384,8 @@ UPNP_AddPortMapping(const char * controlURL, const char * servicetype,
|
|
|
379
384
|
resVal = GetValueFromNameValueList(&pdata, "errorCode");
|
|
380
385
|
if(resVal) {
|
|
381
386
|
/*printf("AddPortMapping errorCode = '%s'\n", resVal); */
|
|
382
|
-
ret
|
|
383
|
-
|
|
387
|
+
if(sscanf(resVal, "%d", &ret) != 1)
|
|
388
|
+
ret = UPNPCOMMAND_UNKNOWN_ERROR;
|
|
384
389
|
} else {
|
|
385
390
|
ret = UPNPCOMMAND_SUCCESS;
|
|
386
391
|
}
|
|
@@ -428,8 +433,8 @@ UPNP_AddAnyPortMapping(const char * controlURL, const char * servicetype,
|
|
|
428
433
|
free(buffer);
|
|
429
434
|
resVal = GetValueFromNameValueList(&pdata, "errorCode");
|
|
430
435
|
if(resVal) {
|
|
431
|
-
ret
|
|
432
|
-
|
|
436
|
+
if(sscanf(resVal, "%d", &ret) != 1)
|
|
437
|
+
ret = UPNPCOMMAND_UNKNOWN_ERROR;
|
|
433
438
|
} else {
|
|
434
439
|
char *p;
|
|
435
440
|
|
|
@@ -478,8 +483,8 @@ UPNP_DeletePortMapping(const char * controlURL, const char * servicetype,
|
|
|
478
483
|
free(buffer);
|
|
479
484
|
resVal = GetValueFromNameValueList(&pdata, "errorCode");
|
|
480
485
|
if(resVal) {
|
|
481
|
-
ret
|
|
482
|
-
|
|
486
|
+
if(sscanf(resVal, "%d", &ret) != 1)
|
|
487
|
+
ret = UPNPCOMMAND_UNKNOWN_ERROR;
|
|
483
488
|
} else {
|
|
484
489
|
ret = UPNPCOMMAND_SUCCESS;
|
|
485
490
|
}
|
|
@@ -520,8 +525,8 @@ UPNP_DeletePortMappingRange(const char * controlURL, const char * servicetype,
|
|
|
520
525
|
free(buffer);
|
|
521
526
|
resVal = GetValueFromNameValueList(&pdata, "errorCode");
|
|
522
527
|
if(resVal) {
|
|
523
|
-
ret
|
|
524
|
-
|
|
528
|
+
if(sscanf(resVal, "%d", &ret) != 1)
|
|
529
|
+
ret = UPNPCOMMAND_UNKNOWN_ERROR;
|
|
525
530
|
} else {
|
|
526
531
|
ret = UPNPCOMMAND_SUCCESS;
|
|
527
532
|
}
|
|
@@ -550,7 +555,7 @@ UPNP_GetGenericPortMappingEntry(const char * controlURL,
|
|
|
550
555
|
char * buffer;
|
|
551
556
|
int bufsize;
|
|
552
557
|
char * p;
|
|
553
|
-
int
|
|
558
|
+
int ret = UPNPCOMMAND_UNKNOWN_ERROR;
|
|
554
559
|
if(!index)
|
|
555
560
|
return UPNPCOMMAND_INVALID_ARGS;
|
|
556
561
|
intClient[0] = '\0';
|
|
@@ -575,7 +580,7 @@ UPNP_GetGenericPortMappingEntry(const char * controlURL,
|
|
|
575
580
|
{
|
|
576
581
|
strncpy(extPort, p, 6);
|
|
577
582
|
extPort[5] = '\0';
|
|
578
|
-
|
|
583
|
+
ret = UPNPCOMMAND_SUCCESS;
|
|
579
584
|
}
|
|
580
585
|
p = GetValueFromNameValueList(&pdata, "NewProtocol");
|
|
581
586
|
if(p && protocol)
|
|
@@ -588,7 +593,7 @@ UPNP_GetGenericPortMappingEntry(const char * controlURL,
|
|
|
588
593
|
{
|
|
589
594
|
strncpy(intClient, p, 16);
|
|
590
595
|
intClient[15] = '\0';
|
|
591
|
-
|
|
596
|
+
ret = 0;
|
|
592
597
|
}
|
|
593
598
|
p = GetValueFromNameValueList(&pdata, "NewInternalPort");
|
|
594
599
|
if(p)
|
|
@@ -616,11 +621,11 @@ UPNP_GetGenericPortMappingEntry(const char * controlURL,
|
|
|
616
621
|
}
|
|
617
622
|
p = GetValueFromNameValueList(&pdata, "errorCode");
|
|
618
623
|
if(p) {
|
|
619
|
-
|
|
620
|
-
|
|
624
|
+
if(sscanf(p, "%d", &ret) != 1)
|
|
625
|
+
ret = UPNPCOMMAND_UNKNOWN_ERROR;
|
|
621
626
|
}
|
|
622
627
|
ClearNameValueList(&pdata);
|
|
623
|
-
return
|
|
628
|
+
return ret;
|
|
624
629
|
}
|
|
625
630
|
|
|
626
631
|
MINIUPNP_LIBSPEC int
|
|
@@ -653,8 +658,8 @@ UPNP_GetPortMappingNumberOfEntries(const char * controlURL,
|
|
|
653
658
|
|
|
654
659
|
p = GetValueFromNameValueList(&pdata, "errorCode");
|
|
655
660
|
if(p) {
|
|
656
|
-
ret
|
|
657
|
-
|
|
661
|
+
if(sscanf(p, "%d", &ret) != 1)
|
|
662
|
+
ret = UPNPCOMMAND_UNKNOWN_ERROR;
|
|
658
663
|
}
|
|
659
664
|
|
|
660
665
|
ClearNameValueList(&pdata);
|
|
@@ -737,8 +742,8 @@ UPNP_GetSpecificPortMappingEntry(const char * controlURL,
|
|
|
737
742
|
|
|
738
743
|
p = GetValueFromNameValueList(&pdata, "errorCode");
|
|
739
744
|
if(p) {
|
|
740
|
-
ret
|
|
741
|
-
|
|
745
|
+
if(sscanf(p, "%d", &ret) != 1)
|
|
746
|
+
ret = UPNPCOMMAND_UNKNOWN_ERROR;
|
|
742
747
|
}
|
|
743
748
|
|
|
744
749
|
ClearNameValueList(&pdata);
|
|
@@ -818,8 +823,8 @@ UPNP_GetListOfPortMappings(const char * controlURL,
|
|
|
818
823
|
|
|
819
824
|
p = GetValueFromNameValueList(&pdata, "errorCode");
|
|
820
825
|
if(p) {
|
|
821
|
-
ret
|
|
822
|
-
|
|
826
|
+
if(sscanf(p, "%d", &ret) != 1)
|
|
827
|
+
ret = UPNPCOMMAND_UNKNOWN_ERROR;
|
|
823
828
|
}
|
|
824
829
|
ClearNameValueList(&pdata);
|
|
825
830
|
|
|
@@ -866,8 +871,8 @@ UPNP_GetFirewallStatus(const char * controlURL,
|
|
|
866
871
|
p = GetValueFromNameValueList(&pdata, "errorCode");
|
|
867
872
|
if(p)
|
|
868
873
|
{
|
|
869
|
-
ret
|
|
870
|
-
|
|
874
|
+
if(sscanf(p, "%d", &ret) != 1)
|
|
875
|
+
ret = UPNPCOMMAND_UNKNOWN_ERROR;
|
|
871
876
|
}
|
|
872
877
|
ClearNameValueList(&pdata);
|
|
873
878
|
return ret;
|
|
@@ -908,8 +913,8 @@ UPNP_GetOutboundPinholeTimeout(const char * controlURL, const char * servicetype
|
|
|
908
913
|
resVal = GetValueFromNameValueList(&pdata, "errorCode");
|
|
909
914
|
if(resVal)
|
|
910
915
|
{
|
|
911
|
-
ret
|
|
912
|
-
|
|
916
|
+
if(sscanf(resVal, "%d", &ret) != 1)
|
|
917
|
+
ret = UPNPCOMMAND_UNKNOWN_ERROR;
|
|
913
918
|
}
|
|
914
919
|
else
|
|
915
920
|
{
|
|
@@ -973,8 +978,8 @@ UPNP_AddPinhole(const char * controlURL, const char * servicetype,
|
|
|
973
978
|
if(resVal)
|
|
974
979
|
{
|
|
975
980
|
/*printf("AddPortMapping errorCode = '%s'\n", resVal);*/
|
|
976
|
-
ret
|
|
977
|
-
|
|
981
|
+
if(sscanf(resVal, "%d", &ret) != 1)
|
|
982
|
+
ret = UPNPCOMMAND_UNKNOWN_ERROR;
|
|
978
983
|
}
|
|
979
984
|
else
|
|
980
985
|
{
|
|
@@ -1013,8 +1018,8 @@ UPNP_UpdatePinhole(const char * controlURL, const char * servicetype,
|
|
|
1013
1018
|
if(resVal)
|
|
1014
1019
|
{
|
|
1015
1020
|
/*printf("AddPortMapping errorCode = '%s'\n", resVal); */
|
|
1016
|
-
ret
|
|
1017
|
-
|
|
1021
|
+
if(sscanf(resVal, "%d", &ret) != 1)
|
|
1022
|
+
ret = UPNPCOMMAND_UNKNOWN_ERROR;
|
|
1018
1023
|
}
|
|
1019
1024
|
else
|
|
1020
1025
|
{
|
|
@@ -1051,8 +1056,8 @@ UPNP_DeletePinhole(const char * controlURL, const char * servicetype, const char
|
|
|
1051
1056
|
resVal = GetValueFromNameValueList(&pdata, "errorCode");
|
|
1052
1057
|
if(resVal)
|
|
1053
1058
|
{
|
|
1054
|
-
ret
|
|
1055
|
-
|
|
1059
|
+
if(sscanf(resVal, "%d", &ret) != 1)
|
|
1060
|
+
ret = UPNPCOMMAND_UNKNOWN_ERROR;
|
|
1056
1061
|
}
|
|
1057
1062
|
else
|
|
1058
1063
|
{
|
|
@@ -1100,8 +1105,8 @@ UPNP_CheckPinholeWorking(const char * controlURL, const char * servicetype,
|
|
|
1100
1105
|
p = GetValueFromNameValueList(&pdata, "errorCode");
|
|
1101
1106
|
if(p)
|
|
1102
1107
|
{
|
|
1103
|
-
ret
|
|
1104
|
-
|
|
1108
|
+
if(sscanf(p, "%d", &ret) != 1)
|
|
1109
|
+
ret = UPNPCOMMAND_UNKNOWN_ERROR;
|
|
1105
1110
|
}
|
|
1106
1111
|
|
|
1107
1112
|
ClearNameValueList(&pdata);
|
|
@@ -1142,8 +1147,8 @@ UPNP_GetPinholePackets(const char * controlURL, const char * servicetype,
|
|
|
1142
1147
|
p = GetValueFromNameValueList(&pdata, "errorCode");
|
|
1143
1148
|
if(p)
|
|
1144
1149
|
{
|
|
1145
|
-
ret
|
|
1146
|
-
|
|
1150
|
+
if(sscanf(p, "%d", &ret) != 1)
|
|
1151
|
+
ret = UPNPCOMMAND_UNKNOWN_ERROR;
|
|
1147
1152
|
}
|
|
1148
1153
|
|
|
1149
1154
|
ClearNameValueList(&pdata);
|
|
@@ -13,6 +13,23 @@
|
|
|
13
13
|
#include "upnpreplyparse.h"
|
|
14
14
|
#include "minixml.h"
|
|
15
15
|
|
|
16
|
+
struct NameValue {
|
|
17
|
+
/*! \brief pointer to the next element */
|
|
18
|
+
struct NameValue * l_next;
|
|
19
|
+
/*! \brief name */
|
|
20
|
+
char name[64];
|
|
21
|
+
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
|
22
|
+
/* C99 flexible array member */
|
|
23
|
+
/*! \brief character value */
|
|
24
|
+
char value[];
|
|
25
|
+
#elif defined(__GNUC__)
|
|
26
|
+
char value[0];
|
|
27
|
+
#else
|
|
28
|
+
/* Fallback to a hack */
|
|
29
|
+
char value[1];
|
|
30
|
+
#endif
|
|
31
|
+
};
|
|
32
|
+
|
|
16
33
|
static void
|
|
17
34
|
NameValueParserStartElt(void * d, const char * name, int l)
|
|
18
35
|
{
|
|
@@ -40,7 +57,7 @@ NameValueParserEndElt(void * d, const char * name, int namelen)
|
|
|
40
57
|
int l;
|
|
41
58
|
/* standard case. Limited to n chars strings */
|
|
42
59
|
l = data->cdatalen;
|
|
43
|
-
nv = malloc(sizeof(struct NameValue));
|
|
60
|
+
nv = malloc(sizeof(struct NameValue) + l + 1);
|
|
44
61
|
if(nv == NULL)
|
|
45
62
|
{
|
|
46
63
|
/* malloc error */
|
|
@@ -50,8 +67,6 @@ NameValueParserEndElt(void * d, const char * name, int namelen)
|
|
|
50
67
|
#endif /* DEBUG */
|
|
51
68
|
return;
|
|
52
69
|
}
|
|
53
|
-
if(l>=(int)sizeof(nv->value))
|
|
54
|
-
l = sizeof(nv->value) - 1;
|
|
55
70
|
strncpy(nv->name, data->curelt, 64);
|
|
56
71
|
nv->name[63] = '\0';
|
|
57
72
|
if(data->cdata != NULL)
|
miniupnpc-2.3.1/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2.3.1
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/* $Id: miniwget_private.h,v 1.1 2018/04/06 10:17:58 nanard Exp $ */
|
|
2
|
-
/* Project : miniupnp
|
|
3
|
-
* Author : Thomas Bernard
|
|
4
|
-
* Copyright (c) 2018 Thomas Bernard
|
|
5
|
-
* This software is subject to the conditions detailed in the
|
|
6
|
-
* LICENCE file provided in this distribution.
|
|
7
|
-
* */
|
|
8
|
-
#ifndef MINIWGET_INTERNAL_H_INCLUDED
|
|
9
|
-
#define MINIWGET_INTERNAL_H_INCLUDED
|
|
10
|
-
|
|
11
|
-
#include "miniupnpc_socketdef.h"
|
|
12
|
-
|
|
13
|
-
void * getHTTPResponse(SOCKET s, int * size, int * status_code);
|
|
14
|
-
|
|
15
|
-
#endif
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|