pkgsrc/net/libupnp/Makefile
adam 82489824d5 libupnp: updated to 1.14.7
Version 1.14.7
Fixes broken windows build.

Version 1.14.6
Fix for a DNS Rebind exploit. A special thanks for the collaboration
of the following people:
- Alaric Senat
- Fabrice Fontaine
- Gabriel Corona
- Ian Whyman
- Jean-Francois Dockes
- Marvin Scholz
- Werner Mahr

When upnp uses ixml to parse SOAP messages which contains too many node,
services are unavailable.

Version 1.14.5
Avoid potential memory leak in http_SendMessage()

Get rid of alloca()'s.

Non-recursive version of ixmlNode_free() avoids stack overflow attack.
Fixes CVE-2021-28302.

Version 1.14.4
Add more missing CMake infrastructure to the tarball.

Version 1.14.3
Add CMake infrastructure to the tarball.

Fix for gena leak.

Version 1.14.2
upnpapi.c: Fix crash in UpnpGetIfInfo

Per getifaddrs documentation, the ifa_addr field of an ifaddrs structure
can be null. In a real world example, an entry may be provided for the
non-existent hardware address of a tunnel device. This behavior was
observed with the netlink based getifaddrs implementation in glibc.

Handle interfaces without address

I got a crash on gerbera startup because at least one interface did not have `ifa_addr` set.

The reason is quite simple: they are the physical interfaces which are part of my channel
```
2: eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc fq_codel master bond0 state UP group default qlen 1000
    link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
3: eth0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc fq_codel master bond0 state UP group default qlen 1000
    link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
4: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
```

CMake:
- Fix tests for all occasions. (Hopefully)
- Set right so-version and don't yell commands.
- Reverted libname-change till decided

Fix IPv6 GENA subscription

Use LOCAL_PORT_V6_ULA_GUA or LOCAL_PORT_V6 depending on the IPv6 address

samples: allow the user to specify the control point interface

This is useful to test UPnP on specific interface (e.g. IPv6-only).
This was already possible on the device sample.

upnp/src/api/upnpapi.c: don't set gIF_IPV4 if there is no IPv4

Don't set gIF_IPV4 if no IPv4 is found to keep the default value of '\0'
otherwise SSDP will try to register IPv4 multicast with address 0.0.0.0
which will result in a runtime failure

Version 1.14.1
CMake Github Actions, including windows build.

upnpapi.c: assume that getifaddrs is available

Assume that getifaddrs is available even if it is not POSIX-compliant,
this will simplify the code and, as a side effect, this allow pupnp to
work on an interface that does not have an IPv4 address.

CMake support.

Fixes the inclusion of alloca.h in WIN32.

Remove the now unused file ClientSubscription.c.

Remove port >= 49152 restriction.

Version 1.14.0
Reworked the miniserver code to deal with SO_REUSEADDR

Factored the common socket code and test for EADDRINUSE returning from
listen() when SO_REUSEADDR is turned on.

Removed template classes.

The files generated through template classes had some drawbacks:

1 - You could not read the code.
2 - You could not step through the code with a debugger.
3 - Doxygen was unable to document it.

This patch removes the templates and creates an auto generator for these
boilerplate generated code in the same spirit of the templates, but
solves the above problems.

Still, dealing with documentation still needs some work, but should be
much easier now.

upnpapi.c: retrieve gIF_IPV4_NETMASK with BSD

BSD is using getifaddrs, update the code to retrieve the IPv4 netmask
(used in the CallStranger fix)

Signed-off-by: Fabrice Fontaine fontaine.fabrice@gmail.com

Drop UpnpInit

This function is deprecated since a long time moreover it is vulnerable
to CallStranger a.k.a. CVE-2020-12695 and can't be fixed without
breaking the API as HostIP only allows the user to pass an IP address
and not a netmask.

If we want to discover the netmask from the HostIP provided in UPnPInit,
we'll have to loop through all the available interfaces to find the
interface with the given IP address to finally retrieve the netmask.
This is a lot of work/modification for a deprecated function. Moreover,
in the end UPnPInit will be like a "deprecated" (i.e. IPv4-only) version
of UPnPInit2.

So it is time to remove this deprecated function.

As a result, also remove getlocalhostname and DEFAULT_INTERFACE which
are not needed anymore and replace UpnpInit by UpnpInit2 in comments.

Signed-off-by: Fabrice Fontaine fontaine.fabrice@gmail.com

Partial fix for CallStranger on IPv4

This is a partial fix for CallStranger a.k.a. CVE-2020-12695

Check that DeliveryURLs are in the expected network segment as requested
by the new UPnP UDA:
https://openconnectivity.org/upnp-specs/UPnP-arch-DeviceArchitecture-v2.0-20200417.pdf.

Here is an extract of the new requirement:

The subscription request containing a delivery URL not on the same
network segment as the fully qualified event subscription URL shall not
be accepted. For private networks this means that the delivery URL
provided will adhere to the following IP ranges:

. 10.0.0.0 - 10.255.255.255 (10/8 prefix)
. 172.16.0.0 - 172.31.255.255 (172.16/12 prefix)
. 192.168.0.0 - 192.168.255.255 (192.168/16 prefix)

In the context of pupnp, this means that the IPv4 netmask is now
retrieved when using UPnPInit2. Then, each DeliveryURL is checked
against the device's IPv4 address and netmask. If one of them are not
compliant, the whole subscription is rejected.

This first commit should be enhanced / updated to:

. remove UPnPInit (it is deprecated for a long time) or update it so
. the user can also pass the netmask
. fix IPv6
. fix Windows code
. retrieve the netmask in the BSD code of UPnPInit2

Signed-off-by: Fabrice Fontaine fontaine.fabrice@gmail.com

NULL pointer dereference in FindServiceControlURLPath

Version 1.12.1
setsockopt(IP_MULTICAST_IF) fails on 64-bit CPUs

Do not use usleep when using newer POSIX C source.

usleep is deprecated and is optionally unavailable with uClibc-ng.

Add Os/UserAgent information to UpnpActionRequest and UpnpFileInfo

Add CtrlPtIPAddr to UpnpFileInfo class

List: Add extern C for C++ users

Version 1.12.0
    Reduce spurious HTTP 416 errors due to ill-defined bytes header

    I (re)discovered this behavior trying to use the Gerbera media server
    with Chromecast (built in to my Vizio P55-F1 TV).  Chromecast specifies
    "bytes:0-" with no end range, which caused pupnp to return
    RANGE_NOT_SATISFIABLE.  Jin, the author of MediaTomb, of which Gerbera
    is a continuation, fixed this in 2007 in MediaTomb's fork of pupnp, see
    gerbera@ccd7994d45 "made sure that range requests specified as
    "bytes=0-" do not trigger...", but never passed the fix upstream.  When
    restarted as Gerbera, pupnp was removed from the local tree in favor of
    using the upstream version, and the patch was lost which lead to me
    rediscovering it recently.

    This is Jin's original patch applied to pupnp 1.8.  This teaches pupnp to
    ignore the bytes header if it matches "0-" and return HTTP_OK.

When building v1.8.6 (on GNU/Linux) with --disable-device, pupnp doesn't build:
/bin/bash ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -I../upnp/inc  -I./inc -I../ixml/inc  -DNDEBUG -I./src/inc -I./src/threadutil -I/foo/contrib/x86_64-linux-gnu/include -fPIC  -pthread  -I/foo/contrib/x86_64-linux-gnu/include -DNDEBUG=1 -O3  -DUPNP_STATIC_LIB -Os -Wall -c -o src/genlib/util/libupnp_la-util.lo `test -f 'src/genlib/util/util.c' || echo './'`src/genlib/util/util.c
In file included from src/genlib/miniserver/miniserver.c:58:0:
./src/inc/upnpapi.h:208:2: error: unknown type name 'service_info'
service_info **serv_info
^~~~~~~~~~~~

This patch fixes compilation for the --disable-device case.

GitHub PRs:
* Remove unused files
* UpnpEnableWebserver: Error correctly when web server compiled-out
* CI: Remove .travis.yml
* Remove TRUE/FALSE defines and BOOL typedef
* CI: Add address sanitizer and leak sanitizer enabled test run
* Add list test
* Add -Wextra and -Wpedantic to get more warnings
* More warning fixes
* Doxygen changes
* Remove unused headers
* Remove IN, OUT and INOUT defines
* Remove unused defines in uri.h
* Use stdbool.h instead of BOOL typedef and defines
* Various compiler warning fixes
* configure.ac: Fix Windows detection
* configure.ac: Enable silent rules
* LinkedList: Simplify _WIN32 check
* Remove checks of __OSX__ define
* Add Github Actions based CI

Github PR * Add forgotten Windows dll export qualifiers

Github PR * Remove and replace the list.h file

Github PRs:
* Overhaul list.h to fix various issues
* Use rand_s in get_random_info on Windows
* Do not redeclare timezone struct if already defined in Mingw
* Fix interface filtering for Windows
- The mentioned fix is not only needed for MSVC, but when
cross-compiling for Windows with mingw-w64 too.
* config.h: Remove DEBUG_TARGET
- The DEBUG_TARGET is no longer used, it was previously used in
upnpdebug.c to disable logging to a file, which now is done
by just not calling UpnpSetLogFileNames.
* Check for -lpthread too
- Updates pthread m4 check from upstream

Version 1.10.1
Fix format string for ExtraHeaders

Version 1.10.0
Fix sed command for upnp patch in configure.ac

Proper allocation for an array of structs and a check for an unlikely
overflow when calling the SIOCGIFCONF ioctl().

It still bugs me the stack requirements of getlocalhostname() and
UpnpGetIfInfo().

Version 1.8.6
Fix format string for ExtraHeaders

Version 1.8.5
Fixed a wrong ifdef in ssdp_device.c that was causing problems with
ipv6.
2021-06-04 18:56:40 +00:00

24 lines
617 B
Makefile

# $NetBSD: Makefile,v 1.28 2021/06/04 18:56:40 adam Exp $
DISTNAME= libupnp-1.14.7
CATEGORIES= net
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=pupnp/}
EXTRACT_SUFX= .tar.bz2
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= https://pupnp.sourceforge.io/
COMMENT= Portable Universal Plug and Play (UPnP) SDK
LICENSE= modified-bsd
USE_LIBTOOL= yes
USE_TOOLS+= pkg-config
GNU_CONFIGURE= yes
CONFIGURE_ARGS+= --disable-samples
PKGCONFIG_OVERRIDE+= libupnp.pc.in
TEST_TARGET= check
CFLAGS.SunOS+= -D_POSIX_PTHREAD_SEMANTICS
.include "options.mk"
.include "../../mk/pthread.buildlink3.mk"
.include "../../mk/bsd.pkg.mk"