Commit Graph

510 Commits

Author SHA1 Message Date
Thomas Bernard ca4e0342bf
genminiupnpcstrings.vbs: generates rc_version.h as well
see #512
2020-11-30 01:55:06 +01:00
Thomas Bernard b28462b62a
wingenminiupnpcstrings also generates rc_version.h 2020-11-30 01:48:15 +01:00
Thomas Bernard f04dbafe09
mingw32: build resources for .dll 2020-11-30 01:21:26 +01:00
Stanislas Dolcini 44dd54051c Add RC file 2020-11-28 11:49:59 +01:00
Cristian Morales Vega 677e0db636 Install cmake config file
miniupnpc::miniupnpc becomes an ALIAS for the shared library, if
available, and the static library otherwise.
Users of the installed library can use MINIUPNPC_USE_STATIC_LIBS to
force the use of the static library.
2020-11-27 18:49:51 +00:00
Thomas Bernard 5b5ce9e49e Merge remote-tracking branch 'RedDwarf69/stuff' into master 2020-11-27 19:08:35 +01:00
Cristian Morales Vega f1f8ae3659 cmake: use GNUInstallDirs 2020-11-25 11:09:21 +00:00
Cristian Morales Vega efcc616110 cmake: remove wrong target_include_directories() 2020-11-24 16:37:35 +00:00
Thomas Bernard ae5e8fa9af Merge remote-tracking branch 'RedDwarf69/pkgconfig' into master 2020-11-23 18:30:18 +01:00
Cristian Morales Vega ed989c3fa2 miniupnpc.pc: remove "miniupnpc" from includedir 2020-11-22 19:51:57 +00:00
Cristian Morales Vega 876109c890 cmake: update version 2020-11-22 19:31:42 +00:00
Thomas Bernard 9793607a76
miniupnpc version 2.2.0 2020-11-09 20:52:52 +01:00
Thomas Bernard 82e874ada9
remove build warning.
PortMappingNumberOfEntries is supposed to be limited to 65536

should fix #501
2020-11-09 20:38:45 +01:00
Thomas Bernard 1756c9259a
github workflows: try to upload win32 binaries 2020-11-05 13:24:59 +01:00
Pali Rohár 26e8f7831a Use GetBestInterface() instead of GetBestInterfaceEx()
GetBestInterfaceEx() is not supported by older i586-mingw32msvc-gcc
compiler. GetBestInterface() works only with IPv4 addresses but in this
case it is enough as it is needed only for IP address 223.255.255.255.
2020-11-04 23:59:03 +01:00
Pali Rohár 23f492fd1b Fix compilation when _WIN32_WINNT_VISTA macro is not defined
Older version of i586-mingw32msvc-gcc compiler does not define
_WIN32_WINNT_VISTA macro. Therefore preprocessor #if condition is
incorrectly evaluated.
2020-11-04 23:57:43 +01:00
Thomas Bernard 8b44224b91 2020 2020-11-04 23:42:37 +01:00
Thomas Bernard 0a9750602d Merge branch 'win32_snprintf' 2020-11-04 23:40:37 +01:00
Thomas Bernard 25a78aa385 add win32_snprintf.h 2020-11-04 23:37:07 +01:00
Thomas Bernard 29797cf607 2019 => 2020 2020-10-31 11:36:06 +01:00
Pali Rohár 8cd542a809 Fix snprintf emulation for Windows
* Move it into separate win32_snprintf.h file to de-duplicate its
  implementation from all miniupnp source files.

* Do not use this emulation with mingw32 SDK when __NO_ISOCEXT is not
  defined as in this case mingw32 provides working snprintf function.

* Fix detection for mingw-w64 variants, when __NO_ISOCEXT is defined or
  when older version without UCRT is used.

* Add check if _scprintf function is available. In case it is not available
  just returns length of filled buffer to prevent buffer overflow.
2020-10-18 20:29:53 +02:00
Thomas Bernard bd71e2e279
miniupnpc/addr_is_reserved.c: include sys/types.h 2020-10-17 22:13:32 +02:00
Thomas Bernard 138b4ff3aa
Fix for compiling with old windows SDK 2020-10-17 22:03:22 +02:00
Thomas Bernard 7a66f373fc inet_pton() instead of inet_addr() 2020-10-17 15:19:58 +02:00
Thomas Bernard 69fc376929 add addr_is_reserved.c/.h to MSVC project files
fixes #489
2020-10-17 15:15:59 +02:00
Thomas Bernard 63bf239a3e remove unused definitions
see #489
2020-10-17 14:56:58 +02:00
Thomas Bernard 062b562c37 ignore *.opendb 2020-10-17 14:49:43 +02:00
Thomas Bernard 9ec4351829
Fix solaris build
fixes #490
2020-10-07 00:17:16 +02:00
Pali Rohár f5f693876d miniupnpc: By default skip invalid, disconnected and non-IGD devices
Allow to use such IGD devices by new -i option.
2020-10-05 22:30:30 +02:00
Thomas Bernard 11c479fb2a Merge remote-tracking branch 'pali/master' 2020-10-05 22:02:29 +02:00
Thomas Bernard c7cfe2c51a
fix compilation warning (WIN32) 2020-10-05 21:56:32 +02:00
Pali Rohár fc74c42864 miniupnpc: Fix name of miniupnpc import library in setupmingw32.py 2020-10-02 22:52:26 +02:00
Pali Rohár 7d5fdf0743 miniupnpc: Fix usage of Windows _snprintf() function
_snprintf() differs from snprintf() in:

* on overflow it returns -1 instead of required buffer size
* on overflow it does not fill nul byte
* does not accept NULL/0 as a buffer

Microsoft implemented snprintf() in Visual Studio 2015 as part of UCRT.

Mingw32 contains snprintf() implementation only when __USE_MINGW_ANSI_STDIO
is defined.

Mingw-w64 versions prior to 8.0.0. contain snprintf() implementation when
__USE_MINGW_ANSI_STDIO or _UCRT is defined. Since version 8.0.0 it is
always supported.

Mingw-w64 defines both __MINGW32__ and __MINGW64_VERSION_MAJOR macros.
Mingw32 defines only __MINGW32__.

_scprintf() just count number of bytes needed for formatting string, so it
is basically return value of snprintf().

This change updates miniupnpc code to use snprintf() when is provided by
compiler/runtime to avoid usage _snprintf().

And also this changes updates miniupnpc emulation of snprintf() by
_snprintf() and _scprintf() functions to avoid buffer overflows.

For inspiration full emulation of snprintf() by _snprintf() is available in
mingw-w64 stdio library:

https://sourceforge.net/p/mingw-w64/mingw-w64/ci/master/tree/mingw-w64-crt/stdio/snprintf.c
2020-10-02 22:32:36 +02:00
Thomas Bernard c1eb7c0069 update Changelog 2020-09-28 23:25:23 +02:00
Thomas Bernard 6358882f19 check string passed to atoi() 2020-09-28 23:24:54 +02:00
Thomas Bernard cce4407d9d check for malformed HTTP response 2020-09-28 23:23:17 +02:00
Thomas Bernard 426f9a1835 fix warning 2020-09-24 10:38:05 +02:00
Thomas Bernard 2db013d891
use GetTickCount()/GetTickCount64() under windows
GetTickCount() when GetTickCount64() is not available
2020-09-24 10:19:09 +02:00
Thomas Bernard af1ea9f60b
miniupnpc: use clock_gettime() instead of gettimeofday() if possible 2020-09-24 10:19:08 +02:00
Thomas Bernard aa490867b3
prevent infinite loop in upnpDiscover()
fixes #488
2020-09-24 10:19:08 +02:00
Thomas Bernard 0c556655ea
Move addr_is_reserved() to a specific source file and test it 2020-09-24 09:57:25 +02:00
Pali Rohár 96aa863c78 Fix check for reserved IP addresses in miniupnpc
Check for 0.0.0.0, 192.168., 10. and 172. is not enough. Nowadays routers
behind NAT are getting IP address from shared CG-NAT space 100.64.0.0/10.

This patch adjust miniupnpc to check for all reserved IPv4 addresses.
2020-08-05 16:26:26 +02:00
Thomas Bernard 029383e5f4
initialize tp_free 2020-06-05 21:13:19 +02:00
Thomas Bernard 47a55b27c7
miniupnpc: use C99 flexible array member for struct UPNPDev
see #462
2020-05-29 17:59:38 +02:00
Thomas Bernard f34241339e
miniupnpc: update *.py files headers 2020-04-06 12:25:34 +02:00
Thomas BERNARD c5e8694746
Merge pull request #434 from pali/master
Fix and simplify Makefile.mingw for miniupnpc
2020-04-06 12:05:56 +02:00
Pali Rohár 8fc9a6d8ad Compile static mingw executables with -static argument 2020-04-06 00:09:52 +02:00
Pali Rohár 2e3e6990db Fix and simplify Makefile.mingw for miniupnpc
* Ensure that all executables would have .exe Windows extension
* Do not use dll subdirectory, so makefile would be slash agnostic
* Define common targets to simplify makefile
* Export required functions for listdevices executable
2020-04-02 18:45:46 +02:00
jaehong park ad7c1db49a fix: TypeError: a bytes-like object is required, not 'str' 2020-03-22 03:31:34 +09:00
Thomas Bernard 4436632866
2019=>2020 2020-02-20 09:04:23 +01:00