--- /dev/null
+From 920d9c4d6562ecabf79497bc901d50522d4bc661 Mon Sep 17 00:00:00 2001
+From: Linus Heckemann <git@sphalerite.org>
+Date: Sat, 1 Feb 2020 11:08:26 +0100
+Subject: [PATCH] xserver: add no-op input thread init function
+
+This allows Xvnc to build with xorg-server 1.20.7, which requires OS
+layers to implement a ddxInputThreadInit function when configured with
+--enable-input-thread (the default).
+
+relevant xorg-server commit: e3f26605d85d987da434640f52646d728f1fe919
+---
+ unix/xserver/hw/vnc/Input.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/unix/xserver/hw/vnc/Input.c b/unix/xserver/hw/vnc/Input.c
+index 534e435e..b342d4d6 100644
+--- a/unix/xserver/hw/vnc/Input.c
++++ b/unix/xserver/hw/vnc/Input.c
+@@ -711,3 +711,12 @@ static void vncKeysymKeyboardEvent(KeySym keysym, int down)
+ */
+ mieqProcessInputEvents();
+ }
++
++#if INPUTTHREAD
++/** This function is called in Xserver/os/inputthread.c when starting
++ the input thread. */
++void
++ddxInputThreadInit(void)
++{
++}
++#endif
+--
+2.24.1
+
--- /dev/null
+diff -ur xserver.orig/dri3/Makefile.am xserver/dri3/Makefile.am
+--- xserver.orig/dri3/Makefile.am 2018-05-10 16:32:34.000000000 +0000
++++ xserver/dri3/Makefile.am 2018-07-04 13:08:37.614326450 +0000
+@@ -1,7 +1,7 @@
+ noinst_LTLIBRARIES = libdri3.la
+ AM_CFLAGS = \
+ -DHAVE_XORG_CONFIG_H \
+- @DIX_CFLAGS@ @XORG_CFLAGS@
++ @DIX_CFLAGS@ @XORG_CFLAGS@ @LIBDRM_CFLAGS@
+
+ libdri3_la_SOURCES = \
+ dri3.h \
-diff -urpa tigervnc-1.9.0.orig/unix/xserver/hw/vnc/InputXKB.c tigervnc-1.9.0/unix/xserver/hw/vnc/InputXKB.c
---- tigervnc-1.9.0.orig/unix/xserver/hw/vnc/InputXKB.c 2018-07-16 14:08:55.000000000 +0000
-+++ tigervnc-1.9.0/unix/xserver/hw/vnc/InputXKB.c 2018-08-20 19:16:47.275346371 +0000
-@@ -214,10 +214,7 @@ void vncPrepareInputDevices(void)
+diff --git a/unix/xserver/hw/vnc/InputXKB.c b/unix/xserver/hw/vnc/InputXKB.c
+index f84a6e4..4eac939 100644
+--- a/unix/xserver/hw/vnc/InputXKB.c
++++ b/unix/xserver/hw/vnc/InputXKB.c
+@@ -226,10 +226,7 @@ void vncPrepareInputDevices(void)
unsigned vncGetKeyboardState(void)
{
}
unsigned vncGetLevelThreeMask(void)
-@@ -238,7 +235,7 @@ unsigned vncGetLevelThreeMask(void)
+@@ -250,7 +247,7 @@ unsigned vncGetLevelThreeMask(void)
return 0;
}
act = XkbKeyActionPtr(xkb, keycode, state);
if (act == NULL)
-@@ -263,7 +260,7 @@ KeyCode vncPressShift(void)
+@@ -275,7 +272,7 @@ KeyCode vncPressShift(void)
if (state & ShiftMask)
return 0;
for (key = xkb->min_key_code; key <= xkb->max_key_code; key++) {
XkbAction *act;
unsigned char mask;
-@@ -303,7 +300,7 @@ size_t vncReleaseShift(KeyCode *keys, si
+@@ -315,7 +312,7 @@ size_t vncReleaseShift(KeyCode *keys, size_t maxKeys)
count = 0;
xkb = master->key->xkbInfo->desc;
for (key = xkb->min_key_code; key <= xkb->max_key_code; key++) {
XkbAction *act;
-@@ -359,7 +356,7 @@ KeyCode vncPressLevelThree(void)
+@@ -371,7 +368,7 @@ KeyCode vncPressLevelThree(void)
return 0;
}
act = XkbKeyActionPtr(xkb, keycode, state);
if (act == NULL)
-@@ -390,7 +387,7 @@ size_t vncReleaseLevelThree(KeyCode *key
+@@ -402,7 +399,7 @@ size_t vncReleaseLevelThree(KeyCode *keys, size_t maxKeys)
count = 0;
xkb = master->key->xkbInfo->desc;
for (key = xkb->min_key_code; key <= xkb->max_key_code; key++) {
XkbAction *act;
-@@ -433,7 +430,7 @@ KeyCode vncKeysymToKeycode(KeySym keysym
- if (new_state != NULL)
+@@ -447,7 +444,7 @@ KeyCode vncKeysymToKeycode(KeySym keysym, unsigned state, unsigned *new_state)
*new_state = state;
+ fallback = 0;
- xkb = GetMaster(vncKeyboardDev, KEYBOARD_OR_FLOAT)->key->xkbInfo->desc;
+ xkb = vncKeyboardDev->master->key->xkbInfo->desc;
for (key = xkb->min_key_code; key <= xkb->max_key_code; key++) {
unsigned int state_out;
KeySym dummy;
-@@ -511,7 +508,7 @@ int vncIsAffectedByNumLock(KeyCode keyco
+@@ -551,7 +548,7 @@ int vncIsAffectedByNumLock(KeyCode keycode)
if (numlock_keycode == 0)
return 0;
act = XkbKeyActionPtr(xkb, numlock_keycode, state);
if (act == NULL)
-@@ -545,7 +542,7 @@ KeyCode vncAddKeysym(KeySym keysym, unsi
+@@ -585,7 +582,7 @@ KeyCode vncAddKeysym(KeySym keysym, unsigned state)
KeySym *syms;
KeySym upper, lower;
-diff -urpa tigervnc-1.9.0.orig/unix/vncserver tigervnc-1.9.0/unix/vncserver
---- tigervnc-1.9.0.orig/unix/vncserver 2018-07-16 14:08:55.000000000 +0000
-+++ tigervnc-1.9.0/unix/vncserver 2018-08-20 19:13:35.035348535 +0000
-@@ -684,6 +684,7 @@ sub Usage
+diff --git a/unix/vncserver b/unix/vncserver
+index 68be032..ac0e993 100755
+--- a/unix/vncserver
++++ b/unix/vncserver
+@@ -678,6 +678,7 @@ sub Usage
" [-geometry <width>x<height>]\n".
" [-pixelformat rgbNNN|bgrNNN]\n".
" [-fp <font-path>]\n".
" [-fg]\n".
" [-autokill]\n".
" [-noxstartup]\n".
-diff -urpa tigervnc-1.9.0.orig/vncviewer/vncviewer.cxx tigervnc-1.9.0/vncviewer/vncviewer.cxx
---- tigervnc-1.9.0.orig/vncviewer/vncviewer.cxx 2018-07-16 14:08:55.000000000 +0000
-+++ tigervnc-1.9.0/vncviewer/vncviewer.cxx 2018-08-20 19:13:35.035348535 +0000
-@@ -353,6 +353,11 @@ static void usage(const char *programNam
- " %s [parameters] [.tigervnc file]\n",
- programName, programName, programName);
- fprintf(stderr,"\n"
-+ "Options:\n\n"
-+ " -display Xdisplay - Specifies the X display for the viewer window\n"
-+ " -geometry geometry - Standard X position and sizing specification.\n");
-+
-+ fprintf(stderr,"\n"
- "Parameters can be turned on with -<param> or off with -<param>=0\n"
- "Parameters which take a value can be specified as "
- "-<param> <value>\n"
--- /dev/null
+diff --git a/common/rfb/Password.cxx b/common/rfb/Password.cxx
+index e4a508c..f555c57 100644
+--- a/common/rfb/Password.cxx
++++ b/common/rfb/Password.cxx
+@@ -55,7 +55,7 @@ PlainPasswd::~PlainPasswd() {
+
+ void PlainPasswd::replaceBuf(char* b) {
+ if (buf)
+- memset(buf, 0, strlen(buf));
++ memset(buf, 0, length ? length : strlen(buf));
+ CharArray::replaceBuf(b);
+ }
+
+diff --git a/common/rfb/util.h b/common/rfb/util.h
+index 3100f90..764692a 100644
+--- a/common/rfb/util.h
++++ b/common/rfb/util.h
+@@ -51,16 +51,21 @@ namespace rfb {
+ CharArray() : buf(0) {}
+ CharArray(char* str) : buf(str) {} // note: assumes ownership
+ CharArray(size_t len) {
++ length = len;
+ buf = new char[len]();
+ }
+ ~CharArray() {
+- delete [] buf;
++ if (buf) {
++ delete [] buf;
++ buf = nullptr;
++ }
+ }
+ void format(const char *fmt, ...) __printf_attr(2, 3);
+ // Get the buffer pointer & clear it (i.e. caller takes ownership)
+ char* takeBuf() {char* tmp = buf; buf = 0; return tmp;}
+- void replaceBuf(char* b) {delete [] buf; buf = b;}
++ void replaceBuf(char* b) {if (buf) delete [] buf; buf = b;}
+ char* buf;
++ size_t length = 0;
+ private:
+ CharArray(const CharArray&);
+ CharArray& operator=(const CharArray&);
+++ /dev/null
-diff --git a/common/rfb/Security.cxx b/common/rfb/Security.cxx
-index e623ab5..4987b29 100644
---- a/common/rfb/Security.cxx
-+++ b/common/rfb/Security.cxx
-@@ -52,7 +52,7 @@ static LogWriter vlog("Security");
- #ifdef HAVE_GNUTLS
- StringParameter Security::GnuTLSPriority("GnuTLSPriority",
- "GnuTLS priority string that controls the TLS session’s handshake algorithms",
-- "NORMAL");
-+ "@SYSTEM");
- #endif
-
- Security::Security()
Summary: A TigerVNC remote display system
Summary(pl.UTF-8): System zdalnego dostępu TigerVNC
Name: tigervnc
-Version: 1.9.0
-Release: 2
+Version: 1.10.1
+Release: 1
License: GPL v2
Group: X11/Applications/Networking
Source0: https://github.com/TigerVNC/tigervnc/archive/v%{version}.tar.gz?/%{name}-%{version}.tar.gz
-# Source0-md5: c2f9ea552431cb8ae7f7af7300f3b53f
+# Source0-md5: 0c38334c7a52d304c30fac7802125a49
Source1: %{name}.desktop
Source2: vncserver.init
Source3: vncserver.sysconfig
Patch0: %{name}-manpages.patch
Patch1: %{name}-shebang.patch
-Patch2: %{name}-utilize-system-crypto-policies.patch
+Patch2: %{name}-passwd-crash-with-malloc-checks.patch
Patch3: %{name}-xstartup.patch
Patch4: %{name}-getmaster.patch
+Patch5: 0001-xserver-add-no-op-input-thread-init-function.patch
Patch100: xserver.patch
+Patch101: libdrm.patch
URL: http://www.tigervnc.com/
BuildRequires: ImageMagick
BuildRequires: ImageMagick-coder-png
BuildRequires: xorg-lib-libXdmcp-devel
BuildRequires: xorg-lib-libXext-devel >= 1.0.99.4
BuildRequires: xorg-lib-libXfont-devel >= 1.4.2
+BuildRequires: xorg-lib-libXfont2-devel >= 2.0
BuildRequires: xorg-lib-libXi-devel >= 1.2.99.1
BuildRequires: xorg-lib-libXmu-devel
BuildRequires: xorg-lib-libXpm-devel
%patch2 -p1
%patch3 -p1
%patch4 -p1
+%patch5 -p1
cp -a %{_usrsrc}/xorg-xserver-server-%{_xserverver}/* unix/xserver
cd unix/xserver
+
%patch100 -p1
+%patch101 -p1
%build
%cmake .
-Index: xserver/configure.ac
-===================================================================
---- xserver.orig/configure.ac
-+++ xserver/configure.ac
+diff -up xserver/configure.ac.xserver116-rebased xserver/configure.ac
+--- xserver/configure.ac.xserver116-rebased 2016-09-29 13:14:45.595441590 +0200
++++ xserver/configure.ac 2016-09-29 13:14:45.631442006 +0200
@@ -74,6 +74,7 @@ dnl forcing an entire recompile.x
AC_CONFIG_HEADERS(include/version-config.h)
-
+
AM_PROG_AS
+AC_PROG_CXX
AC_PROG_LN_S
LT_PREREQ([2.2])
LT_INIT([disable-static win32-dll])
-@@ -1777,6 +1778,10 @@ if test "x$XVFB" = xyes; then
+@@ -1863,6 +1864,10 @@ if test "x$XVFB" = xyes; then
AC_SUBST([XVFB_SYS_LIBS])
fi
-
+
+dnl Xvnc DDX
+AC_SUBST([XVNC_CPPFLAGS], ["-DHAVE_DIX_CONFIG_H $XSERVER_CFLAGS"])
+AC_SUBST([XVNC_LIBS], ["$FB_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $MAIN_LIB"])
+AC_SUBST([XVNC_SYS_LIBS], ["$GLX_SYS_LIBS"])
-
+
dnl Xnest DDX
-
-@@ -1812,6 +1817,8 @@ if test "x$XORG" = xauto; then
+
+@@ -1898,6 +1903,8 @@ if test "x$XORG" = xauto; then
fi
AC_MSG_RESULT([$XORG])
-
+
+AC_DEFINE_UNQUOTED(XORG_VERSION_CURRENT, [$VENDOR_RELEASE], [Current Xorg version])
+
if test "x$XORG" = xyes; then
XORG_DDXINCS='-I$(top_srcdir)/hw/xfree86 -I$(top_srcdir)/hw/xfree86/include -I$(top_srcdir)/hw/xfree86/common'
XORG_OSINCS='-I$(top_srcdir)/hw/xfree86/os-support -I$(top_srcdir)/hw/xfree86/os-support/bus -I$(top_srcdir)/os'
-@@ -2029,7 +2036,6 @@ if test "x$XORG" = xyes; then
+@@ -2116,7 +2123,6 @@ if test "x$XORG" = xyes; then
AC_DEFINE(XORG_SERVER, 1, [Building Xorg server])
AC_DEFINE(XORGSERVER, 1, [Building Xorg server])
AC_DEFINE(XFree86Server, 1, [Building XFree86 server])
AC_DEFINE(NEED_XF86_TYPES, 1, [Need XFree86 typedefs])
AC_DEFINE(NEED_XF86_PROTOTYPES, 1, [Need XFree86 helper functions])
AC_DEFINE(__XSERVERNAME__, "Xorg", [Name of X server])
-@@ -2565,6 +2571,7 @@ hw/dmx/Makefile
+@@ -2691,6 +2697,7 @@ hw/dmx/Makefile
hw/dmx/man/Makefile
hw/vfb/Makefile
hw/vfb/man/Makefile
hw/xnest/Makefile
hw/xnest/man/Makefile
hw/xwin/Makefile
-Index: xserver/hw/Makefile.am
-===================================================================
---- xserver.orig/hw/Makefile.am
-+++ xserver/hw/Makefile.am
+diff -up xserver/hw/Makefile.am.xserver116-rebased xserver/hw/Makefile.am
+--- xserver/hw/Makefile.am.xserver116-rebased 2016-09-29 13:14:45.601441659 +0200
++++ xserver/hw/Makefile.am 2016-09-29 13:14:45.631442006 +0200
@@ -38,7 +38,8 @@ SUBDIRS = \
$(DMX_SUBDIRS) \
$(KDRIVE_SUBDIRS) \
- $(XWAYLAND_SUBDIRS)
+ $(XWAYLAND_SUBDIRS) \
+ vnc
-
+
DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive xwayland
-
-Index: xserver/mi/miinitext.c
-===================================================================
---- xserver.orig/mi/miinitext.c
+
+diff --git xserver/mi/miinitext.c xserver/mi/miinitext.c
+index 5596e21..003fc3c 100644
+--- xserver/mi/miinitext.c
+++ xserver/mi/miinitext.c
@@ -107,8 +107,15 @@ SOFTWARE.
#include "os.h"
#include "globals.h"
-
+
+#ifdef TIGERVNC
-+extern void vncExtensionInit(void);
++extern void vncExtensionInit(INITARGS);
+#endif
+
/* List of built-in (statically linked) extensions */
{GEExtensionInit, "Generic Event Extension", &noGEExtension},
{ShapeExtensionInit, "SHAPE", NULL},
#ifdef MITSHM
-diff -ur xserver.orig/dri3/Makefile.am xserver/dri3/Makefile.am
---- xserver.orig/dri3/Makefile.am 2018-05-10 16:32:34.000000000 +0000
-+++ xserver/dri3/Makefile.am 2018-07-04 13:08:37.614326450 +0000
-@@ -1,7 +1,7 @@
- noinst_LTLIBRARIES = libdri3.la
- AM_CFLAGS = \
- -DHAVE_XORG_CONFIG_H \
-- @DIX_CFLAGS@ @XORG_CFLAGS@
-+ @DIX_CFLAGS@ @XORG_CFLAGS@ @LIBDRM_CFLAGS@
-
- libdri3_la_SOURCES = \
- dri3.h \
+--- xserver/include/os.h~ 2016-10-03 09:07:29.000000000 +0200
++++ xserver/include/os.h 2016-10-03 14:13:00.013654506 +0200
+@@ -621,7 +621,7 @@
+ extern _X_EXPORT void
+ LogClose(enum ExitCode error);
+ extern _X_EXPORT Bool
+-LogSetParameter(LogParameter param, int value);
++LogSetParameter(enum _LogParameter param, int value);
+ extern _X_EXPORT void
+ LogVWrite(int verb, const char *f, va_list args)
+ _X_ATTRIBUTE_PRINTF(2, 0);