git: 5d2e844e7009 - 2023Q3 - net/tightvnc: add patches

From: Dirk Meyer <dinoex_at_FreeBSD.org>
Date: Mon, 24 Jul 2023 08:22:58 UTC
The branch 2023Q3 has been updated by dinoex:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5d2e844e70097be576569926647a5eff6cb10a8b

commit 5d2e844e70097be576569926647a5eff6cb10a8b
Author:     Dirk Meyer <dinoex@FreeBSD.org>
AuthorDate: 2023-07-24 08:18:27 +0000
Commit:     Dirk Meyer <dinoex@FreeBSD.org>
CommitDate: 2023-07-24 08:22:54 +0000

    net/tightvnc: add patches
    
    Security: CVE-2014-6053
    Security: CVE-2018-7225
    Security: CVE-2018-20021
    Security: CVE-2018-20022
    Security: CVE-2019-8287
    Security: CVE-2019-15678
    Security: CVE-2019-15679
    Security: CVE-2019-15680
    Security: CVE-2019-15681
    MFC:    2023Q3
    
    Fix build with clang16
    Replace deprecated XKeycodeToKeysym
    Allow for space characters in the home directory name
    
    (cherry picked from commit 02a2810dbb4093f83dafac4c6e9e196f8bae4b21)
---
 net/tightvnc/Makefile                               |  9 ++++++++-
 net/tightvnc/distinfo                               |  4 +++-
 net/tightvnc/files/patch-Imakefile                  | 10 ----------
 net/tightvnc/files/patch-Xvnc_config_cf_Imake.cf    | 15 ---------------
 .../files/patch-Xvnc_config_imake_imakemdep.h       | 21 ---------------------
 net/tightvnc/files/patch-Xvnc_include_Xos.h         | 10 ----------
 .../files/patch-Xvnc_programs_Xserver_dix_Imakefile | 20 --------------------
 .../patch-Xvnc_programs_Xserver_hw_vnc_sockets.c    | 10 ----------
 ...nc_programs_Xserver_hw_xfree86_common_compiler.h | 11 -----------
 .../files/patch-Xvnc_programs_Xserver_os_Imakefile  | 11 -----------
 .../files/patch-Xvnc_programs_Xserver_os_access.c   | 11 -----------
 net/tightvnc/files/patch-vncserver                  | 11 -----------
 net/tightvnc/files/patch-vncviewer_rfbproto.c       | 11 -----------
 13 files changed, 11 insertions(+), 143 deletions(-)

diff --git a/net/tightvnc/Makefile b/net/tightvnc/Makefile
index 6adba0588d95..ceee09d24dc8 100644
--- a/net/tightvnc/Makefile
+++ b/net/tightvnc/Makefile
@@ -5,6 +5,9 @@ CATEGORIES=	net java
 MASTER_SITES=	SF/vnc-tight/TightVNC-unix/${PORTVERSION}
 DISTNAME=	${PORTNAME}-${PORTVERSION}_unixsrc
 
+PATCH_SITES=	ftp://ftp.dinoex.org/pub/tightvnc/
+PATCHFILES=	tightvnc-patch-ansi
+
 MAINTAINER=	dinoex@FreeBSD.org
 COMMENT=	Enhanced version of VNC
 WWW=		https://www.tightvnc.com/
@@ -20,6 +23,7 @@ USES=		cpe imake jpeg shebangfix perl5 tar:bzip2 xorg
 USE_XORG=	ice sm x11 xaw xext xmu xt xpm
 
 CFLAGS+=	-fcommon # for build with clang-11, see https://sourceforge.net/p/vnc-tight/bugs/1523/
+CFLAGS+=	-DEVENT_SWAP_PTR=1 -DEXTENSION_PROC_ARGS=void
 
 MAKE_JOBS_UNSAFE=	yes
 CONFLICTS=	tigervnc
@@ -27,6 +31,9 @@ WRKSRC=		${WRKDIR}/vnc_unixsrc
 SHEBANG_FILES=	vncserver
 CFLAGS+=	-Wno-return-type
 CFLAGS+=	-Wno-int-conversion
+CFLAGS+=	-Wno-pointer-sign -Wno-deprecated-non-prototype -Wno-variadic-macros
+CFLAGS+=	-Wno-switch -Wno-format-extra-args -Wno-format-pedantic
+CFLAGS+=	-Wno-knr-promoted-parameter
 ALL_TARGET=	World
 MAKE_ARGS=	CC=${CC}
 
@@ -54,7 +61,7 @@ post-patch:
 .for file in vncviewer/Imakefile Xvnc/config/cf/vnclibs.def
 	@${REINPLACE_CMD} -i '' -e "s|%%LOCALBASE%%|${LOCALBASE}|g" ${WRKSRC}/${file}
 .endfor
-	@${REINPLACE_CMD} -i '' -e "s|/usr/local/vnc/classes|${DATADIR}/classes|g" \
+	@${REINPLACE_CMD} -i '' -e "s|/usr/local/share/tightvnc/classes|${DATADIR}/classes|g" \
 		${WRKSRC}/vncserver
 	@${REINPLACE_CMD} -i '' -e "s|%%CC%%|${CC}|g ; \
 		s|%%CFLAGS%%|${CFLAGS}|g" ${WRKSRC}/Xvnc/config/cf/FreeBSD.cf
diff --git a/net/tightvnc/distinfo b/net/tightvnc/distinfo
index 981955d66bb1..87ffb061511f 100644
--- a/net/tightvnc/distinfo
+++ b/net/tightvnc/distinfo
@@ -1,3 +1,5 @@
-TIMESTAMP = 1681652343
+TIMESTAMP = 1690175854
 SHA256 (tightvnc-1.3.10_unixsrc.tar.bz2) = f48c70fea08d03744ae18df6b1499976362f16934eda3275cead87baad585c0d
 SIZE (tightvnc-1.3.10_unixsrc.tar.bz2) = 1780510
+SHA256 (tightvnc-patch-ansi) = c3efc5c0995881939ff280649efdb4f31addbeb33dd6b27b805106b409d9a159
+SIZE (tightvnc-patch-ansi) = 245794
diff --git a/net/tightvnc/files/patch-Imakefile b/net/tightvnc/files/patch-Imakefile
deleted file mode 100644
index 6e9d0c3b8184..000000000000
--- a/net/tightvnc/files/patch-Imakefile
+++ /dev/null
@@ -1,10 +0,0 @@
---- Imakefile.orig	2002-04-30 13:07:31 UTC
-+++ Imakefile
-@@ -11,6 +11,7 @@ World:
- 	@echo Built $(SUBDIRS).
- 	@echo 'To build Xvnc, do "cd Xvnc", followed by "./configure" then "make"'
- 	@echo ""
-+	( cd Xvnc && ./configure && make )
- 
- libs:
- 	@echo 'No libraries included.'
diff --git a/net/tightvnc/files/patch-Xvnc_config_cf_Imake.cf b/net/tightvnc/files/patch-Xvnc_config_cf_Imake.cf
deleted file mode 100644
index 0a6f6502e43a..000000000000
--- a/net/tightvnc/files/patch-Xvnc_config_cf_Imake.cf
+++ /dev/null
@@ -1,15 +0,0 @@
---- Xvnc/config/cf/Imake.cf.orig	2006-12-23 12:07:55 UTC
-+++ Xvnc/config/cf/Imake.cf
-@@ -206,6 +206,12 @@ XCOMM $XFree86: xc/config/cf/Imake.cf,v 3.66 2001/04/1
- #  define i386Architecture
- #  undef i386
- # endif
-+# ifdef __x86_64__
-+#  ifndef x86_64Architecture
-+#   define x86_64Architecture
-+#  endif
-+#  undef __x86_64__
-+# endif
- # ifdef __alpha__
- #  define AlphaBsdArchitecture
- #  define AlphaArchitecture
diff --git a/net/tightvnc/files/patch-Xvnc_config_imake_imakemdep.h b/net/tightvnc/files/patch-Xvnc_config_imake_imakemdep.h
deleted file mode 100644
index 7b19d50df4b8..000000000000
--- a/net/tightvnc/files/patch-Xvnc_config_imake_imakemdep.h
+++ /dev/null
@@ -1,21 +0,0 @@
---- Xvnc/config/imake/imakemdep.h.orig	2003-02-19 16:39:54 UTC
-+++ Xvnc/config/imake/imakemdep.h
-@@ -225,6 +225,9 @@ in this Software without prior written authorization f
- #ifdef hpux
- #define USE_CC_E
- #endif
-+#if defined(__FreeBSD__)
-+#define USE_CC_E
-+#endif
- #ifdef WIN32
- #define USE_CC_E
- #define DEFAULT_CC "cl"
-@@ -253,7 +256,7 @@ in this Software without prior written authorization f
- #ifdef _CRAY
- #define DEFAULT_CPP "/lib/pcpp"
- #endif
--#if defined(__386BSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__)
-+#if defined(__386BSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
- #define DEFAULT_CPP "/usr/libexec/cpp"
- #endif
- #if defined(__sgi) && defined(__ANSI_CPP__)
diff --git a/net/tightvnc/files/patch-Xvnc_include_Xos.h b/net/tightvnc/files/patch-Xvnc_include_Xos.h
deleted file mode 100644
index f1aa9b3b65a3..000000000000
--- a/net/tightvnc/files/patch-Xvnc_include_Xos.h
+++ /dev/null
@@ -1,10 +0,0 @@
---- Xvnc/include/Xos.h.orig	2000-06-11 12:00:51 UTC
-+++ Xvnc/include/Xos.h
-@@ -151,7 +151,6 @@ extern int sys_nerr;
- #endif /* X_NOT_POSIX else */
- 
- #ifdef CSRG_BASED
--#include <stdlib.h>
- #include <unistd.h>
- #endif /* CSRG_BASED */
- 
diff --git a/net/tightvnc/files/patch-Xvnc_programs_Xserver_dix_Imakefile b/net/tightvnc/files/patch-Xvnc_programs_Xserver_dix_Imakefile
deleted file mode 100644
index 6999b947181f..000000000000
--- a/net/tightvnc/files/patch-Xvnc_programs_Xserver_dix_Imakefile
+++ /dev/null
@@ -1,20 +0,0 @@
---- Xvnc/programs/Xserver/dix/Imakefile.orig	2009-03-05 06:38:33 UTC
-+++ Xvnc/programs/Xserver/dix/Imakefile
-@@ -43,15 +43,11 @@ OBJS = atom.o colormap.o cursor.o devices.o dispatch.o
-  * changed.
-  */
- 
--#ifdef DefaultFontPath
--DEFAULTFONTPATH = DefaultFontPath
-+DEFAULTFONTPATH = ${LOCALBASE}/share/fonts/misc
- SITE_FONT_PATH = -DCOMPILEDDEFAULTFONTPATH=\"$(DEFAULTFONTPATH)\"
--#endif
- 
--#ifdef DefaultRGBDatabase
--DEFAULTRGBDATABASE = DefaultRGBDatabase
-+DEFAULTRGBDATABASE = ${LOCALBASE}/lib/X11/rgb
-    SITE_RGB_DB = -DRGB_DB=\"$(DEFAULTRGBDATABASE)\"
--#endif
- 
- #ifdef DefaultDisplayClass
- DEFAULTDISPLAYCLASS = DefaultDisplayClass
diff --git a/net/tightvnc/files/patch-Xvnc_programs_Xserver_hw_vnc_sockets.c b/net/tightvnc/files/patch-Xvnc_programs_Xserver_hw_vnc_sockets.c
deleted file mode 100644
index 9ff1dcdce046..000000000000
--- a/net/tightvnc/files/patch-Xvnc_programs_Xserver_hw_vnc_sockets.c
+++ /dev/null
@@ -1,10 +0,0 @@
---- Xvnc/programs/Xserver/hw/vnc/sockets.c.orig	2006-12-23 12:07:55 UTC
-+++ Xvnc/programs/Xserver/hw/vnc/sockets.c
-@@ -38,6 +38,7 @@
-  */
- 
- #include <stdio.h>
-+#include <string.h>
- #include <sys/types.h>
- #include <sys/time.h>
- #include <sys/socket.h>
diff --git a/net/tightvnc/files/patch-Xvnc_programs_Xserver_hw_xfree86_common_compiler.h b/net/tightvnc/files/patch-Xvnc_programs_Xserver_hw_xfree86_common_compiler.h
deleted file mode 100644
index 938ce65b1e0b..000000000000
--- a/net/tightvnc/files/patch-Xvnc_programs_Xserver_hw_xfree86_common_compiler.h
+++ /dev/null
@@ -1,11 +0,0 @@
---- Xvnc/programs/Xserver/hw/xfree86/common/compiler.h.orig	2000-06-11 12:00:51 UTC
-+++ Xvnc/programs/Xserver/hw/xfree86/common/compiler.h
-@@ -371,7 +371,7 @@ static __inline__ unsigned long ldw_u(unsigned short *
- #define mem_barrier()   /* NOP */
- #define write_mem_barrier()   /* NOP */
- 
--#if !defined(FAKEIT) && !defined(__mc68000__)
-+#if !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__powerpc__) && !defined(__riscv)
- #ifdef GCCUSESGAS
- 
- /*
diff --git a/net/tightvnc/files/patch-Xvnc_programs_Xserver_os_Imakefile b/net/tightvnc/files/patch-Xvnc_programs_Xserver_os_Imakefile
deleted file mode 100644
index daf52ebd5668..000000000000
--- a/net/tightvnc/files/patch-Xvnc_programs_Xserver_os_Imakefile
+++ /dev/null
@@ -1,11 +0,0 @@
---- Xvnc/programs/Xserver/os/Imakefile.orig	2000-06-11 12:00:51 UTC
-+++ Xvnc/programs/Xserver/os/Imakefile
-@@ -135,7 +135,7 @@ SpecialCObjectRule(xalloc,$(ICONFIGFILES),NullParamete
- #if defined(SparcArchitecture) && HasGcc && !HasGcc2
- oscolor.o: oscolor.c $(ICONFIGFILES)
- 	$(RM) $@
--	cc -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c
-+	$(CC) -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c
- #else
- SpecialCObjectRule(oscolor,$(ICONFIGFILES),$(DBM_DEFINES))
- #endif
diff --git a/net/tightvnc/files/patch-Xvnc_programs_Xserver_os_access.c b/net/tightvnc/files/patch-Xvnc_programs_Xserver_os_access.c
deleted file mode 100644
index ac2de3ac6a0c..000000000000
--- a/net/tightvnc/files/patch-Xvnc_programs_Xserver_os_access.c
+++ /dev/null
@@ -1,11 +0,0 @@
---- Xvnc/programs/Xserver/os/access.c.orig	2000-06-11 12:00:51 UTC
-+++ Xvnc/programs/Xserver/os/access.c
-@@ -634,7 +634,7 @@ DefineSelf (fd)
- #endif
-     ifc.ifc_len = sizeof (buf);
-     ifc.ifc_buf = buf;
--    if (ifioctl (fd, (int) SIOCGIFCONF, (pointer) &ifc) < 0)
-+    if (ifioctl (fd, SIOCGIFCONF, (pointer) &ifc) < 0)
-         Error ("Getting interface configuration (4)");
- 
- #ifdef ISC
diff --git a/net/tightvnc/files/patch-vncserver b/net/tightvnc/files/patch-vncserver
deleted file mode 100644
index 8dbd47bdae27..000000000000
--- a/net/tightvnc/files/patch-vncserver
+++ /dev/null
@@ -1,11 +0,0 @@
---- vncserver.orig	2019-03-26 05:19:17 UTC
-+++ vncserver
-@@ -34,7 +34,7 @@ $depth = 24;
- $desktopName = "X";
- $vncClasses = "/usr/local/vnc/classes";
- $vncUserDir = "$ENV{HOME}/.vnc";
--$fontPath = "unix/:7100";
-+#$fontPath = "unix/:7100";
- $authType = "-rfbauth $vncUserDir/passwd";
- 
- # Read configuration from the system-wide and user files if present.
diff --git a/net/tightvnc/files/patch-vncviewer_rfbproto.c b/net/tightvnc/files/patch-vncviewer_rfbproto.c
deleted file mode 100644
index 0ebb8037ce64..000000000000
--- a/net/tightvnc/files/patch-vncviewer_rfbproto.c
+++ /dev/null
@@ -1,11 +0,0 @@
---- vncviewer/rfbproto.c.orig	2006-12-08 07:20:03 UTC
-+++ vncviewer/rfbproto.c
-@@ -569,7 +569,7 @@ AuthenticateVNC(void)
-     passwd = getpass("Password: ");
-   }
- 
--  if (!passwd || strlen(passwd) == 0) {
-+  if (!passwd) {
-     fprintf(stderr, "Reading password failed\n");
-     return False;
-   }