From b09861b3bdc2cdc4591f00f5373bbc18022f84a9 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Wed, 17 Jun 2020 02:14:23 +0000 Subject: MFH: r538228 r538329 net/freerdp: update to 2.1.0 This update incorporates many features and improvements since 2.0.0-rc4, as well as a large mass of security fixes. Full changelog available: https://github.com/FreeRDP/FreeRDP/blob/2.1.0/ChangeLog PR: 245517 Approved by: koobs (mentor) Security: 669f3fe8-a07a-11ea-b83e-f0def1f5c5a2 net/freerdp: fix build on FreeBSD 11.x Apparently this hadn't been caught in my test matrix -- it seems that later versions of FreeBSD have a getmntent() definition that masked this error. mntent_compat.c has been adopted from devel/fam, though a better solution should be sought out going into the future. Approved by: koobs (mentor, implicit, just-fix-it) Approved by: ports-secteam (joneum) --- net/freerdp/Makefile | 23 ++- net/freerdp/distinfo | 14 +- net/freerdp/files/mntent.h | 64 ++++++++ net/freerdp/files/mntent_compat.c | 174 +++++++++++++++++++++ .../patch-channels_rdpdr_client_CMakeLists.txt | 10 ++ ...channels_urbdrc_client_libusb_libusb__udevice.h | 11 ++ ...channels_urbdrc_client_libusb_libusb__udevman.c | 11 ++ net/freerdp/pkg-plist | 26 +-- 8 files changed, 310 insertions(+), 23 deletions(-) create mode 100644 net/freerdp/files/mntent.h create mode 100644 net/freerdp/files/mntent_compat.c create mode 100644 net/freerdp/files/patch-channels_rdpdr_client_CMakeLists.txt create mode 100644 net/freerdp/files/patch-channels_urbdrc_client_libusb_libusb__udevice.h create mode 100644 net/freerdp/files/patch-channels_urbdrc_client_libusb_libusb__udevman.c diff --git a/net/freerdp/Makefile b/net/freerdp/Makefile index 2fc81a575f1f..56abf59aa30b 100644 --- a/net/freerdp/Makefile +++ b/net/freerdp/Makefile @@ -2,12 +2,13 @@ # $FreeBSD$ PORTNAME= freerdp -DISTVERSION= 2.0.0-rc4 -PORTREVISION= 7 +DISTVERSION= 2.1.1 +PORTREVISION= 0 CATEGORIES= net comms PATCH_SITES= https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/ -PATCHFILES= 649f49f.patch:-p1 effa8b8.patch:-p1 0c83efa.patch:-p1 +# FreeBSD doesn't have O_TMPFILE, must use shm_open w/ SHM_ANON instead. +PATCHFILES= 1b5e234135b0.patch:-p1 MAINTAINER= kevans@FreeBSD.org COMMENT= Free implementation of Remote Desktop Protocol @@ -18,13 +19,22 @@ LICENSE_FILE= ${WRKSRC}/LICENSE BROKEN_SSL= libressl-devel BROKEN_SSL_REASON_libressl-devel= fails to compile: no member named 'alert_dispatch' in 'struct ssl3_state_st' -LIB_DEPENDS= libepoll-shim.so:devel/libepoll-shim +LIB_DEPENDS= libdbus-glib-1.so:devel/dbus-glib \ + libepoll-shim.so:devel/libepoll-shim \ + libudev.so:devel/libudev-devd \ + libuuid.so:misc/e2fsprogs-libuuid USES= alias cmake compiler:c++11-lib cpe gettext gnome localbase pathfix pkgconfig ssl USE_LDCONFIG= yes CPE_VENDOR= freerdp_project +PATCHVERSION= ${PORTVERSION} +MAJORVERSION= ${PORTVERSION:R:R} + +PLIST_SUB+= PATCHVERSION="${PATCHVERSION}" +PLIST_SUB+= MAJORVERSION="${MAJORVERSION}" + USE_GITHUB= yes GH_ACCOUNT= FreeRDP GH_PROJECT= ${GH_ACCOUNT} @@ -46,6 +56,7 @@ CMAKE_ARGS+= -DWITH_CHANNELS:BOOL=ON \ -DWITH_THIRD_PARTY:BOOL=OFF \ -DWITH_VALGRIND_MEMCHECK:BOOL=OFF -DWITH_X264:BOOL=OFF \ -DWITH_ZLIB:BOOL=ON \ + -DCHANNEL_URBDRC_CLIENT:BOOL=ON \ ${CMAKE_ARGS_${ARCH}} CMAKE_ARGS_aarch64= -DWITH_NEON=ON @@ -158,4 +169,8 @@ post-patch: ${WRKSRC}/cmake/FindGSM.cmake \ ${WRKSRC}/libfreerdp/codec/dsp.c +pre-configure: + ${CP} ${FILESDIR}/mntent.h ${WRKSRC}/rdtk/include + ${CP} ${FILESDIR}/mntent_compat.c ${WRKSRC}/channels/rdpdr/client + .include diff --git a/net/freerdp/distinfo b/net/freerdp/distinfo index 331c2046098d..1a5d73e6aabe 100644 --- a/net/freerdp/distinfo +++ b/net/freerdp/distinfo @@ -1,9 +1,5 @@ -TIMESTAMP = 1546908117 -SHA256 (FreeRDP-FreeRDP-2.0.0-rc4_GH0.tar.gz) = 3406f3bfab63f81c1533029a5bf73949ff60f22f6e155c5a08005b8b8afe6d49 -SIZE (FreeRDP-FreeRDP-2.0.0-rc4_GH0.tar.gz) = 6615213 -SHA256 (649f49f.patch) = 9f8ef88e12f55fcb02a6a30c7d7fff3ae19894c6d368eebc17e878b81cdaa975 -SIZE (649f49f.patch) = 777 -SHA256 (effa8b8.patch) = 2fa4479ff7c0239f279172c08e7b52491d457ab844e6f5a6316c46f0d3afa49c -SIZE (effa8b8.patch) = 993 -SHA256 (0c83efa.patch) = fe9b6cabe7e54f6c02bf64e14eeb07d997511c3481e7e592e6526dbc10d337c3 -SIZE (0c83efa.patch) = 1144 +TIMESTAMP = 1591628011 +SHA256 (FreeRDP-FreeRDP-2.1.1_GH0.tar.gz) = ce363a6578530cf508df802bb980a8dd49a874919bfa33b8c61d992ad0882bfb +SIZE (FreeRDP-FreeRDP-2.1.1_GH0.tar.gz) = 6828178 +SHA256 (1b5e234135b0.patch) = a7991aa963405ffabd5bd7eebf61f36dd1b7a9aa767ca0f52b230c8008e90701 +SIZE (1b5e234135b0.patch) = 1304 diff --git a/net/freerdp/files/mntent.h b/net/freerdp/files/mntent.h new file mode 100644 index 000000000000..5cdf9881ccca --- /dev/null +++ b/net/freerdp/files/mntent.h @@ -0,0 +1,64 @@ +/* + * mntent + * mntent.h - compatability header for FreeBSD + * + * Copyright (c) 2001 David Rufino + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +// $FreeBSD$ + +#if defined(HAVE_MNTENT_H) +#include +#else +#ifndef _MNTENT_H +#define _MNTENT_H +#include + +#define MOUNTED "dummy" + +#define MNTTYPE_NFS "nfs" + +struct mntent { + char *mnt_fsname; + char *mnt_dir; + char *mnt_type; + char *mnt_opts; + int mnt_freq; + int mnt_passno; +}; + +#define setmntent(x,y) ((FILE *)0x1) +#ifdef __cplusplus +extern "C" { +#endif +struct mntent *getmntent __P ((FILE *fp)); +char *hasmntopt __P ((const struct mntent *mnt, const char *option)); +#ifdef __cplusplus +}; // extern "C" +#endif +#define endmntent(x) ((int)1) + +#endif /* _MNTENT_H */ +#endif /* HAVE_MNTENT_H */ diff --git a/net/freerdp/files/mntent_compat.c b/net/freerdp/files/mntent_compat.c new file mode 100644 index 000000000000..6169936f2a46 --- /dev/null +++ b/net/freerdp/files/mntent_compat.c @@ -0,0 +1,174 @@ +/* + * Copyright (c) 1980, 1989, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * Copyright (c) 2001 + * David Rufino + * Copyright (c) 2006 + * Stanislav Sedov + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* most of this was ripped from the mount(3) source */ + +#include "config.h" +#include "mntent.h" +#include +#include +#include +#include +#include + +static int pos = -1; +static int mntsize = -1; +static struct mntent _mntent; + +struct { + int m_flag; + const char *m_option; +} mntoptions[] = { + { MNT_ASYNC, "async" }, + { MNT_NOATIME, "noatime"}, + { MNT_NOEXEC, "noexec"}, + { MNT_NOSUID, "nosuid"}, + { MNT_NOSYMFOLLOW, "nosymfollow"}, + { MNT_SYNCHRONOUS, "sync"}, + { MNT_UNION, "union"}, + { MNT_NOCLUSTERR, "noclusterr"}, + { MNT_NOCLUSTERW, "noclusterw"}, + { MNT_SUIDDIR, "suiddir"}, +#ifdef MNT_SNAPSHOT + { MNT_SNAPSHOT, "snapshot"}, +#endif +#ifdef MNT_MULTILABEL + { MNT_MULTILABEL, "multilabel"}, +#endif +#ifdef MNT_ACLS + { MNT_ACLS, "acls"}, +#endif +#ifdef MNT_NODEV + { MNT_NODEV, "nodev"}, +#endif +}; + +#define N_OPTS (sizeof(mntoptions) / sizeof(*mntoptions)) + +char * +hasmntopt (const struct mntent *mnt, const char *option) +{ + int found; + char *opt, *optbuf; + + optbuf = strdup(mnt->mnt_opts); + found = 0; + for (opt = optbuf; (opt = strtok(opt, " ")) != NULL; opt = NULL) { + if (!strcasecmp(opt, option)) { + opt = opt - optbuf + mnt->mnt_opts; + free (optbuf); + return (opt); + } + } + free (optbuf); + return (NULL); +} + +static char * +catopt (char *s0, const char *s1) +{ + size_t newlen; + char *cp; + + if (s1 == NULL || *s1 == '\0') + return s0; + + if (s0 != NULL) { + newlen = strlen(s0) + strlen(s1) + 1 + 1; + if ((cp = (char *)realloc(s0, newlen)) == NULL) + return (NULL); + + (void)strcat(cp, " "); + (void)strcat(cp, s1); + } else + cp = strdup(s1); + + return (cp); +} + + +static char * +flags2opts (int flags) +{ + char *res = NULL; + int i; + + res = catopt(res, (flags & MNT_RDONLY) ? "ro" : "rw"); + + for (i = 0; i < N_OPTS; i++) + if (flags & mntoptions[i].m_flag) + res = catopt(res, mntoptions[i].m_option); + return res; +} + +static struct mntent * +statfs_to_mntent (struct statfs *mntbuf) +{ + static char opts_buf[40], *tmp; + + _mntent.mnt_fsname = mntbuf->f_mntfromname; + _mntent.mnt_dir = mntbuf->f_mntonname; + _mntent.mnt_type = mntbuf->f_fstypename; + tmp = flags2opts (mntbuf->f_flags); + if (tmp) { + opts_buf[sizeof(opts_buf) - 1] = '\0'; + strncpy (opts_buf, tmp, sizeof(opts_buf)-1); + free (tmp); + } else { + *opts_buf = '\0'; + } + _mntent.mnt_opts = opts_buf; + _mntent.mnt_freq = _mntent.mnt_passno = 0; + return (&_mntent); +} + +struct mntent * +getmntent (FILE *fp) +{ + struct statfs *mntbuf; + + if (pos == -1 || mntsize == -1) + mntsize = getmntinfo (&mntbuf, MNT_NOWAIT); + + ++pos; + if (pos == mntsize) { + pos = mntsize = -1; + return (NULL); + } + + return (statfs_to_mntent (&mntbuf[pos])); +} diff --git a/net/freerdp/files/patch-channels_rdpdr_client_CMakeLists.txt b/net/freerdp/files/patch-channels_rdpdr_client_CMakeLists.txt new file mode 100644 index 000000000000..8b379eaff823 --- /dev/null +++ b/net/freerdp/files/patch-channels_rdpdr_client_CMakeLists.txt @@ -0,0 +1,10 @@ +--- channels/rdpdr/client/CMakeLists.txt.orig 2020-06-09 02:02:41 UTC ++++ channels/rdpdr/client/CMakeLists.txt +@@ -24,6 +24,7 @@ set(${MODULE_PREFIX}_SRCS + irp.h + devman.c + devman.h ++ mntent_compat.c + rdpdr_main.c + rdpdr_main.h + rdpdr_capabilities.c diff --git a/net/freerdp/files/patch-channels_urbdrc_client_libusb_libusb__udevice.h b/net/freerdp/files/patch-channels_urbdrc_client_libusb_libusb__udevice.h new file mode 100644 index 000000000000..67e8ab7b2759 --- /dev/null +++ b/net/freerdp/files/patch-channels_urbdrc_client_libusb_libusb__udevice.h @@ -0,0 +1,11 @@ +--- channels/urbdrc/client/libusb/libusb_udevice.h.orig 2020-05-20 14:45:43 UTC ++++ channels/urbdrc/client/libusb/libusb_udevice.h +@@ -75,4 +75,8 @@ IUDEVICE* udev_new_by_addr(URBDRC_PLUGIN* urbdrc, libu + BYTE dev_number); + const char* usb_interface_class_to_string(uint8_t class); + ++#ifndef LIBUSB_CLASS_PHYSICAL ++#define LIBUSB_CLASS_PHYSICAL 5 ++#endif ++ + #endif /* FREERDP_CHANNEL_URBDRC_CLIENT_LIBUSB_UDEVICE_H */ diff --git a/net/freerdp/files/patch-channels_urbdrc_client_libusb_libusb__udevman.c b/net/freerdp/files/patch-channels_urbdrc_client_libusb_libusb__udevman.c new file mode 100644 index 000000000000..f1662e96308a --- /dev/null +++ b/net/freerdp/files/patch-channels_urbdrc_client_libusb_libusb__udevman.c @@ -0,0 +1,11 @@ +--- channels/urbdrc/client/libusb/libusb_udevman.c.orig 2020-06-08 15:33:51 UTC ++++ channels/urbdrc/client/libusb/libusb_udevman.c +@@ -832,7 +832,7 @@ static DWORD poll_thread(LPVOID lpThreadParameter) + { + libusb_hotplug_callback_handle handle; + UDEVMAN* udevman = (UDEVMAN*)lpThreadParameter; +- BOOL hasHotplug = libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG); ++ BOOL hasHotplug = TRUE; + + if (hasHotplug) + { diff --git a/net/freerdp/pkg-plist b/net/freerdp/pkg-plist index aed39638265b..cf4c7579c65e 100644 --- a/net/freerdp/pkg-plist +++ b/net/freerdp/pkg-plist @@ -19,6 +19,7 @@ include/freerdp2/freerdp/cache/pointer.h include/freerdp2/freerdp/channels/audin.h include/freerdp2/freerdp/channels/channels.h include/freerdp2/freerdp/channels/cliprdr.h +include/freerdp2/freerdp/channels/disp.h include/freerdp2/freerdp/channels/encomsp.h include/freerdp2/freerdp/channels/geometry.h include/freerdp2/freerdp/channels/log.h @@ -29,6 +30,7 @@ include/freerdp2/freerdp/channels/rdpgfx.h include/freerdp2/freerdp/channels/rdpsnd.h include/freerdp2/freerdp/channels/remdesk.h include/freerdp2/freerdp/channels/tsmf.h +include/freerdp2/freerdp/channels/urbdrc.h include/freerdp2/freerdp/channels/video.h include/freerdp2/freerdp/channels/wtsvc.h include/freerdp2/freerdp/client.h @@ -41,6 +43,7 @@ include/freerdp2/freerdp/client/drdynvc.h include/freerdp2/freerdp/client/encomsp.h include/freerdp2/freerdp/client/file.h include/freerdp2/freerdp/client/geometry.h +include/freerdp2/freerdp/client/printer.h include/freerdp2/freerdp/client/rail.h include/freerdp2/freerdp/client/rdpei.h include/freerdp2/freerdp/client/rdpgfx.h @@ -77,6 +80,7 @@ include/freerdp2/freerdp/crypto/der.h include/freerdp2/freerdp/crypto/er.h include/freerdp2/freerdp/crypto/per.h include/freerdp2/freerdp/crypto/tls.h +include/freerdp2/freerdp/display.h include/freerdp2/freerdp/dvc.h include/freerdp2/freerdp/error.h include/freerdp2/freerdp/event.h @@ -92,6 +96,7 @@ include/freerdp2/freerdp/gdi/shape.h include/freerdp2/freerdp/gdi/video.h include/freerdp2/freerdp/graphics.h include/freerdp2/freerdp/input.h +include/freerdp2/freerdp/license.h include/freerdp2/freerdp/listener.h include/freerdp2/freerdp/locale/keyboard.h include/freerdp2/freerdp/locale/locale.h @@ -108,9 +113,11 @@ include/freerdp2/freerdp/secondary.h include/freerdp2/freerdp/server/audin.h include/freerdp2/freerdp/server/channels.h include/freerdp2/freerdp/server/cliprdr.h +include/freerdp2/freerdp/server/disp.h include/freerdp2/freerdp/server/drdynvc.h include/freerdp2/freerdp/server/echo.h include/freerdp2/freerdp/server/encomsp.h +include/freerdp2/freerdp/server/rail.h include/freerdp2/freerdp/server/rdpdr.h include/freerdp2/freerdp/server/rdpei.h include/freerdp2/freerdp/server/rdpgfx.h @@ -123,7 +130,6 @@ include/freerdp2/freerdp/settings.h include/freerdp2/freerdp/svc.h include/freerdp2/freerdp/types.h include/freerdp2/freerdp/update.h -include/freerdp2/freerdp/utils/msusb.h include/freerdp2/freerdp/utils/passphrase.h include/freerdp2/freerdp/utils/pcap.h include/freerdp2/freerdp/utils/profiler.h @@ -203,20 +209,20 @@ include/winpr2/winpr/wnd.h include/winpr2/winpr/wtsapi.h include/winpr2/winpr/wtypes.h lib/libfreerdp-client2.so -lib/libfreerdp-client2.so.2 -lib/libfreerdp-client2.so.2.0.0 +lib/libfreerdp-client2.so.%%MAJORVERSION%% +lib/libfreerdp-client2.so.%%PATCHVERSION%% lib/libfreerdp2.so -lib/libfreerdp2.so.2 -lib/libfreerdp2.so.2.0.0 +lib/libfreerdp2.so.%%MAJORVERSION%% +lib/libfreerdp2.so.%%PATCHVERSION%% %%WAYLAND%%lib/libuwac0.so %%WAYLAND%%lib/libuwac0.so.0 -%%WAYLAND%%lib/libuwac0.so.0.0.1 +%%WAYLAND%%lib/libuwac0.so.0.1.1 lib/libwinpr-tools2.so -lib/libwinpr-tools2.so.2 -lib/libwinpr-tools2.so.2.0.0 +lib/libwinpr-tools2.so.%%MAJORVERSION%% +lib/libwinpr-tools2.so.%%PATCHVERSION%% lib/libwinpr2.so -lib/libwinpr2.so.2 -lib/libwinpr2.so.2.0.0 +lib/libwinpr2.so.%%MAJORVERSION%% +lib/libwinpr2.so.%%PATCHVERSION%% libdata/pkgconfig/freerdp-client2.pc libdata/pkgconfig/freerdp2.pc %%WAYLAND%%libdata/pkgconfig/uwac0.pc -- cgit v1.2.3