diff --git a/.gitignore b/.gitignore index a9c89fd..923db3a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/tigervnc-1.3.1.tar.gz +SOURCES/tigervnc-1.8.0.tar.gz diff --git a/.tigervnc.metadata b/.tigervnc.metadata index a4c986b..fc4bd8c 100644 --- a/.tigervnc.metadata +++ b/.tigervnc.metadata @@ -1 +1 @@ -2253b5460bd5a450b10b1c42eb97b4215c3efd99 SOURCES/tigervnc-1.3.1.tar.gz +dbb280afb066073d7b44e99bd75d7f9bdb5a81e0 SOURCES/tigervnc-1.8.0.tar.gz diff --git a/SOURCES/0001-rpath-hack.patch b/SOURCES/0001-rpath-hack.patch index a0c3c10..689de34 100644 --- a/SOURCES/0001-rpath-hack.patch +++ b/SOURCES/0001-rpath-hack.patch @@ -15,14 +15,14 @@ diff --git a/configure.ac b/configure.ac index fa15a2d..a5af1e0 100644 --- a/configure.ac +++ b/configure.ac -@@ -1330,6 +1330,7 @@ if test "x$GLX_USE_TLS" = xyes ; then - GLX_DEFINES="-DGLX_USE_TLS -DPTHREADS" - GLX_SYS_LIBS="$GLX_SYS_LIBS -lpthread" +@@ -1357,6 +1357,7 @@ else fi + AM_CONDITIONAL(GLX, test "x$GLX" = xyes) + +GLX_SYS_LIBS="$GLX_SYS_LIBS -Wl,-rpath=\$(libdir)" AC_SUBST([GLX_DEFINES]) AC_SUBST([GLX_SYS_LIBS]) - --- + +-- 2.5.0 diff --git a/SOURCES/tigervnc-1.3.1-CVE-2014-8240.patch b/SOURCES/tigervnc-1.3.1-CVE-2014-8240.patch index 9267c8c..09217f1 100644 --- a/SOURCES/tigervnc-1.3.1-CVE-2014-8240.patch +++ b/SOURCES/tigervnc-1.3.1-CVE-2014-8240.patch @@ -1,5 +1,5 @@ diff --git a/unix/x0vncserver/Image.cxx b/unix/x0vncserver/Image.cxx -index f998c6a..d113f17 100644 +index f998c6a..fb9dbd4 100644 --- a/unix/x0vncserver/Image.cxx +++ b/unix/x0vncserver/Image.cxx @@ -80,6 +80,14 @@ void Image::Init(int width, int height) @@ -35,27 +35,27 @@ index f998c6a..d113f17 100644 shminfo->shmid = shmget(IPC_PRIVATE, xim->bytes_per_line * xim->height, IPC_CREAT|0777); -diff --git a/vncviewer/X11PixelBuffer.cxx b/vncviewer/X11PixelBuffer.cxx -index bd0610c..2c493c9 100644 ---- a/vncviewer/X11PixelBuffer.cxx -+++ b/vncviewer/X11PixelBuffer.cxx -@@ -105,6 +105,15 @@ PlatformPixelBuffer::PlatformPixelBuffer(int width, int height) : - ZPixmap, 0, 0, width, height, BitmapPad(fl_display), 0); - assert(xim); +diff --git a/vncviewer/PlatformPixelBuffer.cxx b/vncviewer/PlatformPixelBuffer.cxx +index a2b506d..9266d9f 100644 +--- a/vncviewer/PlatformPixelBuffer.cxx ++++ b/vncviewer/PlatformPixelBuffer.cxx +@@ -49,6 +49,15 @@ PlatformPixelBuffer::PlatformPixelBuffer(int width, int height) : + if (!xim) + throw rdr::Exception("XCreateImage"); + if (xim->bytes_per_line <= 0 || -+ xim->height <= 0 || -+ xim->height >= INT_MAX / xim->bytes_per_line) { ++ xim->height <= 0 || ++ xim->height >= INT_MAX / xim->bytes_per_line) { + if (xim) -+ XDestroyImage(xim); ++ XDestroyImage(xim); + xim = NULL; -+ throw rfb::Exception("Invalid display size"); ++ throw rdr::Exception("Invalid display size"); + } + xim->data = (char*)malloc(xim->bytes_per_line * xim->height); - assert(xim->data); - } -@@ -169,6 +178,16 @@ int PlatformPixelBuffer::setupShm() + if (!xim->data) + throw rdr::Exception("malloc"); +@@ -152,6 +161,16 @@ bool PlatformPixelBuffer::setupShm() if (!xim) goto free_shminfo; @@ -66,9 +66,9 @@ index bd0610c..2c493c9 100644 + xim = NULL; + delete shminfo; + shminfo = NULL; -+ throw rfb::Exception("Invalid display size"); ++ throw rdr::Exception("Invalid display size"); + } + shminfo->shmid = shmget(IPC_PRIVATE, xim->bytes_per_line * xim->height, - IPC_CREAT|0777); + IPC_CREAT|0600); diff --git a/SOURCES/tigervnc-1.3.1-repair-so-reuseaddr.patch b/SOURCES/tigervnc-1.3.1-repair-so-reuseaddr.patch deleted file mode 100644 index 7443f3f..0000000 --- a/SOURCES/tigervnc-1.3.1-repair-so-reuseaddr.patch +++ /dev/null @@ -1,27 +0,0 @@ -diff --git a/common/network/TcpSocket.cxx b/common/network/TcpSocket.cxx -index 83387ab..0d94522 100644 ---- a/common/network/TcpSocket.cxx -+++ b/common/network/TcpSocket.cxx -@@ -434,10 +434,6 @@ TcpListener::TcpListener(const struct sockaddr *listenaddr, - } - #endif /* defined(IPV6_V6ONLY) */ - -- if (bind(sock, &sa.u.sa, listenaddrlen) == -1) { -- closesocket(sock); -- throw SocketException("failed to bind socket", errorNumber); -- } - #ifndef WIN32 - // - By default, close the socket on exec() - fcntl(sock, F_SETFD, FD_CLOEXEC); -@@ -452,6 +448,11 @@ TcpListener::TcpListener(const struct sockaddr *listenaddr, - fd = sock; - #endif - -+ if (bind(sock, &sa.u.sa, listenaddrlen) == -1) { -+ closesocket(sock); -+ throw SocketException("failed to bind socket", errorNumber); -+ } -+ - // - Set it to be a listening socket - if (listen(sock, 5) < 0) { - int e = errorNumber; diff --git a/SOURCES/tigervnc-1.3.1-xserver-1.16.patch b/SOURCES/tigervnc-1.3.1-xserver-1.16.patch deleted file mode 100644 index eb6a9c8..0000000 --- a/SOURCES/tigervnc-1.3.1-xserver-1.16.patch +++ /dev/null @@ -1,286 +0,0 @@ -diff -up tigervnc-1.3.0/unix/xserver/hw/vnc/xorg-version.h.jx tigervnc-1.3.0/unix/xserver/hw/vnc/xorg-version.h ---- tigervnc-1.3.0/unix/xserver/hw/vnc/xorg-version.h.jx 2013-07-01 08:41:24.000000000 -0400 -+++ tigervnc-1.3.0/unix/xserver/hw/vnc/xorg-version.h 2013-11-07 11:39:49.749992669 -0500 -@@ -44,8 +44,12 @@ - #define XORG 113 - #elif XORG_VERSION_CURRENT < ((1 * 10000000) + (14 * 100000) + (99 * 1000)) - #define XORG 114 -+#elif XORG_VERSION_CURRENT < ((1 * 10000000) + (15 * 100000) + (99 * 1000)) -+#define XORG 115 -+#elif XORG_VERSION_CURRENT < ((1 * 10000000) + (16 * 100000) + (99 * 1000)) -+#define XORG 116 - #else --#error "X.Org newer than 1.14 is not supported" -+#error "X.Org newer than 1.16 is not supported" - #endif - - #endif - -diff -up tigervnc-1.3.1/unix/xserver/hw/vnc/Input.cc.116 tigervnc-1.3.1/unix/xserver/hw/vnc/Input.cc ---- tigervnc-1.3.1/unix/xserver/hw/vnc/Input.cc.116 2013-05-30 16:53:40.000000000 +0200 -+++ tigervnc-1.3.1/unix/xserver/hw/vnc/Input.cc 2014-04-28 16:55:02.591440218 +0200 -@@ -262,7 +262,7 @@ static int pointerProc(DeviceIntPtr pDev - return Success; - } - --static void keyboardBell(int percent, DeviceIntPtr device, pointer ctrl, -+static void keyboardBell(int percent, DeviceIntPtr device, void * ctrl, - int class_) - { - if (percent > 0) -diff -up tigervnc-1.3.1/unix/xserver/hw/vnc/XserverDesktop.cc.116 tigervnc-1.3.1/unix/xserver/hw/vnc/XserverDesktop.cc ---- tigervnc-1.3.1/unix/xserver/hw/vnc/XserverDesktop.cc.116 2014-04-28 16:55:02.530441812 +0200 -+++ tigervnc-1.3.1/unix/xserver/hw/vnc/XserverDesktop.cc 2014-04-28 16:55:02.592440192 +0200 -@@ -48,7 +48,7 @@ extern "C" { - #define public c_public - #define class c_class - --extern char *display; -+extern const char *display; - - #include "colormapst.h" - #ifdef RANDR -@@ -174,7 +174,7 @@ void XserverDesktop::serverReset(ScreenP - { - pScreen = pScreen_; - int i; -- pointer retval; -+ void * retval; - - #if XORG >= 17 - #define dixLookupResource dixLookupResourceByType -diff -up tigervnc-1.3.1/unix/xserver/hw/vnc/vncExtInit.cc.116 tigervnc-1.3.1/unix/xserver/hw/vnc/vncExtInit.cc ---- tigervnc-1.3.1/unix/xserver/hw/vnc/vncExtInit.cc.116 2014-04-28 16:55:02.524441969 +0200 -+++ tigervnc-1.3.1/unix/xserver/hw/vnc/vncExtInit.cc 2014-04-28 16:55:02.592440192 +0200 -@@ -65,18 +65,18 @@ extern "C" { - - extern void vncExtensionInit(); - static void vncResetProc(ExtensionEntry* extEntry); -- static void vncBlockHandler(pointer data, OSTimePtr t, pointer readmask); -- static void vncWakeupHandler(pointer data, int nfds, pointer readmask); -+ static void vncBlockHandler(void * data, OSTimePtr t, void * readmask); -+ static void vncWakeupHandler(void * data, int nfds, void * readmask); - void vncWriteBlockHandler(fd_set *fds); - void vncWriteWakeupHandler(int nfds, fd_set *fds); -- static void vncClientStateChange(CallbackListPtr*, pointer, pointer); -+ static void vncClientStateChange(CallbackListPtr*, void *, void *); - static void SendSelectionChangeEvent(Atom selection); - static int ProcVncExtDispatch(ClientPtr client); - static int SProcVncExtDispatch(ClientPtr client); -- static void vncSelectionCallback(CallbackListPtr *callbacks, pointer data, -- pointer args); -+ static void vncSelectionCallback(CallbackListPtr *callbacks, void * data, -+ void * args); - -- extern char *display; -+ extern const char *display; - extern char *listenaddr; - } - -@@ -284,7 +284,7 @@ static void vncResetProc(ExtensionEntry* - { - } - --static void vncSelectionCallback(CallbackListPtr *callbacks, pointer data, pointer args) -+static void vncSelectionCallback(CallbackListPtr *callbacks, void * data, void * args) - { - SelectionInfoRec *info = (SelectionInfoRec *) args; - Selection *selection = info->selection; -@@ -301,7 +301,7 @@ static void vncWriteWakeupHandlerFallbac - // selections have changed, and if so, notify any interested X clients. - // - --static void vncBlockHandler(pointer data, OSTimePtr timeout, pointer readmask) -+static void vncBlockHandler(void * data, OSTimePtr timeout, void * readmask) - { - fd_set* fds = (fd_set*)readmask; - -@@ -312,7 +312,7 @@ static void vncBlockHandler(pointer data - desktop[scr]->blockHandler(fds, timeout); - } - --static void vncWakeupHandler(pointer data, int nfds, pointer readmask) -+static void vncWakeupHandler(void * data, int nfds, void * readmask) - { - fd_set* fds = (fd_set*)readmask; - -@@ -402,7 +402,7 @@ static void vncWriteWakeupHandlerFallbac - vncWriteWakeupHandler(ret, &fallbackFds); - } - --static void vncClientStateChange(CallbackListPtr*, pointer, pointer p) -+static void vncClientStateChange(CallbackListPtr*, void *, void * p) - { - ClientPtr client = ((NewClientInfoRec*)p)->client; - if (client->clientState == ClientStateGone) { -@@ -468,7 +468,7 @@ void vncClientCutText(const char* str, i - - - static CARD32 queryConnectTimerCallback(OsTimerPtr timer, -- CARD32 now, pointer arg) -+ CARD32 now, void * arg) - { - if (queryConnectTimeout) - queryConnectDesktop->approveConnection(queryConnectId, false, "The attempt to prompt the user to accept the connection failed"); -diff -up tigervnc-1.3.1/unix/xserver/hw/vnc/vncHooks.cc.116 tigervnc-1.3.1/unix/xserver/hw/vnc/vncHooks.cc ---- tigervnc-1.3.1/unix/xserver/hw/vnc/vncHooks.cc.116 2013-05-22 14:57:16.000000000 +0200 -+++ tigervnc-1.3.1/unix/xserver/hw/vnc/vncHooks.cc 2014-04-28 16:55:02.593440166 +0200 -@@ -91,8 +91,8 @@ typedef struct { - } vncHooksScreenRec, *vncHooksScreenPtr; - - typedef struct { -- GCFuncs *wrappedFuncs; -- GCOps *wrappedOps; -+ const GCFuncs *wrappedFuncs; -+ const GCOps *wrappedOps; - } vncHooksGCRec, *vncHooksGCPtr; - - #if XORG == 15 -@@ -141,11 +141,11 @@ static Bool vncHooksDisplayCursor( - #endif - ScreenPtr pScreen, CursorPtr cursor); - #if XORG < 112 --static void vncHooksBlockHandler(int i, pointer blockData, pointer pTimeout, -- pointer pReadmask); -+static void vncHooksBlockHandler(int i, void * blockData, void * pTimeout, -+ void * pReadmask); - #else --static void vncHooksBlockHandler(ScreenPtr pScreen, pointer pTimeout, -- pointer pReadmask); -+static void vncHooksBlockHandler(ScreenPtr pScreen, void * pTimeout, -+ void * pReadmask); - #endif - #ifdef RENDER - static void vncHooksComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, -@@ -174,7 +174,7 @@ static void vncHooksValidateGC(GCPtr pGC - static void vncHooksChangeGC(GCPtr pGC, unsigned long mask); - static void vncHooksCopyGC(GCPtr src, unsigned long mask, GCPtr dst); - static void vncHooksDestroyGC(GCPtr pGC); --static void vncHooksChangeClip(GCPtr pGC, int type, pointer pValue,int nrects); -+static void vncHooksChangeClip(GCPtr pGC, int type, void * pValue,int nrects); - static void vncHooksDestroyClip(GCPtr pGC); - static void vncHooksCopyClip(GCPtr dst, GCPtr src); - -@@ -226,10 +226,10 @@ static void vncHooksImageText16(Drawable - int count, unsigned short *chars); - static void vncHooksImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, - int y, unsigned int nglyph, -- CharInfoPtr *ppci, pointer pglyphBase); -+ CharInfoPtr *ppci, void * pglyphBase); - static void vncHooksPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, - int y, unsigned int nglyph, -- CharInfoPtr *ppci, pointer pglyphBase); -+ CharInfoPtr *ppci, void * pglyphBase); - static void vncHooksPushPixels(GCPtr pGC, PixmapPtr pBitMap, - DrawablePtr pDrawable, int w, int h, int x, - int y); -@@ -575,11 +575,11 @@ static Bool vncHooksDisplayCursor( - // these are just drawing the cursor. - - #if XORG < 112 --static void vncHooksBlockHandler(int i, pointer blockData, pointer pTimeout, -- pointer pReadmask) -+static void vncHooksBlockHandler(int i, void * blockData, void * pTimeout, -+ void * pReadmask) - #else --static void vncHooksBlockHandler(ScreenPtr pScreen_, pointer pTimeout, -- pointer pReadmask) -+static void vncHooksBlockHandler(ScreenPtr pScreen_, void * pTimeout, -+ void * pReadmask) - #endif - { - #if XORG < 112 -@@ -914,7 +914,7 @@ static void vncHooksDestroyGC(GCPtr pGC) - GCFuncUnwrapper u(pGC); - (*pGC->funcs->DestroyGC) (pGC); - } --static void vncHooksChangeClip(GCPtr pGC, int type, pointer pValue, int nrects) -+static void vncHooksChangeClip(GCPtr pGC, int type, void * pValue, int nrects) - { - GCFuncUnwrapper u(pGC); - (*pGC->funcs->ChangeClip) (pGC, type, pValue, nrects); -@@ -954,7 +954,7 @@ public: - } - GCPtr pGC; - vncHooksGCPtr vncHooksGC; -- GCFuncs* oldFuncs; -+ const GCFuncs* oldFuncs; - ScreenPtr pScreen; - }; - -@@ -1793,7 +1793,7 @@ static void vncHooksImageText16(Drawable - - static void vncHooksImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, - int y, unsigned int nglyph, -- CharInfoPtr *ppci, pointer pglyphBase) -+ CharInfoPtr *ppci, void * pglyphBase) - { - GC_OP_UNWRAPPER(pDrawable, pGC, ImageGlyphBlt); - -@@ -1819,7 +1819,7 @@ static void vncHooksImageGlyphBlt(Drawab - - static void vncHooksPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, - int y, unsigned int nglyph, -- CharInfoPtr *ppci, pointer pglyphBase) -+ CharInfoPtr *ppci, void * pglyphBase) - { - GC_OP_UNWRAPPER(pDrawable, pGC, PolyGlyphBlt); - -diff -up tigervnc-1.3.1/unix/xserver/hw/vnc/xf86vncModule.cc.116 tigervnc-1.3.1/unix/xserver/hw/vnc/xf86vncModule.cc ---- tigervnc-1.3.1/unix/xserver/hw/vnc/xf86vncModule.cc.116 2013-03-14 18:52:53.000000000 +0100 -+++ tigervnc-1.3.1/unix/xserver/hw/vnc/xf86vncModule.cc 2014-04-28 16:55:02.593440166 +0200 -@@ -81,11 +81,11 @@ static XF86ModuleVersionInfo vncVersRec - - _X_EXPORT XF86ModuleData vncModuleData = { &vncVersRec, vncSetup, NULL }; - --static pointer --vncSetup(pointer module, pointer opts, int *errmaj, int *errmin) { -- LoadExtension(&vncExt, FALSE); -+static void * -+vncSetup(void * module, void * opts, int *errmaj, int *errmin) { -+ LoadExtensionList(&vncExt, 1, FALSE); - /* Need a non-NULL return value to indicate success */ -- return (pointer)1; -+ return (void *)1; - } - - static void vncExtensionInitWithParams(INITARGS) -diff -up tigervnc-1.3.1/unix/xserver/hw/vnc/xvnc.cc.116 tigervnc-1.3.1/unix/xserver/hw/vnc/xvnc.cc ---- tigervnc-1.3.1/unix/xserver/hw/vnc/xvnc.cc.116 2014-03-19 13:11:09.000000000 +0100 -+++ tigervnc-1.3.1/unix/xserver/hw/vnc/xvnc.cc 2014-04-28 16:53:12.580314921 +0200 -@@ -103,7 +103,7 @@ extern "C" { - "See http://www.tigervnc.org for information on TigerVNC.\n") - - --extern char *display; -+extern const char *display; - extern int monitorResolution; - - #define VFB_DEFAULT_WIDTH 1024 -@@ -762,7 +762,7 @@ vfbUninstallColormap(ColormapPtr pmap) - curpmap = (ColormapPtr) LookupIDByType(pmap->pScreen->defColormap, - RT_COLORMAP); - #else -- dixLookupResourceByType((pointer *) &curpmap, pmap->pScreen->defColormap, -+ dixLookupResourceByType((void * *) &curpmap, pmap->pScreen->defColormap, - RT_COLORMAP, serverClient, DixUnknownAccess); - #endif - (*pmap->pScreen->InstallColormap)(curpmap); -@@ -1597,7 +1597,7 @@ vfbScreenInit(ScreenPtr pScreen, int arg - } /* end vfbScreenInit */ - - --static void vfbClientStateChange(CallbackListPtr*, pointer, pointer) { -+static void vfbClientStateChange(CallbackListPtr*, void *, void *) { - dispatchException &= ~DE_RESET; - } - -@@ -1625,7 +1625,7 @@ InitOutput(ScreenInfo *screenInfo, int a - #if XORG >= 113 - #ifdef GLXEXT - if (serverGeneration == 1) -- LoadExtension(&glxExt, TRUE); -+ LoadExtensionList(&glxExt, 1, TRUE); - #endif - #endif - diff --git a/SOURCES/tigervnc-1.3.1-xserver-1.17.patch b/SOURCES/tigervnc-1.3.1-xserver-1.17.patch deleted file mode 100644 index 77f813b..0000000 --- a/SOURCES/tigervnc-1.3.1-xserver-1.17.patch +++ /dev/null @@ -1,44 +0,0 @@ -diff -up tigervnc-1.4.2/unix/xserver/hw/vnc/xorg-version.h.xserver117 tigervnc-1.4.2/unix/xserver/hw/vnc/xorg-version.h ---- tigervnc-1.4.2/unix/xserver/hw/vnc/xorg-version.h.xserver117 2015-01-23 23:37:23.000000000 +0000 -+++ tigervnc-1.4.2/unix/xserver/hw/vnc/xorg-version.h 2015-02-13 17:35:29.847294663 +0000 -@@ -48,8 +48,10 @@ - #define XORG 115 - #elif XORG_VERSION_CURRENT < ((1 * 10000000) + (16 * 100000) + (99 * 1000)) - #define XORG 116 -+#elif XORG_VERSION_CURRENT < ((1 * 10000000) + (17 * 100000) + (99 * 1000)) -+#define XORG 117 - #else --#error "X.Org newer than 1.16 is not supported" -+#error "X.Org newer than 1.17 is not supported" - #endif - - #endif -diff -up tigervnc-1.4.2/unix/xserver/hw/vnc/xvnc.cc.xserver117 tigervnc-1.4.2/unix/xserver/hw/vnc/xvnc.cc ---- tigervnc-1.4.2/unix/xserver/hw/vnc/xvnc.cc.xserver117 2015-01-23 23:37:23.000000000 +0000 -+++ tigervnc-1.4.2/unix/xserver/hw/vnc/xvnc.cc 2015-02-13 17:35:27.963265774 +0000 -@@ -717,9 +717,9 @@ vfbInstallColormap(ColormapPtr pmap) - entries = pmap->pVisual->ColormapEntries; - pVisual = pmap->pVisual; - -- ppix = (Pixel *)xalloc(entries * sizeof(Pixel)); -- prgb = (xrgb *)xalloc(entries * sizeof(xrgb)); -- defs = (xColorItem *)xalloc(entries * sizeof(xColorItem)); -+ ppix = (Pixel *)calloc(entries, sizeof(Pixel)); -+ prgb = (xrgb *)calloc(entries, sizeof(xrgb)); -+ defs = (xColorItem *)calloc(entries, sizeof(xColorItem)); - - for (i = 0; i < entries; i++) ppix[i] = i; - /* XXX truecolor */ -@@ -738,9 +738,9 @@ vfbInstallColormap(ColormapPtr pmap) - } - (*pmap->pScreen->StoreColors)(pmap, entries, defs); - -- xfree(ppix); -- xfree(prgb); -- xfree(defs); -+ free(ppix); -+ free(prgb); -+ free(defs); - } - } - diff --git a/SOURCES/tigervnc-CVE-2014-8241.patch b/SOURCES/tigervnc-CVE-2014-8241.patch deleted file mode 100644 index 56216cc..0000000 --- a/SOURCES/tigervnc-CVE-2014-8241.patch +++ /dev/null @@ -1,101 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 0e325e2..1d4e1bf 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -67,6 +67,14 @@ add_definitions(-D__BUILD__="${BUILD}") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -UNDEBUG") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -UNDEBUG") - -+# We want to keep our asserts even in release builds so remove NDEBUG -+set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -UNDEBUG") -+set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -UNDEBUG") -+set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -UNDEBUG") -+set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -UNDEBUG") -+set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -UNDEBUG") -+set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -UNDEBUG") -+ - if(NOT DEFINED BUILD_WINVNC) - set(BUILD_WINVNC 1) - endif() -diff --git a/common/Xregion/Region.c b/common/Xregion/Region.c -index 604ecde..4bb52ea 100644 ---- a/common/Xregion/Region.c -+++ b/common/Xregion/Region.c -@@ -1083,6 +1083,8 @@ miRegionOp(newReg, reg1, reg2, overlapFunc, nonOverlap1Func, nonOverlap2Func) - newReg->size = 1; - Xfree((char *) newReg->rects); - newReg->rects = (BoxPtr) Xmalloc(sizeof(BoxRec)); -+ if (! newReg->rects) -+ newReg->size = 0; - } - } - Xfree ((char *) oldRects); -diff --git a/unix/vncconfig/vncExt.c b/unix/vncconfig/vncExt.c -index ff5532b..c2e6d3c 100644 ---- a/unix/vncconfig/vncExt.c -+++ b/unix/vncconfig/vncExt.c -@@ -109,6 +109,10 @@ Bool XVncExtGetParam(Display* dpy, const char* param, char** value, int* len) - if (rep.success) { - *len = rep.valueLen; - *value = (char*) Xmalloc (*len+1); -+ if (!*value) { -+ _XEatData(dpy, (*len+1)&~1); -+ return False; -+ } - _XReadPad(dpy, *value, *len); - (*value)[*len] = 0; - } -@@ -141,6 +145,10 @@ char* XVncExtGetParamDesc(Display* dpy, const char* param) - } - if (rep.success) { - desc = (char*)Xmalloc(rep.descLen+1); -+ if (!*desc) { -+ _XEatData(dpy, (rep.descLen+1)&~1); -+ return False; -+ } - _XReadPad(dpy, desc, rep.descLen); - desc[rep.descLen] = 0; - } -@@ -243,6 +251,10 @@ Bool XVncExtGetClientCutText(Display* dpy, char** str, int* len) - SyncHandle(); - *len = rep.textLen; - *str = (char*) Xmalloc (*len+1); -+ if (!*str) { -+ _XEatData(dpy, (*len+1)&~1); -+ return False; -+ } - _XReadPad(dpy, *str, *len); - (*str)[*len] = 0; - return True; -@@ -312,9 +324,15 @@ Bool XVncExtGetQueryConnect(Display* dpy, char** addr, char** user, - SyncHandle(); - - *addr = Xmalloc(rep.addrLen+1); -+ *user = Xmalloc(rep.userLen+1); -+ if (!*addr || !*user) { -+ Xfree(*addr); -+ Xfree(*user); -+ _XEatData(dpy, (rep.addrLen+1)&~1 + (rep.userLen+1)&~1); -+ return False; -+ } - _XReadPad(dpy, *addr, rep.addrLen); - (*addr)[rep.addrLen] = 0; -- *user = Xmalloc(rep.userLen+1); - _XReadPad(dpy, *user, rep.userLen); - (*user)[rep.userLen] = 0; - *timeout = rep.timeout; -diff --git a/unix/vncconfig/vncconfig.cxx b/unix/vncconfig/vncconfig.cxx -index f70cc71..bffdfbe 100644 ---- a/unix/vncconfig/vncconfig.cxx -+++ b/unix/vncconfig/vncconfig.cxx -@@ -215,6 +215,10 @@ public: - if (cutText) - XFree(cutText); - cutText = (char*)malloc(nitems); // assuming XFree() same as free() -+ if (!cutText) { -+ vlog.error("unable to allocate selection buffer"); -+ return; -+ } - memcpy(cutText, data, nitems); - cutTextLen = nitems; - vlog.debug("sending %s selection as server cut text: '%.*s%s'", diff --git a/SOURCES/tigervnc-check-return-value-from-xshmattach.patch b/SOURCES/tigervnc-check-return-value-from-xshmattach.patch deleted file mode 100644 index a3b011a..0000000 --- a/SOURCES/tigervnc-check-return-value-from-xshmattach.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/vncviewer/X11PixelBuffer.cxx b/vncviewer/X11PixelBuffer.cxx -index 548591e..bd0610c 100644 ---- a/vncviewer/X11PixelBuffer.cxx -+++ b/vncviewer/X11PixelBuffer.cxx -@@ -186,7 +186,11 @@ int PlatformPixelBuffer::setupShm() - caughtError = false; - old_handler = XSetErrorHandler(XShmAttachErrorHandler); - -- XShmAttach(fl_display, shminfo); -+ if (!XShmAttach(fl_display, shminfo)) { -+ XSetErrorHandler(old_handler); -+ goto free_shmaddr; -+ } -+ - XSync(fl_display, False); - - XSetErrorHandler(old_handler); diff --git a/SOURCES/tigervnc-cookie.patch b/SOURCES/tigervnc-cookie.patch deleted file mode 100644 index c066a5f..0000000 --- a/SOURCES/tigervnc-cookie.patch +++ /dev/null @@ -1,37 +0,0 @@ -diff -up tigervnc-1.0.90-20091221svn3929/unix/vncserver.cookie tigervnc-1.0.90-20091221svn3929/unix/vncserver ---- tigervnc-1.0.90-20091221svn3929/unix/vncserver.cookie 2009-11-12 11:39:54.000000000 +0100 -+++ tigervnc-1.0.90-20091221svn3929/unix/vncserver 2009-12-21 16:15:01.907799091 +0100 -@@ -189,27 +189,12 @@ $vncPort = 5900 + $displayNumber; - $desktopLog = "$vncUserDir/$host:$displayNumber.log"; - unlink($desktopLog); - --# Make an X server cookie - use /dev/urandom on systems that have it, --# otherwise use perl's random number generator, seeded with the sum --# of the current time, our PID and part of the encrypted form of the password. -- --my $cookie = ""; --if (open(URANDOM, '<', '/dev/urandom')) { -- my $randata; -- if (sysread(URANDOM, $randata, 16) == 16) { -- $cookie = unpack 'h*', $randata; -- } -- close(URANDOM); --} --if ($cookie eq "") { -- srand(time+$$+unpack("L",`cat $vncUserDir/passwd`)); -- for (1..16) { -- $cookie .= sprintf("%02x", int(rand(256)) % 256); -- } --} -- --system("xauth -f $xauthorityFile add $host:$displayNumber . $cookie"); --system("xauth -f $xauthorityFile add $host/unix:$displayNumber . $cookie"); -+# Make an X server cookie - use mcookie -+$cookie = `/usr/bin/mcookie`; -+open (XAUTH, "|xauth -f $xauthorityFile source -"); -+print XAUTH "add $host:$displayNumber . $cookie\n"; -+print XAUTH "add $host/unix:$displayNumber . $cookie\n"; -+close XAUTH; - - if ($opt{'-name'}) { - $desktopName = $opt{'-name'}; diff --git a/SOURCES/tigervnc-cursor.patch b/SOURCES/tigervnc-cursor.patch index 349c950..1f95df8 100644 --- a/SOURCES/tigervnc-cursor.patch +++ b/SOURCES/tigervnc-cursor.patch @@ -1,12 +1,12 @@ diff -up tigervnc-1.3.0/vncviewer/Viewport.cxx.cursor tigervnc-1.3.0/vncviewer/Viewport.cxx --- tigervnc-1.3.0/vncviewer/Viewport.cxx.cursor 2013-12-17 13:28:23.170400013 +0000 +++ tigervnc-1.3.0/vncviewer/Viewport.cxx 2013-12-17 13:29:46.095784064 +0000 -@@ -931,7 +931,7 @@ void Viewport::popupContextMenu() - - // Back to our proper mouse pointer. - #ifdef HAVE_FLTK_CURSOR +@@ -248,7 +248,7 @@ void Viewport::setCursor(int width, int height, const Point& hotspot, + } + } + - if (Fl::belowmouse() == this) + if (Fl::belowmouse() == this && cursor) window()->cursor(cursor, cursorHotspot.x, cursorHotspot.y); - #endif - + } + diff --git a/SOURCES/tigervnc-inetd-crash.patch b/SOURCES/tigervnc-inetd-crash.patch deleted file mode 100644 index b6445de..0000000 --- a/SOURCES/tigervnc-inetd-crash.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/unix/xserver/hw/vnc/xvnc.cc b/unix/xserver/hw/vnc/xvnc.cc -index 5c0e171..c79ad18 100644 ---- a/unix/xserver/hw/vnc/xvnc.cc -+++ b/unix/xserver/hw/vnc/xvnc.cc -@@ -352,7 +352,10 @@ static - bool displayNumFree(int num) - { - try { -- network::TcpListener l(NULL, 6000+num); -+ // Attempt to create TCPListeners on that port. -+ // They go out of scope immediately and are destroyed. -+ std::list dummy; -+ network::createTcpListeners (&dummy, 0, 6000+num); - } catch (rdr::Exception& e) { - return false; - } diff --git a/SOURCES/tigervnc-inetd-nowait.patch b/SOURCES/tigervnc-inetd-nowait.patch deleted file mode 100644 index 89b3d19..0000000 --- a/SOURCES/tigervnc-inetd-nowait.patch +++ /dev/null @@ -1,53 +0,0 @@ -diff -up tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.cxx.inetd-nowait tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.cxx ---- tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.cxx.inetd-nowait 2013-05-23 12:20:35.836386218 +0100 -+++ tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.cxx 2013-05-23 12:23:04.698003213 +0100 -@@ -325,18 +325,12 @@ bool TcpSocket::cork(int sock, bool enab - #endif - } - --bool TcpSocket::isSocket(int sock) -+bool TcpSocket::isListening(int sock) - { -- struct sockaddr_in info; -- socklen_t info_size = sizeof(info); -- return getsockname(sock, (struct sockaddr *)&info, &info_size) >= 0; --} -- --bool TcpSocket::isConnected(int sock) --{ -- struct sockaddr_in info; -- socklen_t info_size = sizeof(info); -- return getpeername(sock, (struct sockaddr *)&info, &info_size) >= 0; -+ int listening = 0; -+ socklen_t listening_size = sizeof(listening); -+ return getsockopt(sock, SOL_SOCKET, SO_ACCEPTCONN, &listening, -+ &listening_size) >= 0 && listening; - } - - int TcpSocket::getSockPort(int sock) -diff -up tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.h.inetd-nowait tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.h ---- tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.h.inetd-nowait 2013-05-23 12:20:35.835386220 +0100 -+++ tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.h 2013-05-23 12:21:58.861730647 +0100 -@@ -57,8 +57,7 @@ namespace network { - - static bool enableNagles(int sock, bool enable); - static bool cork(int sock, bool enable); -- static bool isSocket(int sock); -- static bool isConnected(int sock); -+ static bool isListening(int sock); - static int getSockPort(int sock); - private: - bool closeFd; -diff -up tigervnc-1.2.80-20130314svn5065/unix/xserver/hw/vnc/vncExtInit.cc.inetd-nowait tigervnc-1.2.80-20130314svn5065/unix/xserver/hw/vnc/vncExtInit.cc ---- tigervnc-1.2.80-20130314svn5065/unix/xserver/hw/vnc/vncExtInit.cc.inetd-nowait 2013-03-14 17:11:22.000000000 +0000 -+++ tigervnc-1.2.80-20130314svn5065/unix/xserver/hw/vnc/vncExtInit.cc 2013-05-23 12:21:10.545530308 +0100 -@@ -225,8 +225,7 @@ void vncExtensionInit() - network::TcpListener* listener = 0; - network::TcpListener* httpListener = 0; - if (scr == 0 && vncInetdSock != -1) { -- if (network::TcpSocket::isSocket(vncInetdSock) && -- !network::TcpSocket::isConnected(vncInetdSock)) -+ if (network::TcpSocket::isListening(vncInetdSock)) - { - listener = new network::TcpListener(NULL, 0, 0, vncInetdSock, true); - vlog.info("inetd wait"); diff --git a/SOURCES/tigervnc-inputreset.patch b/SOURCES/tigervnc-inputreset.patch deleted file mode 100644 index 90f8663..0000000 --- a/SOURCES/tigervnc-inputreset.patch +++ /dev/null @@ -1,385 +0,0 @@ -diff --git a/unix/xserver/hw/vnc/Input.cc b/unix/xserver/hw/vnc/Input.cc -index 43c3ac3..4112fee 100644 ---- a/unix/xserver/hw/vnc/Input.cc -+++ b/unix/xserver/hw/vnc/Input.cc -@@ -68,6 +68,9 @@ rfb::BoolParameter avoidShiftNumLock("AvoidShiftNumLock", "Avoid fake Shift pres - - #define BUTTONS 7 - -+class InputDevice *vncInputDevice; -+InputDevice InputDevice::singleton; -+ - /* Event queue is shared between all devices. */ - #if XORG == 15 - static xEvent *eventq = NULL; -@@ -116,11 +119,12 @@ static void enqueueEvents(DeviceIntPtr dev, int n) - } - #endif /* XORG < 111 */ - --InputDevice::InputDevice(rfb::VNCServerST *_server) -- : server(_server), initialized(false), oldButtonMask(0) -+InputDevice::InputDevice() -+ : oldButtonMask(0) - { - int i; - -+ vncInputDevice = this; - #if XORG < 111 - initEventq(); - #endif -@@ -195,7 +199,7 @@ void InputDevice::PointerMove(const rfb::Point &pos) - cursorPos = pos; - } - --void InputDevice::PointerSync(void) -+const rfb::Point &InputDevice::getPointerPos(void) - { - if (pointerDev) { - int x, y; -@@ -205,14 +209,10 @@ void InputDevice::PointerSync(void) - cursorPos.y = y; - } - -- if (cursorPos.equals(oldCursorPos)) -- return; -- -- oldCursorPos = cursorPos; -- server->setCursorPos(cursorPos); -+ return cursorPos; - } - --static int pointerProc(DeviceIntPtr pDevice, int onoff) -+int InputDevice::pointerProc(DeviceIntPtr pDevice, int onoff) - { - BYTE map[BUTTONS + 1]; - DevicePtr pDev = (DevicePtr)pDevice; -@@ -237,6 +237,8 @@ static int pointerProc(DeviceIntPtr pDevice, int onoff) - btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT); - btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP); - btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN); -+ btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT); -+ btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT); - - axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X); - axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y); -@@ -261,10 +263,9 @@ static int pointerProc(DeviceIntPtr pDevice, int onoff) - case DEVICE_OFF: - pDev->on = FALSE; - break; --#if 0 - case DEVICE_CLOSE: -+ singleton.pointerDev = NULL; - break; --#endif - } - - return Success; -@@ -277,9 +278,7 @@ static void keyboardBell(int percent, DeviceIntPtr device, void * ctrl, - vncBell(); - } - --extern void GetInitKeyboardMap(KeySymsPtr keysyms, CARD8 *modmap); -- --static int keyboardProc(DeviceIntPtr pDevice, int onoff) -+int InputDevice::keyboardProc(DeviceIntPtr pDevice, int onoff) - { - #if XORG < 17 - KeySymsRec keySyms; -@@ -306,6 +305,9 @@ static int keyboardProc(DeviceIntPtr pDevice, int onoff) - case DEVICE_OFF: - pDev->on = FALSE; - break; -+ case DEVICE_CLOSE: -+ singleton.keyboardDev = NULL; -+ break; - } - - return Success; -@@ -313,11 +315,9 @@ static int keyboardProc(DeviceIntPtr pDevice, int onoff) - - void InputDevice::InitInputDevice(void) - { -- if (initialized) -+ if ((pointerDev != NULL) || (keyboardDev != NULL)) - return; - -- initialized = true; -- - #if XORG < 17 - pointerDev = AddInputDevice( - #if XORG >= 16 -diff --git a/unix/xserver/hw/vnc/Input.h b/unix/xserver/hw/vnc/Input.h -index e893049..f58242d 100644 ---- a/unix/xserver/hw/vnc/Input.h -+++ b/unix/xserver/hw/vnc/Input.h -@@ -29,20 +29,26 @@ - - #include - --#include -+#include -+#include - - extern "C" { - #include "input.h" -+/* The Xorg headers define macros that wreak havoc with STL */ -+#undef max - }; - - #include "xorg-version.h" - --/* Represents input device (keyboard + pointer) */ -+/* -+ * Represents input device (keyboard + pointer) -+ * -+ * Is a singleton as input devices are global in the X server so -+ * we do not have one per desktop (i.e. per screen). -+ */ -+extern class InputDevice *vncInputDevice; - class InputDevice { - public: -- /* Create new InputDevice instance */ -- InputDevice(rfb::VNCServerST *_server); -- - /* - * Press or release buttons. Relationship between buttonMask and - * buttons is specified in RFB protocol. -@@ -52,27 +58,28 @@ public: - /* Move pointer to target location (point coords are absolute). */ - void PointerMove(const rfb::Point &point); - -- /* -- * Send pointer position to clients. If not called then Move() calls -- * won't be visible to VNC clients. -- */ -- void PointerSync(void); -+ /* Get current known location of the pointer */ -+ const rfb::Point &getPointerPos(void); - -+ /* Press or release one or more keys to get the given symbol */ - void KeyboardPress(rdr::U32 keysym) { keyEvent(keysym, true); } - void KeyboardRelease(rdr::U32 keysym) { keyEvent(keysym, false); } - - /* -- * Init input device. This cannot be done in the constructor -- * because constructor is called during X server extensions -- * initialization. Devices must be initialized after core -- * pointer/keyboard initialization which is actually after extesions -- * initialization. Check InitExtensions(), InitCoreDevices() and -- * InitInput() calls in dix/main.c. Instead it is called from -- * XserverDesktop at an appropriate time. -+ * Init input device. -+ * This has to be called after core pointer/keyboard -+ * initialization which unfortunately is after extesions -+ * initialization (which means we cannot call it in -+ * vncExtensionInit(). Check InitExtensions(), -+ * InitCoreDevices() and InitInput() calls in dix/main.c. -+ * Instead we call it from XserverDesktop at an appropriate -+ * time. - */ - void InitInputDevice(void); - - private: -+ InputDevice(); -+ - void keyEvent(rdr::U32 keysym, bool down); - - /* Backend dependent functions below here */ -@@ -96,22 +103,26 @@ private: - KeyCode addKeysym(KeySym keysym, unsigned state); - - private: -+ static int pointerProc(DeviceIntPtr pDevice, int onoff); -+ static int keyboardProc(DeviceIntPtr pDevice, int onoff); -+ - #if XORG >= 17 - static void vncXkbProcessDeviceEvent(int screenNum, - InternalEvent *event, - DeviceIntPtr dev); -+#else -+ static void GetInitKeyboardMap(KeySymsPtr keysyms, CARD8 *modmap); - #endif - - private: -- rfb::VNCServerST *server; -- bool initialized; - DeviceIntPtr keyboardDev; - DeviceIntPtr pointerDev; - - int oldButtonMask; -- rfb::Point cursorPos, oldCursorPos; -- -+ rfb::Point cursorPos; - KeySym pressedKeys[256]; -+private: -+ static InputDevice singleton; - }; - - #endif -diff --git a/unix/xserver/hw/vnc/InputCore.cc b/unix/xserver/hw/vnc/InputCore.cc -index a880ca0..b565c73 100644 ---- a/unix/xserver/hw/vnc/InputCore.cc -+++ b/unix/xserver/hw/vnc/InputCore.cc -@@ -174,7 +174,7 @@ KeySym keyboardMap[MAP_LEN * KEYSYMS_PER_KEY] = { - XK_Menu, NoSymbol, - }; - --void GetInitKeyboardMap(KeySymsPtr keysyms, CARD8 *modmap) -+void InputDevice::GetInitKeyboardMap(KeySymsPtr keysyms, CARD8 *modmap) - { - int i; - -diff --git a/unix/xserver/hw/vnc/InputXKB.cc b/unix/xserver/hw/vnc/InputXKB.cc -index ed93afc..92288aa 100644 ---- a/unix/xserver/hw/vnc/InputXKB.cc -+++ b/unix/xserver/hw/vnc/InputXKB.cc -@@ -42,18 +42,6 @@ extern "C" { - #undef class - } - --#if XORG < 19 --static int vncXkbScreenPrivateKeyIndex; --static DevPrivateKey vncXkbScreenPrivateKey = &vncXkbScreenPrivateKeyIndex; --#else --static DevPrivateKeyRec vncXkbPrivateKeyRec; --#define vncXkbScreenPrivateKey (&vncXkbPrivateKeyRec) --#endif -- --#define vncXkbScreenPrivate(pScreen) \ -- (*(InputDevice**) dixLookupPrivate(&(pScreen)->devPrivates, \ -- vncXkbScreenPrivateKey)) -- - #ifndef KEYBOARD_OR_FLOAT - #define KEYBOARD_OR_FLOAT MASTER_KEYBOARD - #endif -@@ -209,18 +197,6 @@ static unsigned XkbKeyEffectiveGroup(XkbDescPtr xkb, KeyCode key, unsigned int m - - void InputDevice::PrepareInputDevices(void) - { --#if XORG < 19 -- if (!dixRequestPrivate(vncXkbScreenPrivateKey, sizeof(InputDevice*))) -- FatalError("Failed to register TigerVNC XKB screen key\n"); --#else -- if (!dixRegisterPrivateKey(vncXkbScreenPrivateKey, PRIVATE_SCREEN, -- sizeof(InputDevice*))) -- FatalError("Failed to register TigerVNC XKB screen key\n"); --#endif -- -- for (int scr = 0; scr < screenInfo.numScreens; scr++) -- vncXkbScreenPrivate(screenInfo.screens[scr]) = this; -- - /* - * Not ideal since these callbacks do not stack, but it's the only - * decent way we can reliably catch events for both the slave and -@@ -636,10 +612,9 @@ void InputDevice::vncXkbProcessDeviceEvent(int screenNum, - InternalEvent *event, - DeviceIntPtr dev) - { -- InputDevice *self = vncXkbScreenPrivate(screenInfo.screens[screenNum]); - unsigned int backupctrls; - -- if (event->device_event.sourceid == self->keyboardDev->id) { -+ if (event->device_event.sourceid == singleton.keyboardDev->id) { - XkbControlsPtr ctrls; - - /* -@@ -661,7 +636,7 @@ void InputDevice::vncXkbProcessDeviceEvent(int screenNum, - - dev->c_public.processInputProc(event, dev); - -- if (event->device_event.sourceid == self->keyboardDev->id) { -+ if (event->device_event.sourceid == singleton.keyboardDev->id) { - XkbControlsPtr ctrls; - - ctrls = dev->key->xkbInfo->desc->ctrls; -diff --git a/unix/xserver/hw/vnc/XserverDesktop.cc b/unix/xserver/hw/vnc/XserverDesktop.cc -index fc0646d..05169b0 100644 ---- a/unix/xserver/hw/vnc/XserverDesktop.cc -+++ b/unix/xserver/hw/vnc/XserverDesktop.cc -@@ -157,15 +157,12 @@ XserverDesktop::XserverDesktop(ScreenPtr pScreen_, - - if (httpListener) - httpServer = new FileHTTPServer(this); -- -- inputDevice = new InputDevice(server); - } - - XserverDesktop::~XserverDesktop() - { - if (!directFbptr) - delete [] data; -- delete inputDevice; - delete httpServer; - delete server; - } -@@ -583,7 +580,7 @@ void XserverDesktop::blockHandler(fd_set* fds, OSTimePtr timeout) - // so we abuse the fact that this routine will be called first thing - // once the dix is done initialising. - // [1] Technically Xvnc has InitInput(), but libvnc.so has nothing. -- inputDevice->InitInputDevice(); -+ vncInputDevice->InitInputDevice(); - - try { - int nextTimeout; -@@ -691,7 +688,11 @@ void XserverDesktop::wakeupHandler(fd_set* fds, int nfds) - } - } - -- inputDevice->PointerSync(); -+ // We are responsible for propagating mouse movement between clients -+ if (!oldCursorPos.equals(vncInputDevice->getPointerPos())) { -+ oldCursorPos = vncInputDevice->getPointerPos(); -+ server->setCursorPos(oldCursorPos); -+ } - } - - // Then let the timers do some processing. Rescheduling is done in -@@ -818,8 +819,8 @@ void XserverDesktop::approveConnection(void* opaqueId, bool accept, - - void XserverDesktop::pointerEvent(const Point& pos, int buttonMask) - { -- inputDevice->PointerMove(pos); -- inputDevice->PointerButtonAction(buttonMask); -+ vncInputDevice->PointerMove(pos); -+ vncInputDevice->PointerButtonAction(buttonMask); - } - - void XserverDesktop::clientCutText(const char* str, int len) -@@ -1136,7 +1137,7 @@ void XserverDesktop::lookup(int index, int* r, int* g, int* b) - void XserverDesktop::keyEvent(rdr::U32 keysym, bool down) - { - if (down) -- inputDevice->KeyboardPress(keysym); -+ vncInputDevice->KeyboardPress(keysym); - else -- inputDevice->KeyboardRelease(keysym); -+ vncInputDevice->KeyboardRelease(keysym); - } -diff --git a/unix/xserver/hw/vnc/XserverDesktop.h b/unix/xserver/hw/vnc/XserverDesktop.h -index fb247b0..ca6e8af 100644 ---- a/unix/xserver/hw/vnc/XserverDesktop.h -+++ b/unix/xserver/hw/vnc/XserverDesktop.h -@@ -153,5 +153,7 @@ private: - typedef std::map OutputIdMap; - OutputIdMap outputIdMap; - #endif -+ -+ rfb::Point oldCursorPos; - }; - #endif -diff --git a/unix/xserver/hw/vnc/xf86vncModule.cc b/unix/xserver/hw/vnc/xf86vncModule.cc -index 3187bba..596d399 100644 ---- a/unix/xserver/hw/vnc/xf86vncModule.cc -+++ b/unix/xserver/hw/vnc/xf86vncModule.cc -@@ -112,9 +112,9 @@ static void vncExtensionInitWithParams(INITARGS) - i.param->setParam(val); - } - } -- -- vncExtensionInit(); - } -+ -+ vncExtensionInit(); - } - } - diff --git a/SOURCES/tigervnc-ipv6-support.patch b/SOURCES/tigervnc-ipv6-support.patch deleted file mode 100644 index 083cc7c..0000000 --- a/SOURCES/tigervnc-ipv6-support.patch +++ /dev/null @@ -1,1708 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index f2656d1..0e325e2 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -71,16 +71,9 @@ if(NOT DEFINED BUILD_WINVNC) - set(BUILD_WINVNC 1) - endif() - --# Minimum version is Windows 2000 (5.0) -+# Minimum version is Windows XP SP2 (5.2) - if(WIN32) -- if(NOT CMAKE_SIZEOF_VOID_P MATCHES 8) -- add_definitions(-D_WIN32_IE=0x0500 -D_WIN32_WINNT=0x0500) -- else() -- set(WIN64 1) -- # Win64 doesn't like us requesting a Windows version that didn't have -- # 64-bit support. Request XP (5.1) instead. -- add_definitions(-D_WIN32_IE=0x0501 -D_WIN32_WINNT=0x0501) -- endif() -+ add_definitions(-D_WIN32_IE=0x0502 -D_WIN32_WINNT=0x0502) - endif() - - if(CMAKE_SIZEOF_VOID_P MATCHES 8) -@@ -366,20 +359,6 @@ if(ENABLE_PAM) - endif() - set(HAVE_PAM ${ENABLE_PAM}) - --# Check for socket functions --if(WIN32) -- set(CMAKE_EXTRA_INCLUDE_FILES winsock2.h ws2tcpip.h) -- set(CMAKE_REQUIRED_LIBRARIES ws2_32) --else() -- set(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h) --endif() --check_function_exists(inet_aton HAVE_INET_ATON) --check_function_exists(inet_ntop HAVE_INET_NTOP) --check_function_exists(getaddrinfo HAVE_GETADDRINFO) --check_type_size(socklen_t SOCKLEN_T) --set(CMAKE_EXTRA_INCLUDE_FILES) --set(CMAKE_REQUIRED_LIBRARIES) -- - # Check for the newer standard string functions - check_function_exists(snprintf HAVE_SNPRINTF) - check_function_exists(strcasecmp HAVE_STRCASECMP) -diff --git a/common/network/TcpSocket.cxx b/common/network/TcpSocket.cxx -index afd66f9..83387ab 100644 ---- a/common/network/TcpSocket.cxx -+++ b/common/network/TcpSocket.cxx -@@ -31,10 +31,8 @@ - #include - #include - #include --#include - #include - #include --#include - #include - #include - #include -@@ -42,10 +40,15 @@ - #endif - - #include -+#include - #include --#include - #include - #include -+#include -+ -+#ifdef WIN32 -+#include -+#endif - - #ifndef INADDR_NONE - #define INADDR_NONE ((unsigned long)-1) -@@ -54,26 +57,24 @@ - #define INADDR_LOOPBACK ((unsigned long)0x7F000001) - #endif - --#if defined(HAVE_GETADDRINFO) && !defined(IN6_ARE_ADDR_EQUAL) -+#ifndef IN6_ARE_ADDR_EQUAL - #define IN6_ARE_ADDR_EQUAL(a,b) \ - (memcmp ((const void*)(a), (const void*)(b), sizeof (struct in6_addr)) == 0) - #endif - -+// Missing on older Windows and OS X -+#ifndef AI_NUMERICSERV -+#define AI_NUMERICSERV 0 -+#endif -+ - using namespace network; - using namespace rdr; - --typedef struct vnc_sockaddr { -- union { -- sockaddr sa; -- sockaddr_in sin; --#ifdef HAVE_GETADDRINFO -- sockaddr_in6 sin6; --#endif -- } u; --} vnc_sockaddr_t; -- - static rfb::LogWriter vlog("TcpSocket"); - -+static rfb::BoolParameter UseIPv4("UseIPv4", "Use IPv4 for incoming and outgoing connections.", true); -+static rfb::BoolParameter UseIPv6("UseIPv6", "Use IPv6 for incoming and outgoing connections.", true); -+ - /* Tunnelling support. */ - int network::findFreeTcpPort (void) - { -@@ -117,6 +118,23 @@ static void initSockets() { - } - - -+// -=- Socket duplication help for Windows -+static int dupsocket(int fd) -+{ -+#ifdef WIN32 -+ int ret; -+ WSAPROTOCOL_INFO info; -+ ret = WSADuplicateSocket(fd, GetCurrentProcessId(), &info); -+ if (ret != 0) -+ throw SocketException("unable to duplicate socket", errorNumber); -+ return WSASocket(info.iAddressFamily, info.iSocketType, info.iProtocol, -+ &info, 0, 0); -+#else -+ return dup(fd); -+#endif -+} -+ -+ - // -=- TcpSocket - - TcpSocket::TcpSocket(int sock, bool close) -@@ -130,14 +148,11 @@ TcpSocket::TcpSocket(const char *host, int port) - int sock, err, result, family; - vnc_sockaddr_t sa; - socklen_t salen; --#ifdef HAVE_GETADDRINFO - struct addrinfo *ai, *current, hints; --#endif - - // - Create a socket - initSockets(); - --#ifdef HAVE_GETADDRINFO - memset(&hints, 0, sizeof(struct addrinfo)); - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; -@@ -147,13 +162,28 @@ TcpSocket::TcpSocket(const char *host, int port) - - if ((result = getaddrinfo(host, NULL, &hints, &ai)) != 0) { - throw Exception("unable to resolve host by name: %s", -- gai_strerror(result)); -+ gai_strerror(result)); - } - -+ // This logic is too complex for the compiler to determine if -+ // sock is properly assigned or not. -+ sock = -1; -+ - for (current = ai; current != NULL; current = current->ai_next) { - family = current->ai_family; -- if (family != AF_INET && family != AF_INET6) -+ -+ switch (family) { -+ case AF_INET: -+ if (!UseIPv4) -+ continue; -+ break; -+ case AF_INET6: -+ if (!UseIPv6) -+ continue; -+ break; -+ default: - continue; -+ } - - salen = current->ai_addrlen; - memcpy(&sa, current->ai_addr, salen); -@@ -163,34 +193,10 @@ TcpSocket::TcpSocket(const char *host, int port) - else - sa.u.sin6.sin6_port = htons(port); - --#else /* HAVE_GETADDRINFO */ -- family = AF_INET; -- salen = sizeof(struct sockaddr_in); -- -- /* Try processing the host as an IP address */ -- memset(&sa, 0, sizeof(sa)); -- sa.u.sin.sin_family = AF_INET; -- sa.u.sin.sin_addr.s_addr = inet_addr((char *)host); -- sa.u.sin.sin_port = htons(port); -- if ((int)sa.u.sin.sin_addr.s_addr == -1) { -- /* Host was not an IP address - try resolving as DNS name */ -- struct hostent *hostinfo; -- hostinfo = gethostbyname((char *)host); -- if (hostinfo && hostinfo->h_addr) { -- sa.u.sin.sin_addr.s_addr = ((struct in_addr *)hostinfo->h_addr)->s_addr; -- } else { -- err = errorNumber; -- throw SocketException("unable to resolve host by name", err); -- } -- } --#endif /* HAVE_GETADDRINFO */ -- - sock = socket (family, SOCK_STREAM, 0); - if (sock == -1) { - err = errorNumber; --#ifdef HAVE_GETADDRINFO - freeaddrinfo(ai); --#endif /* HAVE_GETADDRINFO */ - throw SocketException("unable to create socket", err); - } - -@@ -199,19 +205,20 @@ TcpSocket::TcpSocket(const char *host, int port) - err = errorNumber; - #ifndef WIN32 - if (err == EINTR) -- continue; -+ continue; - #endif - closesocket(sock); - break; - } - --#ifdef HAVE_GETADDRINFO - if (result == 0) - break; - } - - freeaddrinfo(ai); --#endif /* HAVE_GETADDRINFO */ -+ -+ if (current == NULL) -+ throw Exception("No useful address for host"); - - if (result == -1) - throw SocketException("unable connect to socket", err); -@@ -240,27 +247,63 @@ int TcpSocket::getMyPort() { - } - - char* TcpSocket::getPeerAddress() { -- struct sockaddr_in info; -- struct in_addr addr; -- socklen_t info_size = sizeof(info); -+ vnc_sockaddr_t sa; -+ socklen_t sa_size = sizeof(sa); - -- getpeername(getFd(), (struct sockaddr *)&info, &info_size); -- memcpy(&addr, &info.sin_addr, sizeof(addr)); -+ if (getpeername(getFd(), &sa.u.sa, &sa_size) != 0) { -+ vlog.error("unable to get peer name for socket"); -+ return rfb::strDup(""); -+ } -+ -+ if (sa.u.sa.sa_family == AF_INET6) { -+ char buffer[INET6_ADDRSTRLEN + 2]; -+ int ret; -+ -+ buffer[0] = '['; -+ -+ ret = getnameinfo(&sa.u.sa, sizeof(sa.u.sin6), -+ buffer + 1, sizeof(buffer) - 2, NULL, 0, -+ NI_NUMERICHOST); -+ if (ret != 0) { -+ vlog.error("unable to convert peer name to a string"); -+ return rfb::strDup(""); -+ } -+ -+ strcat(buffer, "]"); -+ -+ return rfb::strDup(buffer); -+ } -+ -+ if (sa.u.sa.sa_family == AF_INET) { -+ char *name; -+ -+ name = inet_ntoa(sa.u.sin.sin_addr); -+ if (name == NULL) { -+ vlog.error("unable to convert peer name to a string"); -+ return rfb::strDup(""); -+ } - -- char* name = inet_ntoa(addr); -- if (name) { - return rfb::strDup(name); -- } else { -- return rfb::strDup(""); - } -+ -+ vlog.error("unknown address family for socket"); -+ return rfb::strDup(""); - } - - int TcpSocket::getPeerPort() { -- struct sockaddr_in info; -- socklen_t info_size = sizeof(info); -+ vnc_sockaddr_t sa; -+ socklen_t sa_size = sizeof(sa); -+ -+ getpeername(getFd(), &sa.u.sa, &sa_size); - -- getpeername(getFd(), (struct sockaddr *)&info, &info_size); -- return ntohs(info.sin_port); -+ switch (sa.u.sa.sa_family) { -+ case AF_INET6: -+ return ntohs(sa.u.sin6.sin6_port); -+ case AF_INET: -+ return ntohs(sa.u.sin.sin_port); -+ default: -+ return 0; -+ } - } - - char* TcpSocket::getPeerEndpoint() { -@@ -288,13 +331,14 @@ bool TcpSocket::sameMachine() { - if (peeraddr.u.sa.sa_family != myaddr.u.sa.sa_family) - return false; - --#ifdef HAVE_GETADDRINFO - if (peeraddr.u.sa.sa_family == AF_INET6) - return IN6_ARE_ADDR_EQUAL(&peeraddr.u.sin6.sin6_addr, -- &myaddr.u.sin6.sin6_addr); --#endif -+ &myaddr.u.sin6.sin6_addr); -+ if (peeraddr.u.sa.sa_family == AF_INET) -+ return (peeraddr.u.sin.sin_addr.s_addr == myaddr.u.sin.sin_addr.s_addr); - -- return (peeraddr.u.sin.sin_addr.s_addr == myaddr.u.sin.sin_addr.s_addr); -+ // No idea what this is. Assume we're on different machines. -+ return false; - } - - void TcpSocket::shutdown() -@@ -306,7 +350,7 @@ void TcpSocket::shutdown() - bool TcpSocket::enableNagles(int sock, bool enable) { - int one = enable ? 0 : 1; - if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, -- (char *)&one, sizeof(one)) < 0) { -+ (char *)&one, sizeof(one)) < 0) { - int e = errorNumber; - vlog.error("unable to setsockopt TCP_NODELAY: %d", e); - return false; -@@ -335,77 +379,89 @@ bool TcpSocket::isListening(int sock) - - int TcpSocket::getSockPort(int sock) - { -- struct sockaddr_in info; -- socklen_t info_size = sizeof(info); -- if (getsockname(sock, (struct sockaddr *)&info, &info_size) < 0) -- return 0; -- return ntohs(info.sin_port); -+ vnc_sockaddr_t sa; -+ socklen_t sa_size = sizeof(sa); -+ if (getsockname(sock, &sa.u.sa, &sa_size) < 0) -+ return 0; -+ -+ switch (sa.u.sa.sa_family) { -+ case AF_INET6: -+ return ntohs(sa.u.sin6.sin6_port); -+ default: -+ return ntohs(sa.u.sin.sin_port); -+ } - } - -+TcpListener::TcpListener(int sock) -+{ -+ fd = sock; -+} - --TcpListener::TcpListener(const char *listenaddr, int port, bool localhostOnly, -- int sock, bool close_) : closeFd(close_) -+TcpListener::TcpListener(const TcpListener& other) - { -- if (sock != -1) { -- fd = sock; -- return; -+ fd = dupsocket (other.fd); -+ // Hope TcpListener::shutdown(other) doesn't get called... -+} -+ -+TcpListener& TcpListener::operator= (const TcpListener& other) -+{ -+ if (this != &other) -+ { -+ closesocket (fd); -+ fd = dupsocket (other.fd); -+ // Hope TcpListener::shutdown(other) doesn't get called... - } -+ return *this; -+} -+ -+TcpListener::TcpListener(const struct sockaddr *listenaddr, -+ socklen_t listenaddrlen) -+{ -+ int one = 1; -+ vnc_sockaddr_t sa; -+ int sock; - - initSockets(); -- if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) -- throw SocketException("unable to create listening socket", errorNumber); - -+ if ((sock = socket (listenaddr->sa_family, SOCK_STREAM, 0)) < 0) -+ throw SocketException("unable to create listening socket", errorNumber); -+ -+ memcpy (&sa, listenaddr, listenaddrlen); -+#ifdef IPV6_V6ONLY -+ if (listenaddr->sa_family == AF_INET6) { -+ if (setsockopt (sock, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&one, sizeof(one))) -+ throw SocketException("unable to set IPV6_V6ONLY", errorNumber); -+ } -+#endif /* defined(IPV6_V6ONLY) */ -+ -+ if (bind(sock, &sa.u.sa, listenaddrlen) == -1) { -+ closesocket(sock); -+ throw SocketException("failed to bind socket", errorNumber); -+ } - #ifndef WIN32 - // - By default, close the socket on exec() -- fcntl(fd, F_SETFD, FD_CLOEXEC); -+ fcntl(sock, F_SETFD, FD_CLOEXEC); - -- int one = 1; -- if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, -- (char *)&one, sizeof(one)) < 0) { -+ if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, -+ (char *)&one, sizeof(one)) < 0) { - int e = errorNumber; -- closesocket(fd); -+ closesocket(sock); - throw SocketException("unable to create listening socket", e); - } --#endif -- -- // - Bind it to the desired port -- struct sockaddr_in addr; -- memset(&addr, 0, sizeof(addr)); -- addr.sin_family = AF_INET; - -- if (localhostOnly) { -- addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); -- } else if (listenaddr != NULL) { --#ifdef HAVE_INET_ATON -- if (inet_aton(listenaddr, &addr.sin_addr) == 0) --#else -- /* Some systems (e.g. Windows) do not have inet_aton, sigh */ -- if ((addr.sin_addr.s_addr = inet_addr(listenaddr)) == INADDR_NONE) -+ fd = sock; - #endif -- { -- closesocket(fd); -- throw Exception("invalid network interface address: %s", listenaddr); -- } -- } else -- addr.sin_addr.s_addr = htonl(INADDR_ANY); /* Bind to 0.0.0.0 by default. */ -- -- addr.sin_port = htons(port); -- if (bind(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { -- int e = errorNumber; -- closesocket(fd); -- throw SocketException("unable to bind listening socket", e); -- } - - // - Set it to be a listening socket -- if (listen(fd, 5) < 0) { -+ if (listen(sock, 5) < 0) { - int e = errorNumber; -- closesocket(fd); -+ closesocket(sock); - throw SocketException("unable to set socket to listening mode", e); - } - } - - TcpListener::~TcpListener() { -- if (closeFd) closesocket(fd); -+ closesocket(fd); - } - - void TcpListener::shutdown() -@@ -444,17 +500,45 @@ TcpListener::accept() { - } - - void TcpListener::getMyAddresses(std::list* result) { -- const hostent* addrs = gethostbyname(0); -- if (addrs == 0) -- throw rdr::SystemException("gethostbyname", errorNumber); -- if (addrs->h_addrtype != AF_INET) -- throw rdr::Exception("getMyAddresses: bad family"); -- for (int i=0; addrs->h_addr_list[i] != 0; i++) { -- const char* addrC = inet_ntoa(*((struct in_addr*)addrs->h_addr_list[i])); -- char* addr = new char[strlen(addrC)+1]; -- strcpy(addr, addrC); -+ struct addrinfo *ai, *current, hints; -+ -+ initSockets(); -+ -+ memset(&hints, 0, sizeof(struct addrinfo)); -+ hints.ai_flags = AI_PASSIVE | AI_NUMERICSERV; -+ hints.ai_family = AF_UNSPEC; -+ hints.ai_socktype = SOCK_STREAM; -+ hints.ai_canonname = NULL; -+ hints.ai_addr = NULL; -+ hints.ai_next = NULL; -+ -+ // Windows doesn't like NULL for service, so specify something -+ if ((getaddrinfo(NULL, "1", &hints, &ai)) != 0) -+ return; -+ -+ for (current= ai; current != NULL; current = current->ai_next) { -+ switch (current->ai_family) { -+ case AF_INET: -+ if (!UseIPv4) -+ continue; -+ break; -+ case AF_INET6: -+ if (!UseIPv6) -+ continue; -+ break; -+ default: -+ continue; -+ } -+ -+ char *addr = new char[INET6_ADDRSTRLEN]; -+ -+ getnameinfo(current->ai_addr, current->ai_addrlen, addr, INET6_ADDRSTRLEN, -+ NULL, 0, NI_NUMERICHOST); -+ - result->push_back(addr); - } -+ -+ freeaddrinfo(ai); - } - - int TcpListener::getMyPort() { -@@ -462,6 +546,115 @@ int TcpListener::getMyPort() { - } - - -+void network::createLocalTcpListeners(std::list *listeners, -+ int port) -+{ -+ std::list new_listeners; -+ vnc_sockaddr_t sa; -+ -+ initSockets(); -+ -+ if (UseIPv6) { -+ sa.u.sin6.sin6_family = AF_INET6; -+ sa.u.sin6.sin6_port = htons (port); -+ sa.u.sin6.sin6_addr = in6addr_loopback; -+ try { -+ new_listeners.push_back (TcpListener (&sa.u.sa, sizeof (sa.u.sin6))); -+ } catch (SocketException& e) { -+ // Ignore this if it is due to lack of address family support on -+ // the interface or on the system -+ if (e.err != EADDRNOTAVAIL && e.err != EAFNOSUPPORT) -+ // Otherwise, report the error -+ throw; -+ } -+ } -+ if (UseIPv4) { -+ sa.u.sin.sin_family = AF_INET; -+ sa.u.sin.sin_port = htons (port); -+ sa.u.sin.sin_addr.s_addr = htonl (INADDR_LOOPBACK); -+ try { -+ new_listeners.push_back (TcpListener (&sa.u.sa, sizeof (sa.u.sin))); -+ } catch (SocketException& e) { -+ // Ignore this if it is due to lack of address family support on -+ // the interface or on the system -+ if (e.err != EADDRNOTAVAIL && e.err != EAFNOSUPPORT) -+ // Otherwise, report the error -+ throw; -+ } -+ } -+ -+ if (new_listeners.empty ()) -+ throw SocketException("createLocalTcpListeners: no addresses available", -+ EADDRNOTAVAIL); -+ -+ listeners->splice (listeners->end(), new_listeners); -+} -+ -+void network::createTcpListeners(std::list *listeners, -+ const char *addr, -+ int port) -+{ -+ std::list new_listeners; -+ -+ struct addrinfo *ai, *current, hints; -+ char service[16]; -+ int result; -+ -+ initSockets(); -+ -+ memset(&hints, 0, sizeof(struct addrinfo)); -+ hints.ai_flags = AI_PASSIVE | AI_NUMERICSERV; -+ hints.ai_family = AF_UNSPEC; -+ hints.ai_socktype = SOCK_STREAM; -+ hints.ai_canonname = NULL; -+ hints.ai_addr = NULL; -+ hints.ai_next = NULL; -+ -+ snprintf (service, sizeof (service) - 1, "%d", port); -+ service[sizeof (service) - 1] = '\0'; -+ if ((result = getaddrinfo(addr, service, &hints, &ai)) != 0) -+ throw rdr::Exception("unable to resolve listening address: %s", -+ gai_strerror(result)); -+ -+ for (current = ai; current != NULL; current = current->ai_next) { -+ switch (current->ai_family) { -+ case AF_INET: -+ if (!UseIPv4) -+ continue; -+ break; -+ -+ case AF_INET6: -+ if (!UseIPv6) -+ continue; -+ break; -+ -+ default: -+ continue; -+ } -+ -+ try { -+ new_listeners.push_back(TcpListener (current->ai_addr, -+ current->ai_addrlen)); -+ } catch (SocketException& e) { -+ // Ignore this if it is due to lack of address family support on -+ // the interface or on the system -+ if (e.err != EADDRNOTAVAIL && e.err != EAFNOSUPPORT) { -+ // Otherwise, report the error -+ freeaddrinfo(ai); -+ throw; -+ } -+ } -+ } -+ freeaddrinfo(ai); -+ -+ if (new_listeners.empty ()) -+ throw SocketException("createTcpListeners: no addresses available", -+ EADDRNOTAVAIL); -+ -+ listeners->splice (listeners->end(), new_listeners); -+} -+ -+ - TcpFilter::TcpFilter(const char* spec) { - rfb::CharArray tmp; - tmp.buf = rfb::strDup(spec); -@@ -478,20 +671,69 @@ TcpFilter::~TcpFilter() { - - - static bool --patternMatchIP(const TcpFilter::Pattern& pattern, const char* value) { -- unsigned long address = inet_addr((char *)value); -- if (address == INADDR_NONE) return false; -- return ((pattern.address & pattern.mask) == (address & pattern.mask)); -+patternMatchIP(const TcpFilter::Pattern& pattern, vnc_sockaddr_t *sa) { -+ switch (pattern.address.u.sa.sa_family) { -+ unsigned long address; -+ -+ case AF_INET: -+ if (sa->u.sa.sa_family != AF_INET) -+ return false; -+ -+ address = sa->u.sin.sin_addr.s_addr; -+ if (address == htonl (INADDR_NONE)) return false; -+ return ((pattern.address.u.sin.sin_addr.s_addr & -+ pattern.mask.u.sin.sin_addr.s_addr) == -+ (address & pattern.mask.u.sin.sin_addr.s_addr)); -+ -+ case AF_INET6: -+ if (sa->u.sa.sa_family != AF_INET6) -+ return false; -+ -+ for (unsigned int n = 0; n < 16; n++) { -+ unsigned int bits = (n + 1) * 8; -+ unsigned int mask; -+ if (pattern.prefixlen > bits) -+ mask = 0xff; -+ else { -+ unsigned int lastbits = 0xff; -+ lastbits <<= bits - pattern.prefixlen; -+ mask = lastbits & 0xff; -+ } -+ -+ if ((pattern.address.u.sin6.sin6_addr.s6_addr[n] & mask) != -+ (sa->u.sin6.sin6_addr.s6_addr[n] & mask)) -+ return false; -+ -+ if (mask < 0xff) -+ break; -+ } -+ -+ return true; -+ -+ case AF_UNSPEC: -+ // Any address matches -+ return true; -+ -+ default: -+ break; -+ } -+ -+ return false; - } - - bool - TcpFilter::verifyConnection(Socket* s) { - rfb::CharArray name; -+ vnc_sockaddr_t sa; -+ socklen_t sa_size = sizeof(sa); -+ -+ if (getpeername(s->getFd(), &sa.u.sa, &sa_size) != 0) -+ return false; - - name.buf = s->getPeerAddress(); - std::list::iterator i; - for (i=filter.begin(); i!=filter.end(); i++) { -- if (patternMatchIP(*i, name.buf)) { -+ if (patternMatchIP(*i, &sa)) { - switch ((*i).action) { - case Accept: - vlog.debug("ACCEPT %s", name.buf); -@@ -515,31 +757,102 @@ TcpFilter::verifyConnection(Socket* s) { - TcpFilter::Pattern TcpFilter::parsePattern(const char* p) { - TcpFilter::Pattern pattern; - -- bool expandMask = false; -- rfb::CharArray addr, mask; -+ rfb::CharArray addr, pref; -+ bool prefix_specified; -+ int family; -+ -+ prefix_specified = rfb::strSplit(&p[1], '/', &addr.buf, &pref.buf); -+ if (addr.buf[0] == '\0') { -+ // Match any address -+ memset (&pattern.address, 0, sizeof (pattern.address)); -+ pattern.address.u.sa.sa_family = AF_UNSPEC; -+ pattern.prefixlen = 0; -+ } else { -+ struct addrinfo hints; -+ struct addrinfo *ai; -+ char *p = addr.buf; -+ int result; -+ memset (&hints, 0, sizeof (hints)); -+ hints.ai_family = AF_UNSPEC; -+ hints.ai_flags = AI_NUMERICHOST; -+ -+ // Take out brackets, if present -+ if (*p == '[') { -+ size_t len; -+ p++; -+ len = strlen (p); -+ if (len > 0 && p[len - 1] == ']') -+ p[len - 1] = '\0'; -+ } -+ -+ if ((result = getaddrinfo (p, NULL, &hints, &ai)) != 0) { -+ throw Exception("unable to resolve host by name: %s", -+ gai_strerror(result)); -+ } - -- if (rfb::strSplit(&p[1], '/', &addr.buf, &mask.buf)) { -- if (rfb::strContains(mask.buf, '.')) { -- pattern.mask = inet_addr(mask.buf); -+ memcpy (&pattern.address.u.sa, ai->ai_addr, ai->ai_addrlen); -+ freeaddrinfo (ai); -+ -+ family = pattern.address.u.sa.sa_family; -+ -+ if (prefix_specified) { -+ if (family == AF_INET && -+ rfb::strContains(pref.buf, '.')) { -+ throw Exception("mask no longer supported for filter, " -+ "use prefix instead"); -+ } -+ -+ pattern.prefixlen = (unsigned int) atoi(pref.buf); - } else { -- pattern.mask = atoi(mask.buf); -- expandMask = true; -+ switch (family) { -+ case AF_INET: -+ pattern.prefixlen = 32; -+ break; -+ case AF_INET6: -+ pattern.prefixlen = 128; -+ break; -+ default: -+ throw Exception("unknown address family"); -+ } - } -- } else { -- pattern.mask = 32; -- expandMask = true; -- } -- if (expandMask) { -- unsigned long expanded = 0; -- // *** check endianness! -- for (int i=0; i<(int)pattern.mask; i++) -- expanded |= 1<<(31-i); -- pattern.mask = htonl(expanded); - } - -- pattern.address = inet_addr(addr.buf) & pattern.mask; -- if ((pattern.address == INADDR_NONE) || -- (pattern.address == 0)) pattern.mask = 0; -+ family = pattern.address.u.sa.sa_family; -+ -+ if (pattern.prefixlen > (family == AF_INET ? 32: 128)) -+ throw Exception("invalid prefix length for filter address: %u", -+ pattern.prefixlen); -+ -+ // Compute mask from address and prefix length -+ memset (&pattern.mask, 0, sizeof (pattern.mask)); -+ switch (family) { -+ unsigned long mask; -+ case AF_INET: -+ mask = 0; -+ for (unsigned int i=0; i bits) -+ pattern.mask.u.sin6.sin6_addr.s6_addr[n] = 0xff; -+ else { -+ unsigned int lastbits = 0xff; -+ lastbits <<= bits - pattern.prefixlen; -+ pattern.mask.u.sin6.sin6_addr.s6_addr[n] = lastbits & 0xff; -+ break; -+ } -+ } -+ break; -+ case AF_UNSPEC: -+ // No mask to compute -+ break; -+ default: -+ ; /* not reached */ -+ } - - switch(p[0]) { - case '+': pattern.action = TcpFilter::Accept; break; -@@ -551,21 +864,39 @@ TcpFilter::Pattern TcpFilter::parsePattern(const char* p) { - } - - char* TcpFilter::patternToStr(const TcpFilter::Pattern& p) { -- in_addr tmp; -- rfb::CharArray addr, mask; -- tmp.s_addr = p.address; -- addr.buf = rfb::strDup(inet_ntoa(tmp)); -- tmp.s_addr = p.mask; -- mask.buf = rfb::strDup(inet_ntoa(tmp)); -- char* result = new char[strlen(addr.buf)+1+strlen(mask.buf)+1+1]; -+ rfb::CharArray addr; -+ char buffer[INET6_ADDRSTRLEN + 2]; -+ -+ if (p.address.u.sa.sa_family == AF_INET) { -+ getnameinfo(&p.address.u.sa, sizeof(p.address.u.sin), -+ buffer, sizeof (buffer), NULL, 0, NI_NUMERICHOST); -+ addr.buf = rfb::strDup(buffer); -+ } else if (p.address.u.sa.sa_family == AF_INET6) { -+ buffer[0] = '['; -+ getnameinfo(&p.address.u.sa, sizeof(p.address.u.sin6), -+ buffer + 1, sizeof (buffer) - 2, NULL, 0, NI_NUMERICHOST); -+ strcat(buffer, "]"); -+ addr.buf = rfb::strDup(buffer); -+ } else if (p.address.u.sa.sa_family == AF_UNSPEC) -+ addr.buf = rfb::strDup(""); -+ -+ char action; - switch (p.action) { -- case Accept: result[0] = '+'; break; -- case Reject: result[0] = '-'; break; -- case Query: result[0] = '?'; break; -+ case Accept: action = '+'; break; -+ case Reject: action = '-'; break; -+ default: -+ case Query: action = '?'; break; - }; -- result[1] = 0; -- strcat(result, addr.buf); -- strcat(result, "/"); -- strcat(result, mask.buf); -+ size_t resultlen = (1 // action -+ + strlen (addr.buf) // address -+ + 1 // slash -+ + 3 // prefix length, max 128 -+ + 1); // terminating nul -+ char* result = new char[resultlen]; -+ if (addr.buf[0] == '\0') -+ snprintf(result, resultlen, "%c", action); -+ else -+ snprintf(result, resultlen, "%c%s/%u", action, addr.buf, p.prefixlen); -+ - return result; - } -diff --git a/common/network/TcpSocket.h b/common/network/TcpSocket.h -index cd4393e..3f72c85 100644 ---- a/common/network/TcpSocket.h -+++ b/common/network/TcpSocket.h -@@ -30,6 +30,14 @@ - - #include - -+#ifdef WIN32 -+#include -+#include -+#else -+#include /* for socklen_t */ -+#include /* for struct sockaddr_in */ -+#endif -+ - #include - - /* Tunnelling support. */ -@@ -65,20 +73,33 @@ namespace network { - - class TcpListener : public SocketListener { - public: -- TcpListener(const char *listenaddr, int port, bool localhostOnly=false, -- int sock=-1, bool close=true); -+ TcpListener(const struct sockaddr *listenaddr, socklen_t listenaddrlen); -+ TcpListener(int sock); -+ TcpListener(const TcpListener& other); -+ TcpListener& operator= (const TcpListener& other); - virtual ~TcpListener(); - - virtual void shutdown(); - virtual Socket* accept(); - -- void getMyAddresses(std::list* addrs); -+ static void getMyAddresses(std::list* result); - int getMyPort(); -- -- private: -- bool closeFd; - }; - -+ void createLocalTcpListeners(std::list *listeners, -+ int port); -+ void createTcpListeners(std::list *listeners, -+ const char *addr, -+ int port); -+ -+ typedef struct vnc_sockaddr { -+ union { -+ sockaddr sa; -+ sockaddr_in sin; -+ sockaddr_in6 sin6; -+ } u; -+ } vnc_sockaddr_t; -+ - class TcpFilter : public ConnectionFilter { - public: - TcpFilter(const char* filter); -@@ -89,8 +110,10 @@ namespace network { - typedef enum {Accept, Reject, Query} Action; - struct Pattern { - Action action; -- unsigned long address; -- unsigned long mask; -+ vnc_sockaddr_t address; -+ unsigned int prefixlen; -+ -+ vnc_sockaddr_t mask; // computed from address and prefix - }; - static Pattern parsePattern(const char* s); - static char* patternToStr(const Pattern& p); -diff --git a/common/os/CMakeLists.txt b/common/os/CMakeLists.txt -index 39d5c10..cd066f8 100644 ---- a/common/os/CMakeLists.txt -+++ b/common/os/CMakeLists.txt -@@ -2,7 +2,6 @@ include_directories(${CMAKE_SOURCE_DIR}/common) - - add_library(os STATIC - print.c -- net.c - w32tiger.c - os.cxx - tls.cxx) -diff --git a/common/os/net.c b/common/os/net.c -deleted file mode 100644 -index 7bad36c..0000000 ---- a/common/os/net.c -+++ /dev/null -@@ -1,53 +0,0 @@ --/* Copyright (C) 2008 TightVNC Team. All Rights Reserved. -- * -- * This is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation; either version 2 of the License, or -- * (at your option) any later version. -- * -- * This software is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details. -- * -- * You should have received a copy of the GNU General Public License -- * along with this software; if not, write to the Free Software -- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, -- * USA. -- */ -- --#ifdef HAVE_CONFIG_H --#include --#endif -- --#include --#include -- --#ifdef WIN32 --#include --#include --#else --#include --#include --#include --#endif -- --#include -- -- --#ifndef HAVE_INET_NTOP --const char *tight_inet_ntop(int af, const void *src, char *dst, -- socklen_t size) { -- char *tempstr; -- -- /* Catch bugs - we should not use IPv6 if we don't have inet_ntop */ -- if (af != AF_INET) -- abort(); -- -- /* inet_ntoa never fails */ -- tempstr = inet_ntoa(*(struct in_addr *)(src)); -- memcpy(dst, tempstr, strlen(tempstr) + 1); -- -- return dst; --} --#endif -diff --git a/common/os/net.h b/common/os/net.h -deleted file mode 100644 -index bd8b21c..0000000 ---- a/common/os/net.h -+++ /dev/null -@@ -1,50 +0,0 @@ --/* Copyright (C) 2008 TightVNC Team. All Rights Reserved. -- * -- * This is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation; either version 2 of the License, or -- * (at your option) any later version. -- * -- * This software is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details. -- * -- * You should have received a copy of the GNU General Public License -- * along with this software; if not, write to the Free Software -- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, -- * USA. -- */ -- --#ifndef OS_NET_H --#define OS_NET_H -- --#ifdef HAVE_CONFIG_H --#include --#endif -- --#ifdef __cplusplus --extern "C" { --#endif -- --#ifndef HAVE_SOCKLEN_T --typedef int socklen_t; --#endif -- --/* IPv6 support on server side - we have to have all those functions */ --#if defined(HAVE_INET_NTOP) --#define HAVE_IPV6 --#endif -- --/* IPv4-only stub implementation */ --#ifndef HAVE_INET_NTOP --const char *tight_inet_ntop(int af, const void *src, -- char *dst, socklen_t size); --#define inet_ntop tight_inet_ntop --#endif -- --#ifdef __cplusplus --}; --#endif -- --#endif /* OS_NET_H */ -diff --git a/config.h.in b/config.h.in -index ec2aed9..c6d27ee 100644 ---- a/config.h.in -+++ b/config.h.in -@@ -2,9 +2,6 @@ - #define PACKAGE_VERSION "@VERSION@" - - #cmakedefine HAVE_SOCKLEN_T --#cmakedefine HAVE_INET_ATON --#cmakedefine HAVE_INET_NTOP --#cmakedefine HAVE_GETADDRINFO - #cmakedefine HAVE_SNPRINTF - #cmakedefine HAVE_STRCASECMP - #cmakedefine HAVE_STRNCASECMP -diff --git a/unix/x0vncserver/x0vncserver.cxx b/unix/x0vncserver/x0vncserver.cxx -index b5498e1..400af75 100644 ---- a/unix/x0vncserver/x0vncserver.cxx -+++ b/unix/x0vncserver/x0vncserver.cxx -@@ -434,6 +434,8 @@ int main(int argc, char** argv) - signal(SIGINT, CleanupSignalHandler); - signal(SIGTERM, CleanupSignalHandler); - -+ std::list listeners; -+ - try { - TXWindow::init(dpy,"x0vncserver"); - Geometry geo(DisplayWidth(dpy, DefaultScreen(dpy)), -@@ -448,13 +450,16 @@ int main(int argc, char** argv) - QueryConnHandler qcHandler(dpy, &server); - server.setQueryConnectionHandler(&qcHandler); - -- TcpListener listener(NULL, (int)rfbport); -+ createTcpListeners(&listeners, 0, (int)rfbport); - vlog.info("Listening on port %d", (int)rfbport); - - const char *hostsData = hostsFile.getData(); - FileTcpFilter fileTcpFilter(hostsData); - if (strlen(hostsData) != 0) -- listener.setFilter(&fileTcpFilter); -+ for (std::list::iterator i = listeners.begin(); -+ i != listeners.end(); -+ i++) -+ (*i).setFilter(&fileTcpFilter); - delete[] hostsData; - - PollingScheduler sched((int)pollingCycle, (int)maxProcessorUsage); -@@ -469,7 +474,11 @@ int main(int argc, char** argv) - TXWindow::handleXEvents(dpy); - - FD_ZERO(&rfds); -- FD_SET(listener.getFd(), &rfds); -+ for (std::list::iterator i = listeners.begin(); -+ i != listeners.end(); -+ i++) -+ FD_SET((*i).getFd(), &rfds); -+ - server.getSockets(&sockets); - int clients_connected = 0; - for (i = sockets.begin(); i != sockets.end(); i++) { -@@ -514,12 +523,16 @@ int main(int argc, char** argv) - } - - // Accept new VNC connections -- if (FD_ISSET(listener.getFd(), &rfds)) { -- Socket* sock = listener.accept(); -- if (sock) { -- server.addSocket(sock); -- } else { -- vlog.status("Client connection rejected"); -+ for (std::list::iterator i = listeners.begin(); -+ i != listeners.end(); -+ i++) { -+ if (FD_ISSET((*i).getFd(), &rfds)) { -+ Socket* sock = (*i).accept(); -+ if (sock) { -+ server.addSocket(sock); -+ } else { -+ vlog.status("Client connection rejected"); -+ } - } - } - -diff --git a/unix/xserver/hw/vnc/XserverDesktop.cc b/unix/xserver/hw/vnc/XserverDesktop.cc -index 05169b0..d0a9953 100644 ---- a/unix/xserver/hw/vnc/XserverDesktop.cc -+++ b/unix/xserver/hw/vnc/XserverDesktop.cc -@@ -135,13 +135,13 @@ public: - - - XserverDesktop::XserverDesktop(ScreenPtr pScreen_, -- network::TcpListener* listener_, -- network::TcpListener* httpListener_, -+ std::list listeners_, -+ std::list httpListeners_, - const char* name, const rfb::PixelFormat &pf, - void* fbptr, int stride) - : pScreen(pScreen_), - server(0), httpServer(0), -- listener(listener_), httpListener(httpListener_), -+ listeners(listeners_), httpListeners(httpListeners_), - cmap(0), deferredUpdateTimerSet(false), - grabbing(false), ignoreHooks_(false), directFbptr(true), - queryConnectId(0) -@@ -155,7 +155,7 @@ XserverDesktop::XserverDesktop(ScreenPtr pScreen_, - setFramebuffer(pScreen->width, pScreen->height, fbptr, stride); - server->setQueryConnectionHandler(this); - -- if (httpListener) -+ if (!httpListeners.empty ()) - httpServer = new FileHTTPServer(this); - } - -@@ -315,7 +315,7 @@ char* XserverDesktop::substitute(const char* varName) - } - if (strcmp(varName, "$PORT") == 0) { - char* str = new char[10]; -- sprintf(str, "%d", listener ? listener->getMyPort() : 0); -+ sprintf(str, "%d", listeners.empty () ? 0 : (*listeners.begin ()).getMyPort()); - return str; - } - if (strcmp(varName, "$WIDTH") == 0) { -@@ -587,14 +587,18 @@ void XserverDesktop::blockHandler(fd_set* fds, OSTimePtr timeout) - - // Add all sockets we want read events for, after purging - // any closed sockets. -- if (listener) -- FD_SET(listener->getFd(), fds); -- if (httpListener) -- FD_SET(httpListener->getFd(), fds); -+ for (std::list::iterator i = listeners.begin(); -+ i != listeners.end(); -+ i++) -+ FD_SET((*i).getFd(), fds); -+ for (std::list::iterator i = httpListeners.begin(); -+ i != httpListeners.end(); -+ i++) -+ FD_SET((*i).getFd(), fds); - - std::list sockets; -- server->getSockets(&sockets); - std::list::iterator i; -+ server->getSockets(&sockets); - for (i = sockets.begin(); i != sockets.end(); i++) { - int fd = (*i)->getFd(); - if ((*i)->isShutdown()) { -@@ -646,20 +650,24 @@ void XserverDesktop::wakeupHandler(fd_set* fds, int nfds) - // First check for file descriptors with something to do - if (nfds >= 1) { - -- if (listener) { -- if (FD_ISSET(listener->getFd(), fds)) { -- FD_CLR(listener->getFd(), fds); -- Socket* sock = listener->accept(); -+ for (std::list::iterator i = listeners.begin(); -+ i != listeners.end(); -+ i++) { -+ if (FD_ISSET((*i).getFd(), fds)) { -+ FD_CLR((*i).getFd(), fds); -+ Socket* sock = (*i).accept(); - sock->outStream().setBlocking(false); - server->addSocket(sock); - vlog.debug("new client, sock %d",sock->getFd()); - } - } - -- if (httpListener) { -- if (FD_ISSET(httpListener->getFd(), fds)) { -- FD_CLR(httpListener->getFd(), fds); -- Socket* sock = httpListener->accept(); -+ for (std::list::iterator i = httpListeners.begin(); -+ i != httpListeners.end(); -+ i++) { -+ if (FD_ISSET((*i).getFd(), fds)) { -+ FD_CLR((*i).getFd(), fds); -+ Socket* sock = (*i).accept(); - sock->outStream().setBlocking(false); - httpServer->addSocket(sock); - vlog.debug("new http client, sock %d",sock->getFd()); -diff --git a/unix/xserver/hw/vnc/XserverDesktop.h b/unix/xserver/hw/vnc/XserverDesktop.h -index ca6e8af..23cdc83 100644 ---- a/unix/xserver/hw/vnc/XserverDesktop.h -+++ b/unix/xserver/hw/vnc/XserverDesktop.h -@@ -58,8 +58,9 @@ class XserverDesktop : public rfb::SDesktop, public rfb::FullFramePixelBuffer, - public rfb::VNCServerST::QueryConnectionHandler { - public: - -- XserverDesktop(ScreenPtr pScreen, network::TcpListener* listener, -- network::TcpListener* httpListener_, -+ XserverDesktop(ScreenPtr pScreen, -+ std::list listeners_, -+ std::list httpListeners_, - const char* name, const rfb::PixelFormat &pf, - void* fbptr, int stride); - virtual ~XserverDesktop(); -@@ -136,8 +137,8 @@ private: - InputDevice *inputDevice; - rfb::VNCServerST* server; - rfb::HTTPServer* httpServer; -- network::TcpListener* listener; -- network::TcpListener* httpListener; -+ std::list listeners; -+ std::list httpListeners; - ColormapPtr cmap; - int stride_; - bool deferredUpdateTimerSet; -diff --git a/unix/xserver/hw/vnc/vncExtInit.cc b/unix/xserver/hw/vnc/vncExtInit.cc -index 1abf7d5..1cfaf51 100644 ---- a/unix/xserver/hw/vnc/vncExtInit.cc -+++ b/unix/xserver/hw/vnc/vncExtInit.cc -@@ -127,6 +127,9 @@ rfb::StringParameter desktopName("desktop", "Name of VNC desktop","x11"); - rfb::BoolParameter localhostOnly("localhost", - "Only allow connections from localhost", - false); -+rfb::StringParameter interface("interface", -+ "listen on the specified network address", -+ "all"); - - static PixelFormat vncGetPixelFormat(ScreenPtr pScreen) - { -@@ -222,29 +225,43 @@ void vncExtensionInit() - for (int scr = 0; scr < screenInfo.numScreens; scr++) { - - if (!desktop[scr]) { -- network::TcpListener* listener = 0; -- network::TcpListener* httpListener = 0; -+ std::list listeners; -+ std::list httpListeners; - if (scr == 0 && vncInetdSock != -1) { - if (network::TcpSocket::isListening(vncInetdSock)) - { -- listener = new network::TcpListener(NULL, 0, 0, vncInetdSock, true); -+ listeners.push_back (network::TcpListener(vncInetdSock)); - vlog.info("inetd wait"); - } - } else { -+ const char *addr = interface; - int port = rfbport; - if (port == 0) port = 5900 + atoi(display); - port += 1000 * scr; -- listener = new network::TcpListener(listenaddr, port, localhostOnly); -+ if (strcasecmp(addr, "all") == 0) -+ addr = 0; -+ if (localhostOnly) -+ network::createLocalTcpListeners(&listeners, port); -+ else -+ network::createTcpListeners(&listeners, addr, port); -+ - vlog.info("Listening for VNC connections on %s interface(s), port %d", -- listenaddr == NULL ? "all" : listenaddr, port); -+ localhostOnly ? "local" : (const char*)interface, -+ port); -+ - CharArray httpDirStr(httpDir.getData()); - if (httpDirStr.buf[0]) { - port = httpPort; - if (port == 0) port = 5800 + atoi(display); - port += 1000 * scr; -- httpListener = new network::TcpListener(listenaddr, port, localhostOnly); -+ if (localhostOnly) -+ network::createLocalTcpListeners(&httpListeners, port); -+ else -+ network::createTcpListeners(&httpListeners, addr, port); -+ - vlog.info("Listening for HTTP connections on %s interface(s), port %d", -- listenaddr == NULL ? "all" : listenaddr, port); -+ localhostOnly ? "local" : (const char*)interface, -+ port); - } - } - -@@ -252,15 +269,15 @@ void vncExtensionInit() - PixelFormat pf = vncGetPixelFormat(screenInfo.screens[scr]); - - desktop[scr] = new XserverDesktop(screenInfo.screens[scr], -- listener, -- httpListener, -+ listeners, -+ httpListeners, - desktopNameStr.buf, - pf, - vncFbptr[scr], - vncFbstride[scr]); - vlog.info("created VNC server for screen %d", scr); - -- if (scr == 0 && vncInetdSock != -1 && !listener) { -+ if (scr == 0 && vncInetdSock != -1 && listeners.empty()) { - network::Socket* sock = new network::TcpSocket(vncInetdSock); - desktop[scr]->addClient(sock, false); - vlog.info("added inetd sock"); -diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx -index 2d7685f..81bf849 100644 ---- a/vncviewer/vncviewer.cxx -+++ b/vncviewer/vncviewer.cxx -@@ -459,15 +459,45 @@ int main(int argc, char** argv) - #endif - - if (listenMode) { -+ std::list listeners; - try { - int port = 5500; - if (isdigit(vncServerName[0])) - port = atoi(vncServerName); - -- TcpListener listener(NULL, port); -+ createTcpListeners(&listeners, 0, port); - - vlog.info("Listening on port %d\n", port); -- sock = listener.accept(); -+ -+ /* Wait for a connection */ -+ while (sock == NULL) { -+ fd_set rfds; -+ FD_ZERO(&rfds); -+ for (std::list::iterator i = listeners.begin(); -+ i != listeners.end(); -+ i++) -+ FD_SET((*i).getFd(), &rfds); -+ -+ int n = select(FD_SETSIZE, &rfds, 0, 0, 0); -+ if (n < 0) { -+ if (errno == EINTR) { -+ vlog.debug("Interrupted select() system call"); -+ continue; -+ } else { -+ throw rdr::SystemException("select", errno); -+ } -+ } -+ -+ for (std::list::iterator i = listeners.begin (); -+ i != listeners.end(); -+ i++) -+ if (FD_ISSET((*i).getFd(), &rfds)) { -+ sock = (*i).accept(); -+ if (sock) -+ /* Got a connection */ -+ break; -+ } -+ } - } catch (rdr::Exception& e) { - vlog.error("%s", e.str()); - fl_alert("%s", e.str()); -diff --git a/win/rfb_win32/Dialog.cxx b/win/rfb_win32/Dialog.cxx -index 70a5fb5..24e0d9f 100644 ---- a/win/rfb_win32/Dialog.cxx -+++ b/win/rfb_win32/Dialog.cxx -@@ -86,21 +86,17 @@ TCHAR* Dialog::getItemString(int id) { - } - - void Dialog::setItemChecked(int id, bool state) { -- dlog.debug("bool[%d]=%d", id, (int)state); - SendMessage(GetDlgItem(handle, id), BM_SETCHECK, state ? BST_CHECKED : BST_UNCHECKED, 0); - } - void Dialog::setItemInt(int id, int value) { -- dlog.debug("int[%d]=%d", id, value); - SetDlgItemInt(handle, id, value, TRUE); - } - void Dialog::setItemString(int id, const TCHAR* s) { -- dlog.debug("string[%d]=%s", id, (const char*)CStr(s)); - SetDlgItemText(handle, id, s); - } - - - void Dialog::enableItem(int id, bool state) { -- dlog.debug("enable[%d]=%d", id, (int)state); - EnableWindow(GetDlgItem(handle, id), state); - } - -@@ -361,7 +357,6 @@ bool PropSheet::showPropSheet(HWND owner, bool showApply, bool showCtxtHelp, boo - } - - void PropSheet::reInitPages() { -- plog.debug("reInitPages %lx", handle); - std::list::iterator pspi; - for (pspi=pages.begin(); pspi!=pages.end(); pspi++) { - if ((*pspi)->handle) -@@ -370,7 +365,6 @@ void PropSheet::reInitPages() { - } - - bool PropSheet::commitPages() { -- plog.debug("commitPages %lx", handle); - bool result = true; - std::list::iterator pspi; - for (pspi=pages.begin(); pspi!=pages.end(); pspi++) { -@@ -383,7 +377,6 @@ bool PropSheet::commitPages() { - - void PropSheetPage::setChanged(bool changed) { - if (propSheet) { -- plog.debug("setChanged[%lx(%lx)]=%d", handle, propSheet->handle, (int)changed); - if (changed) - PropSheet_Changed(propSheet->handle, handle); - else -diff --git a/win/rfb_win32/SocketManager.cxx b/win/rfb_win32/SocketManager.cxx -index d4f1965..b073b8f 100644 ---- a/win/rfb_win32/SocketManager.cxx -+++ b/win/rfb_win32/SocketManager.cxx -@@ -174,7 +174,7 @@ void SocketManager::processEvent(HANDLE event) { - vlog.info("deleting listening socket"); - remListener(li.sock); - } else if (network_events.lNetworkEvents & FD_ADDRESS_LIST_CHANGE) { -- li.notifier->processAddressChange(li.sock); -+ li.notifier->processAddressChange(); - requestAddressChangeEvents(li.sock); - } else { - vlog.error("unknown listener event: %lx", network_events.lNetworkEvents); -diff --git a/win/rfb_win32/SocketManager.h b/win/rfb_win32/SocketManager.h -index ef35974..c3c8faf 100644 ---- a/win/rfb_win32/SocketManager.h -+++ b/win/rfb_win32/SocketManager.h -@@ -48,7 +48,7 @@ namespace rfb { - class AddressChangeNotifier { - public: - virtual ~AddressChangeNotifier() {} -- virtual void processAddressChange(network::SocketListener* sl) = 0; -+ virtual void processAddressChange() = 0; - }; - - // Add a listening socket. Incoming connections will be added to the supplied -diff --git a/win/vncconfig/vncconfig.cxx b/win/vncconfig/vncconfig.cxx -index 535febb..74d5e66 100644 ---- a/win/vncconfig/vncconfig.cxx -+++ b/win/vncconfig/vncconfig.cxx -@@ -16,6 +16,7 @@ - * USA. - */ - -+#include - #include - #include - #include -diff --git a/win/winvnc/ManagedListener.cxx b/win/winvnc/ManagedListener.cxx -index f2933bb..ac408e7 100644 ---- a/win/winvnc/ManagedListener.cxx -+++ b/win/winvnc/ManagedListener.cxx -@@ -26,12 +26,16 @@ static LogWriter vlog("ManagedListener"); - - - ManagedListener::ManagedListener(SocketManager* mgr) --: sock(0), filter(0), manager(mgr), addrChangeNotifier(0), server(0), port(0), localOnly(false) { -+: filter(0), manager(mgr), addrChangeNotifier(0), server(0), port(0), localOnly(false) { - } - - ManagedListener::~ManagedListener() { -- if (sock) -- manager->remListener(sock); -+ if (!sockets.empty()) { -+ std::list::iterator iter; -+ for (iter = sockets.begin(); iter != sockets.end(); ++iter) -+ manager->remListener(&*iter); -+ sockets.clear(); -+ } - delete filter; - } - -@@ -57,8 +61,11 @@ void ManagedListener::setFilter(const char* filterStr) { - vlog.info("set filter to %s", filterStr); - delete filter; - filter = new network::TcpFilter(filterStr); -- if (sock && !localOnly) -- sock->setFilter(filter); -+ if (!sockets.empty() && !localOnly) { -+ std::list::iterator iter; -+ for (iter = sockets.begin(); iter != sockets.end(); ++iter) -+ iter->setFilter(filter); -+ } - } - - void ManagedListener::setAddressChangeNotifier(SocketManager::AddressChangeNotifier* acn) { -@@ -68,26 +75,39 @@ void ManagedListener::setAddressChangeNotifier(SocketManager::AddressChangeNotif - refresh(); - } - -+bool ManagedListener::isListening() { -+ return !sockets.empty(); -+} - - void ManagedListener::refresh() { -- if (sock) -- manager->remListener(sock); -- sock = 0; -+ std::list::iterator iter; -+ if (!sockets.empty()) { -+ for (iter = sockets.begin(); iter != sockets.end(); ++iter) -+ manager->remListener(&*iter); -+ sockets.clear(); -+ } - if (!server) - return; - try { -- if (port) -- sock = new network::TcpListener(NULL, port, localOnly); -+ if (port) { -+ if (localOnly) -+ network::createLocalTcpListeners(&sockets, port); -+ else -+ network::createTcpListeners(&sockets, NULL, port); -+ } - } catch (rdr::Exception& e) { - vlog.error(e.str()); - } -- if (sock) { -- if (!localOnly) -- sock->setFilter(filter); -+ if (!sockets.empty()) { -+ if (!localOnly) { -+ for (iter = sockets.begin(); iter != sockets.end(); ++iter) -+ iter->setFilter(filter); -+ } - try { -- manager->addListener(sock, server, addrChangeNotifier); -- } catch (...) { -- sock = 0; -+ for (iter = sockets.begin(); iter != sockets.end(); ++iter) -+ manager->addListener(&*iter, server, addrChangeNotifier); } catch (...) { -+ // FIXME: Should unwind what we've added -+ sockets.clear(); - throw; - } - } -diff --git a/win/winvnc/ManagedListener.h b/win/winvnc/ManagedListener.h -index e83aa0b..1c7099f 100644 ---- a/win/winvnc/ManagedListener.h -+++ b/win/winvnc/ManagedListener.h -@@ -40,10 +40,12 @@ namespace winvnc { - void setPort(int port, bool localOnly=false); - void setFilter(const char* filter); - void setAddressChangeNotifier(rfb::win32::SocketManager::AddressChangeNotifier* acn); -- -- network::TcpListener* sock; -+ -+ bool isListening(); -+ - protected: - void refresh(); -+ std::list sockets; - network::TcpFilter* filter; - rfb::win32::SocketManager* manager; - rfb::win32::SocketManager::AddressChangeNotifier* addrChangeNotifier; -diff --git a/win/winvnc/VNCServerWin32.cxx b/win/winvnc/VNCServerWin32.cxx -index 4d89a0e..467ff70 100644 ---- a/win/winvnc/VNCServerWin32.cxx -+++ b/win/winvnc/VNCServerWin32.cxx -@@ -43,7 +43,7 @@ static IntParameter http_port("HTTPPortNumber", - static IntParameter port_number("PortNumber", - "TCP/IP port on which the server will accept connections", 5900); - static StringParameter hosts("Hosts", -- "Filter describing which hosts are allowed access to this server", "+0.0.0.0/0.0.0.0"); -+ "Filter describing which hosts are allowed access to this server", "+"); - static BoolParameter localHost("LocalHost", - "Only accept connections from via the local loop-back network interface", false); - static BoolParameter queryOnlyIfLoggedOn("QueryOnlyIfLoggedOn", -@@ -86,8 +86,8 @@ VNCServerWin32::~VNCServerWin32() { - } - - --void VNCServerWin32::processAddressChange(network::SocketListener* sock_) { -- if (!trayIcon || (sock_ != rfbSock.sock)) -+void VNCServerWin32::processAddressChange() { -+ if (!trayIcon) - return; - - // Tool-tip prefix depends on server mode -@@ -97,8 +97,8 @@ void VNCServerWin32::processAddressChange(network::SocketListener* sock_) { - - // Fetch the list of addresses - std::list addrs; -- if (rfbSock.sock) -- rfbSock.sock->getMyAddresses(&addrs); -+ if (rfbSock.isListening()) -+ TcpListener::getMyAddresses(&addrs); - else - addrs.push_front(strDup("Not accepting connections")); - -@@ -132,7 +132,7 @@ void VNCServerWin32::regConfigChanged() { - httpSock.setPort(http_port, localHost); - - // -=- Update the Java viewer's web page port number. -- httpServer.setRFBport(rfbSock.sock ? port_number : 0); -+ httpServer.setRFBport(rfbSock.isListening() ? port_number : 0); - - // -=- Update the TCP address filter for both ports, if open. - CharArray pattern(hosts.getData()); -@@ -140,7 +140,7 @@ void VNCServerWin32::regConfigChanged() { - httpSock.setFilter(pattern.buf); - - // -=- Update the tray icon tooltip text with IP addresses -- processAddressChange(rfbSock.sock); -+ processAddressChange(); - } - - -diff --git a/win/winvnc/VNCServerWin32.h b/win/winvnc/VNCServerWin32.h -index 5b40a5a..27305d0 100644 ---- a/win/winvnc/VNCServerWin32.h -+++ b/win/winvnc/VNCServerWin32.h -@@ -82,7 +82,7 @@ namespace winvnc { - - // SocketManager::AddressChangeNotifier interface - // Used to keep tray icon up to date -- virtual void processAddressChange(network::SocketListener* sl); -+ virtual void processAddressChange(); - - // RegConfig::Callback interface - // Called via the EventManager whenver RegConfig sees the registry change diff --git a/SOURCES/tigervnc-manpages.patch b/SOURCES/tigervnc-manpages.patch index 7acf128..5919226 100644 --- a/SOURCES/tigervnc-manpages.patch +++ b/SOURCES/tigervnc-manpages.patch @@ -1,127 +1,20 @@ -diff -up tigervnc-1.2.80-20130314svn5065/unix/vncserver.man.manpages tigervnc-1.2.80-20130314svn5065/unix/vncserver.man ---- tigervnc-1.2.80-20130314svn5065/unix/vncserver.man.manpages 2013-07-03 12:44:03.820392690 +0100 -+++ tigervnc-1.2.80-20130314svn5065/unix/vncserver.man 2013-07-03 12:44:44.222587028 +0100 -@@ -92,6 +92,10 @@ argument. Thus, you can invoke "vncserv - end of your xstartup file after a particular application exits. - - .TP -+.B \-list -+Lists running VNC servers. -+ -+.TP - .B \-fp \fIfont-path\fP - If the vncserver script detects that the X Font Server (XFS) is running, it - will attempt to start Xvnc and configure Xvnc to use XFS for font handling. -diff -up tigervnc-1.2.80-20130314svn5065/unix/vncserver.manpages tigervnc-1.2.80-20130314svn5065/unix/vncserver ---- tigervnc-1.2.80-20130314svn5065/unix/vncserver.manpages 2013-07-03 12:39:08.754980784 +0100 -+++ tigervnc-1.2.80-20130314svn5065/unix/vncserver 2013-07-03 12:43:57.932364387 +0100 -@@ -551,6 +551,7 @@ sub Usage +diff --git a/unix/vncserver b/unix/vncserver +index c4d0535..08a9308 100755 +--- a/unix/vncserver ++++ b/unix/vncserver +@@ -637,6 +637,7 @@ sub Usage " [-geometry x]\n". " [-pixelformat rgbNNN|bgrNNN]\n". " [-fp ]\n". + " [-cc ]\n". " [-fg]\n". " [-autokill]\n". - " ...\n\n". -diff -up tigervnc-1.2.80-20130314svn5065/unix/x0vncserver/x0vncserver.cxx.manpages tigervnc-1.2.80-20130314svn5065/unix/x0vncserver/x0vncserver.cxx -diff -up tigervnc-1.2.80-20130314svn5065/unix/x0vncserver/x0vncserver.man.manpages tigervnc-1.2.80-20130314svn5065/unix/x0vncserver/x0vncserver.man ---- tigervnc-1.2.80-20130314svn5065/unix/x0vncserver/x0vncserver.man.manpages 2013-07-03 12:46:17.814038117 +0100 -+++ tigervnc-1.2.80-20130314svn5065/unix/x0vncserver/x0vncserver.man 2013-07-03 12:58:32.814621597 +0100 -@@ -68,7 +68,13 @@ to accept connections from any IP addres - Specify which security scheme to use for incoming connections. Valid values - are \fBNone\fP and \fBVncAuth\fP. Default is \fBVncAuth\fP. - .TP --.B PasswordFile -+.B pam_server -+Service name for pam password validation (default is "vnc"). -+.TP -+.B PlainUsers -+Users permission to access via Plain security type. -+.TP -+.B PasswordFile, rfbauth - Password file for VNC authentication. There is no default, you should - specify the password file explicitly. Password file should be created with - the \fBvncpasswd\fP(1) utility. -@@ -113,6 +119,16 @@ Accept key press and release events from - .B AcceptPointerEvents - Accept pointer events from clients. Default is on. - .TP -+.B AcceptCutText -+Accept clipboard updates from clients. Default is on. -+.TP -+.B MaxCutText -+Maximum permitted length of an incoming clipboard update (default is -+262144). -+.TP -+.B SendCutText -+Send clipboard changes to clients. Default is on. -+.TP - .B RemapKeys - Comma-separated list of incoming keysyms to remap. Mappings are expressed as - two hex values, prefixed by \fB0x\fP, and separated by \fB->\fP (`dash' and -@@ -154,23 +170,6 @@ clients may choose video selection thems - \fBVideoArea\fP parameter will take effect. If the argument is empty, no - video area is set (this is the default). - .TP --.B VideoPriority --Specify the priority of sending video updates. \fBx0vncserver\fP can be --instructed to treat certain rectangular part of the screen as a video area --and handle it in a special way for improved performance (see documentation on --the \fBVideoArea\fP parameter). \fBVideoPriority\fP value controls how often --video area will be sent to clients as compared to the rest of the screen. --The priority must be an integer between 0 and 8, and the default value is 2. -- --\fBVideoPriority\fP set to 1 gives the same priority both to video and to --other pixels. Higher values give more priority to video. For example, the --value 5 specifies that the rate of sending video will be five times higher --than the rate of updating the rest of the screen. If \fBVideoPriority\fP is --set to 0, it gives equal priority to video and other updates (just like the --value 1) and also disables special encoding for video data. In other words, --\fBVideoPriority\fP video area will be sent as a part of other screen --contents. --.TP - .B CompareFB - Perform pixel comparison on framebuffer to reduce unnecessary updates. - Default is on. -@@ -185,15 +184,6 @@ This enables system-specific access to c - screen (the default X visual often provides 256 colors). Also, in overlay - mode, \fBx0vncserver\fP can show correct mouse cursor. Default is on. - .TP --.B UseHardwareJPEG --Use hardware-accelerated JPEG compressor for video if available. --\fBx0vncserver\fP can be instructed to treat certain rectangular part of the --screen as a video area and handle it in a special way for improved --performance. If the client supports Tight encoding and JPEG compression, --such video areas will be sent as JPEG-encoded rectangles. And if this option --is on, compression will be hardware-accelerated (currently, supported only in --SGI/IRIX equipped with appropriate hardware). Default is on. --.TP - .B ZlibLevel - Zlib compression level for ZRLE encoding (it does not affect Tight encoding). - Acceptable values are between 0 and 9. Default is to use the standard -@@ -222,6 +212,18 @@ Terminate after \fIN\fP seconds of user - .B ClientWaitTimeMillis - The number of milliseconds to wait for a client which is no longer - responding. Default is 20000. -+.TP -+.B DeferUpdate -+Time in milliseconds to defer updates (default is 1). -+.TP -+.B AlwaysSetDeferUpdateTimer -+Always reset the defer update timer on every change. -+.TP -+.B x509key -+Path to key of the x509 certificate in PEM format. -+.TP -+.B 509cert -+Path to x509 certificate in PEM format. - .SH SEE ALSO - .BR Xvnc (1), - .BR vncpasswd (1), -diff -up tigervnc-1.2.80-20130314svn5065/vncviewer/vncviewer.cxx.manpages tigervnc-1.2.80-20130314svn5065/vncviewer/vncviewer.cxx ---- tigervnc-1.2.80-20130314svn5065/vncviewer/vncviewer.cxx.manpages 2013-07-03 12:00:58.005856116 +0100 -+++ tigervnc-1.2.80-20130314svn5065/vncviewer/vncviewer.cxx 2013-07-03 12:04:26.083023050 +0100 -@@ -261,6 +261,11 @@ static void usage(const char *programNam + " [-noxstartup]\n". +diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx +index a2bc029..6923d0e 100644 +--- a/vncviewer/vncviewer.cxx ++++ b/vncviewer/vncviewer.cxx +@@ -338,6 +338,11 @@ static void usage(const char *programName) " %s [parameters] -listen [port] [parameters]\n", programName, programName); fprintf(stderr,"\n" @@ -133,104 +26,3 @@ diff -up tigervnc-1.2.80-20130314svn5065/vncviewer/vncviewer.cxx.manpages tigerv "Parameters can be turned on with - or off with -=0\n" "Parameters which take a value can be specified as " "- \n" -diff -up tigervnc-1.2.80-20130314svn5065/vncviewer/vncviewer.man.manpages tigervnc-1.2.80-20130314svn5065/vncviewer/vncviewer.man ---- tigervnc-1.2.80-20130314svn5065/vncviewer/vncviewer.man.manpages 2013-07-03 11:40:48.905078300 +0100 -+++ tigervnc-1.2.80-20130314svn5065/vncviewer/vncviewer.man 2013-07-03 12:00:13.116604372 +0100 -@@ -113,12 +113,53 @@ Xvnc supports reverse connections with a - .B vncconfig. - - .TP --.B \-passwd \fIpassword-file\fP -+.B \-passwd \fIpassword-file\fP, \-PasswordFile \fIpassword-file\fP - If you are on a filesystem which gives you access to the password file used by - the server, you can specify it here to avoid typing it in. It will usually be - "~/.vnc/passwd". - - .TP -+.B \-DotWhenNoCursor -+Show the dot cursor when the server sends an invisible cursor. -+ -+.TP -+.B \-PointerEventInterval -+Time in milliseconds to rate-limit successive pointer events. -+ -+.TP -+.B \-ImprovedHextile -+Try harder to compress data (default). -+ -+.TP -+.B \-QualityLevel \fIlevel\fP -+JPEG quality level (default is 8). -+ -+.TP -+.B \-NoJPEG -+Disable lossy JPEG compression in Tight encoding. -+ -+.TP -+.B CompressLevel \fIlevel\fP -+Use specified compression level (default is 2). -+ -+.TP -+.B CustomCompressLevel \fIlevel\fP -+Use custom compression level. Default is CompressLevel is specified. -+ -+.TP -+.B \-SendPrimary -+Send the primary selection and cut buffer to the server as well as the -+clipboard selection (default). -+ -+.TP -+.B \-SendClipboard -+Send clipboard changes to the server (default). -+ -+.TP -+.B \-AcceptClipboard -+Accept clipboard changes from the server (default). -+ -+.TP - .B \-Shared - When you make a connection to a VNC server, all other existing connections are - normally closed. This option requests that they be left open, allowing you to -@@ -140,6 +181,19 @@ Maximize viewer window. - Start in full-screen mode. - - .TP -+.B \-FullScreenAllMonitors -+Enable full screen over all monitors (default). -+ -+.TP -+.B \-FullscreenSystemKeys -+Pass special keys directly to the server in full-screen mode. -+ -+.TP -+.B \-RemoteResize -+Dynamically resize the remote desktop size as the size of the local -+client window changes (default). -+ -+.TP - .B \-DesktopSize \fIwidth\fPx\fIheight\fP - Instead of keeping the existing remote screen size, the client will attempt to - switch to the specified since when connecting. If the server does not support -@@ -214,6 +268,22 @@ command is executed with the environment - host, the port number on the remote host, and the gateway machine - respectively. - -+.TP -+\fB\-ZlibLevel\fR \fIlevel\fR -+Zlib compression level. -+ -+.TP -+.B \-x509crl \fIfile\fP -+X509 CRL file -+ -+.TP -+.B \-x509ca \fIfile\fP -+X509 CA certificate -+ -+.TP -+.B \-SecurityTypes \fItypes\fP -+Specify which security scheme to use. -+ - .SH SEE ALSO - .BR Xvnc (1), - .BR vncpasswd (1), diff --git a/SOURCES/tigervnc-no-warning-with-wformat-security.patch b/SOURCES/tigervnc-no-warning-with-wformat-security.patch deleted file mode 100644 index f588be0..0000000 --- a/SOURCES/tigervnc-no-warning-with-wformat-security.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx -index c15c951..2d7685f 100644 ---- a/vncviewer/vncviewer.cxx -+++ b/vncviewer/vncviewer.cxx -@@ -309,7 +309,6 @@ interpretViaParam(char *remoteHost, int *remotePort, int localPort) - - snprintf(vncServerName, VNCSERVERNAMELEN, "localhost::%d", localPort); - vncServerName[VNCSERVERNAMELEN - 1] = '\0'; -- vlog.error(vncServerName); - - return 0; - } diff --git a/SOURCES/tigervnc-pointersync.patch b/SOURCES/tigervnc-pointersync.patch deleted file mode 100644 index 3870f2e..0000000 --- a/SOURCES/tigervnc-pointersync.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff --git a/unix/xserver/hw/vnc/Input.cc b/unix/xserver/hw/vnc/Input.cc -index d093f89..43c3ac3 100644 ---- a/unix/xserver/hw/vnc/Input.cc -+++ b/unix/xserver/hw/vnc/Input.cc -@@ -197,6 +197,14 @@ void InputDevice::PointerMove(const rfb::Point &pos) - - void InputDevice::PointerSync(void) - { -+ if (pointerDev) { -+ int x, y; -+ -+ GetSpritePosition (pointerDev, &x, &y); -+ cursorPos.x = x; -+ cursorPos.y = y; -+ } -+ - if (cursorPos.equals(oldCursorPos)) - return; - diff --git a/SOURCES/tigervnc-set-initial-mode-as-prefered.patch b/SOURCES/tigervnc-set-initial-mode-as-prefered.patch deleted file mode 100644 index 773981f..0000000 --- a/SOURCES/tigervnc-set-initial-mode-as-prefered.patch +++ /dev/null @@ -1,41 +0,0 @@ -diff --git a/unix/xserver/hw/vnc/xvnc.cc b/unix/xserver/hw/vnc/xvnc.cc -index f2656d1..0e325e2 100644 ---- a/unix/xserver/hw/vnc/xvnc.cc -+++ b/unix/xserver/hw/vnc/xvnc.cc -@@ -1318,12 +1318,22 @@ static RRCrtcPtr vncRandRCrtcCreate(ScreenPtr pScreen) - /* Make sure the CRTC has this output set */ - vncRandRCrtcSet(pScreen, crtc, NULL, 0, 0, RR_Rotate_0, 1, &output); - -- /* Populate a list of default modes */ -- RRModePtr modes[sizeof(vncRandRWidths)/sizeof(*vncRandRWidths)]; -- int num_modes; -+ /* Populate a list of modes */ -+ RRModePtr modes[sizeof(vncRandRWidths)/sizeof(*vncRandRWidths) + 1]; -+ int num_modes = 0; - -- num_modes = 0; -+ /* Start with requested mode */ -+ mode = vncRandRModeGet(pScreen->width, pScreen->height); -+ if(mode != NULL) { -+ modes[num_modes] = mode; -+ num_modes++; -+ } -+ -+ /* Add default modes */ - for (int i = 0;i < sizeof(vncRandRWidths)/sizeof(*vncRandRWidths);i++) { -+ if (vncRandRWidths[i] == pScreen->width && vncRandRHeights[i] == pScreen->height) -+ continue; -+ - mode = vncRandRModeGet(vncRandRWidths[i], vncRandRHeights[i]); - if (mode != NULL) { - modes[num_modes] = mode; - @@ -1331,7 +1341,7 @@ static RRCrtcPtr vncRandRCrtcCreate(ScreenPtr pScreen) - } - } - -- RROutputSetModes(output, modes, num_modes, 0); -+ RROutputSetModes(output, modes, num_modes, 1); - - return crtc; - } - diff --git a/SOURCES/tigervnc-setcursor-crash.patch b/SOURCES/tigervnc-setcursor-crash.patch deleted file mode 100644 index 1efbd0e..0000000 --- a/SOURCES/tigervnc-setcursor-crash.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -up tigervnc-1.2.80-20130314svn5065/unix/xserver/hw/vnc/XserverDesktop.cc.jx tigervnc-1.2.80-20130314svn5065/unix/xserver/hw/vnc/XserverDesktop.cc ---- tigervnc-1.2.80-20130314svn5065/unix/xserver/hw/vnc/XserverDesktop.cc.jx 2012-08-27 09:02:47.000000000 -0400 -+++ tigervnc-1.2.80-20130314svn5065/unix/xserver/hw/vnc/XserverDesktop.cc 2013-06-17 09:42:14.310725996 -0400 -@@ -479,6 +479,9 @@ void XserverDesktop::setCursor(CursorPtr - } - } else { - #endif -+ if (!cmap) -+ return; -+ - xColorItem fg, bg; - fg.red = cursor->foreRed; - fg.green = cursor->foreGreen; diff --git a/SOURCES/tigervnc-xserver117.patch b/SOURCES/tigervnc-xserver117.patch deleted file mode 100644 index 5f5a73c..0000000 --- a/SOURCES/tigervnc-xserver117.patch +++ /dev/null @@ -1,137 +0,0 @@ -diff -up xorg-server-1.17.1/configure.ac.xserver116-rebased xorg-server-1.17.1/configure.ac ---- xorg-server-1.17.1/configure.ac.xserver116-rebased 2015-02-10 22:43:52.000000000 +0000 -+++ xorg-server-1.17.1/configure.ac 2015-02-13 16:14:05.074515927 +0000 -@@ -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]) -@@ -1795,6 +1796,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 - -@@ -1830,6 +1835,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' -@@ -2059,7 +2066,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_UNQUOTED(XORG_VERSION_CURRENT, [$VENDOR_RELEASE], [Current Xorg version]) - 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]) -@@ -2599,6 +2605,7 @@ hw/dmx/Makefile - hw/dmx/man/Makefile - hw/vfb/Makefile - hw/vfb/man/Makefile -+hw/vnc/Makefile - hw/xnest/Makefile - hw/xnest/man/Makefile - hw/xwin/Makefile -diff -up xorg-server-1.17.1/hw/Makefile.am.xserver116-rebased xorg-server-1.17.1/hw/Makefile.am ---- xorg-server-1.17.1/hw/Makefile.am.xserver116-rebased 2014-04-16 21:24:00.000000000 +0100 -+++ xorg-server-1.17.1/hw/Makefile.am 2015-02-13 16:14:05.131516821 +0000 -@@ -38,7 +38,8 @@ SUBDIRS = \ - $(DMX_SUBDIRS) \ - $(KDRIVE_SUBDIRS) \ - $(XQUARTZ_SUBDIRS) \ -- $(XWAYLAND_SUBDIRS) -+ $(XWAYLAND_SUBDIRS) \ -+ vnc - - DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive xwayland - -diff -up xorg-server-1.17.1/mi/miinitext.c.xserver116-rebased xorg-server-1.17.1/mi/miinitext.c ---- xorg-server-1.17.1/mi/miinitext.c.xserver116-rebased 2015-01-17 23:42:52.000000000 +0000 -+++ xorg-server-1.17.1/mi/miinitext.c 2015-02-13 16:14:05.131516821 +0000 -@@ -111,6 +111,10 @@ SOFTWARE. - #include "micmap.h" - #include "globals.h" - -+#ifdef TIGERVNC -+extern void vncExtensionInit(INITARGS); -+#endif -+ - /* The following is only a small first step towards run-time - * configurable extensions. - */ -@@ -235,6 +239,9 @@ EnableDisableExtensionError(const char * - - /* List of built-in (statically linked) extensions */ - static const ExtensionModule staticExtensions[] = { -+#ifdef TIGERVNC -+ {vncExtensionInit, "VNC-EXTENSION", NULL}, -+#endif - {GEExtensionInit, "Generic Event Extension", &noGEExtension}, - {ShapeExtensionInit, "SHAPE", NULL}, - #ifdef MITSHM -diff -up xorg-server-1.17.1/os/WaitFor.c.xserver116-rebased xorg-server-1.17.1/os/WaitFor.c ---- xorg-server-1.17.1/os/WaitFor.c.xserver116-rebased 2015-01-26 18:40:30.000000000 +0000 -+++ xorg-server-1.17.1/os/WaitFor.c 2015-02-13 16:14:05.132516837 +0000 -@@ -125,6 +125,9 @@ static void DoTimer(OsTimerPtr timer, CA - static void CheckAllTimers(void); - static volatile OsTimerPtr timers = NULL; - -+extern void vncWriteBlockHandler(fd_set *fds); -+extern void vncWriteWakeupHandler(int nfds, fd_set *fds); -+ - /***************** - * WaitForSomething: - * Make the server suspend until there is -@@ -150,6 +153,7 @@ WaitForSomething(int *pClientsReady) - INT32 timeout = 0; - fd_set clientsReadable; - fd_set clientsWritable; -+ fd_set socketsWritable; - int curclient; - int selecterr; - static int nready; -@@ -212,6 +216,9 @@ WaitForSomething(int *pClientsReady) - XFD_COPYSET(&AllSockets, &LastSelectMask); - } - -+ FD_ZERO(&socketsWritable); -+ vncWriteBlockHandler(&socketsWritable); -+ - BlockHandler((void *) &wt, (void *) &LastSelectMask); - if (NewOutputPending) - FlushAllOutput(); -@@ -223,10 +230,20 @@ WaitForSomething(int *pClientsReady) - i = Select(MaxClients, &LastSelectMask, &clientsWritable, NULL, wt); - } - else { -- i = Select(MaxClients, &LastSelectMask, NULL, NULL, wt); -+ if (AnyClientsWriteBlocked) -+ XFD_ORSET(&socketsWritable, &ClientsWriteBlocked, &socketsWritable); -+ -+ if (XFD_ANYSET(&socketsWritable)) { -+ i = Select(MaxClients, &LastSelectMask, &socketsWritable, NULL, wt); -+ if (AnyClientsWriteBlocked) -+ XFD_ANDSET(&clientsWritable, &socketsWritable, &ClientsWriteBlocked); -+ } else { -+ i = Select(MaxClients, &LastSelectMask, NULL, NULL, wt); -+ } - } - selecterr = GetErrno(); - WakeupHandler(i, (void *) &LastSelectMask); -+ vncWriteWakeupHandler(i, &socketsWritable); - if (i <= 0) { /* An error or timeout occurred */ - if (dispatchException) - return 0; diff --git a/SOURCES/tigervnc-xserver119.patch b/SOURCES/tigervnc-xserver119.patch new file mode 100644 index 0000000..614f104 --- /dev/null +++ b/SOURCES/tigervnc-xserver119.patch @@ -0,0 +1,95 @@ +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]) +@@ -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 + +@@ -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' +@@ -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_UNQUOTED(XORG_VERSION_CURRENT, [$VENDOR_RELEASE], [Current Xorg version]) + 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]) +@@ -2691,6 +2697,7 @@ hw/dmx/Makefile + hw/dmx/man/Makefile + hw/vfb/Makefile + hw/vfb/man/Makefile ++hw/vnc/Makefile + hw/xnest/Makefile + hw/xnest/man/Makefile + hw/xwin/Makefile +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) \ + $(XQUARTZ_SUBDIRS) \ +- $(XWAYLAND_SUBDIRS) ++ $(XWAYLAND_SUBDIRS) \ ++ vnc + + DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive xwayland + +diff -up xserver/mi/miinitext.c.xserver116-rebased xserver/mi/miinitext.c +--- xserver/mi/miinitext.c.xserver116-rebased 2016-09-29 13:14:45.618441855 +0200 ++++ xserver/mi/miinitext.c 2016-09-29 13:14:45.631442006 +0200 +@@ -114,6 +114,10 @@ SOFTWARE. + #include "micmap.h" + #include "globals.h" + ++#ifdef TIGERVNC ++extern void vncExtensionInit(INITARGS); ++#endif ++ + /* The following is only a small first step towards run-time + * configurable extensions. + */ +@@ -238,6 +242,9 @@ EnableDisableExtensionError(const char * + + /* List of built-in (statically linked) extensions */ + static const ExtensionModule staticExtensions[] = { ++#ifdef TIGERVNC ++ {vncExtensionInit, "VNC-EXTENSION", NULL}, ++#endif + {GEExtensionInit, "Generic Event Extension", &noGEExtension}, + {ShapeExtensionInit, "SHAPE", NULL}, + #ifdef MITSHM +--- 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); diff --git a/SOURCES/tigervnc-xstartup.patch b/SOURCES/tigervnc-xstartup.patch index 696d92b..38440d1 100644 --- a/SOURCES/tigervnc-xstartup.patch +++ b/SOURCES/tigervnc-xstartup.patch @@ -27,6 +27,7 @@ diff -up tigervnc-1.3.0/unix/vncserver.xstartup tigervnc-1.3.0/unix/vncserver - "xterm -geometry 80x24+10+10 -ls -title \"\$VNCDESKTOP Desktop\" &\n". - "twm &\n"); + "exec /etc/X11/xinit/xinitrc\n"); - - chop($host = `uname -n`); - + + $defaultConfig + = ("## Supported server options to pass to vncserver upon invocation can be listed\n". + diff --git a/SOURCES/tigervnc-zrle-crash.patch b/SOURCES/tigervnc-zrle-crash.patch deleted file mode 100644 index 74545d7..0000000 --- a/SOURCES/tigervnc-zrle-crash.patch +++ /dev/null @@ -1,69 +0,0 @@ -diff -up tigervnc-1.3.0/common/rfb/ZRLEEncoder.cxx.zrle-crash tigervnc-1.3.0/common/rfb/ZRLEEncoder.cxx ---- tigervnc-1.3.0/common/rfb/ZRLEEncoder.cxx.zrle-crash 2013-07-01 13:41:59.000000000 +0100 -+++ tigervnc-1.3.0/common/rfb/ZRLEEncoder.cxx 2013-12-12 17:30:48.510007365 +0000 -@@ -55,16 +55,19 @@ Encoder* ZRLEEncoder::create(SMsgWriter* - } - - ZRLEEncoder::ZRLEEncoder(SMsgWriter* writer_) -- : writer(writer_), zos(0,0,zlibLevel) -+ : writer(writer_) - { - if (sharedMos) - mos = sharedMos; - else - mos = new rdr::MemOutStream(129*1024); -+ -+ zos = new rdr::ZlibOutStream(0, 0, zlibLevel); - } - - ZRLEEncoder::~ZRLEEncoder() - { -+ delete zos; - if (!sharedMos) - delete mos; - } -@@ -78,10 +81,10 @@ bool ZRLEEncoder::writeRect(const Rect& - - switch (writer->bpp()) { - case 8: -- wroteAll = zrleEncode8(r, mos, &zos, imageBuf, maxLen, actual, ig); -+ wroteAll = zrleEncode8(r, mos, zos, imageBuf, maxLen, actual, ig); - break; - case 16: -- wroteAll = zrleEncode16(r, mos, &zos, imageBuf, maxLen, actual, ig); -+ wroteAll = zrleEncode16(r, mos, zos, imageBuf, maxLen, actual, ig); - break; - case 32: - { -@@ -94,16 +97,16 @@ bool ZRLEEncoder::writeRect(const Rect& - if ((fitsInLS3Bytes && pf.isLittleEndian()) || - (fitsInMS3Bytes && pf.isBigEndian())) - { -- wroteAll = zrleEncode24A(r, mos, &zos, imageBuf, maxLen, actual, ig); -+ wroteAll = zrleEncode24A(r, mos, zos, imageBuf, maxLen, actual, ig); - } - else if ((fitsInLS3Bytes && pf.isBigEndian()) || - (fitsInMS3Bytes && pf.isLittleEndian())) - { -- wroteAll = zrleEncode24B(r, mos, &zos, imageBuf, maxLen, actual, ig); -+ wroteAll = zrleEncode24B(r, mos, zos, imageBuf, maxLen, actual, ig); - } - else - { -- wroteAll = zrleEncode32(r, mos, &zos, imageBuf, maxLen, actual, ig); -+ wroteAll = zrleEncode32(r, mos, zos, imageBuf, maxLen, actual, ig); - } - break; - } -diff -up tigervnc-1.3.0/common/rfb/ZRLEEncoder.h.zrle-crash tigervnc-1.3.0/common/rfb/ZRLEEncoder.h ---- tigervnc-1.3.0/common/rfb/ZRLEEncoder.h.zrle-crash 2013-07-01 13:42:01.000000000 +0100 -+++ tigervnc-1.3.0/common/rfb/ZRLEEncoder.h 2013-12-12 17:30:48.510007365 +0000 -@@ -45,7 +45,7 @@ namespace rfb { - private: - ZRLEEncoder(SMsgWriter* writer); - SMsgWriter* writer; -- rdr::ZlibOutStream zos; -+ rdr::ZlibOutStream* zos; - rdr::MemOutStream* mos; - static rdr::MemOutStream* sharedMos; - static int maxLen; diff --git a/SOURCES/tigervnc11-gethomedir.patch b/SOURCES/tigervnc11-gethomedir.patch deleted file mode 100644 index 0a4252d..0000000 --- a/SOURCES/tigervnc11-gethomedir.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff -up tigervnc-1.2.0/unix/xserver/hw/vnc/Makefile.am.gethomedir tigervnc-1.2.0/unix/xserver/hw/vnc/Makefile.am ---- tigervnc-1.2.0/unix/xserver/hw/vnc/Makefile.am.gethomedir 2012-08-22 15:52:01.876216608 +0200 -+++ tigervnc-1.2.0/unix/xserver/hw/vnc/Makefile.am 2012-08-22 15:52:45.973143684 +0200 -@@ -5,6 +5,7 @@ RFB_LIB=$(LIB_DIR)/rfb/librfb.la - RDR_LIB=$(LIB_DIR)/rdr/librdr.la - NETWORK_LIB=$(LIB_DIR)/network/libnetwork.la - XREGION_LIB=$(LIB_DIR)/Xregion/libXregion.la -+OS_LIB=$(LIB_DIR)/os/libos.la - COMMON_LIBS=$(NETWORK_LIB) $(RFB_LIB) $(RDR_LIB) $(XREGION_LIB) - - noinst_LTLIBRARIES = libvnccommon.la -@@ -55,7 +56,7 @@ libvnc_la_CPPFLAGS = $(XVNC_CPPFLAGS) -I - - libvnc_la_LDFLAGS = -module -avoid-version -Wl,-z,now - --libvnc_la_LIBADD = libvnccommon.la $(COMMON_LIBS) -+libvnc_la_LIBADD = libvnccommon.la $(COMMON_LIBS) $(OS_LIB) - - EXTRA_DIST = Xvnc.man - diff --git a/SOURCES/tigervnc11-ldnow.patch b/SOURCES/tigervnc11-ldnow.patch deleted file mode 100644 index f6edd09..0000000 --- a/SOURCES/tigervnc11-ldnow.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -up tigervnc-1.2.0/unix/xserver/hw/vnc/Makefile.am.ldnow tigervnc-1.2.0/unix/xserver/hw/vnc/Makefile.am ---- tigervnc-1.2.0/unix/xserver/hw/vnc/Makefile.am.ldnow 2011-10-31 09:14:40.000000000 +0100 -+++ tigervnc-1.2.0/unix/xserver/hw/vnc/Makefile.am 2012-08-22 15:51:47.013241342 +0200 -@@ -53,7 +53,7 @@ libvnc_la_CPPFLAGS = $(XVNC_CPPFLAGS) -I - -I$(top_srcdir)/include \ - ${XSERVERLIBS_CFLAGS} -I$(includedir) - --libvnc_la_LDFLAGS = -module -avoid-version -+libvnc_la_LDFLAGS = -module -avoid-version -Wl,-z,now - - libvnc_la_LIBADD = libvnccommon.la $(COMMON_LIBS) - diff --git a/SOURCES/tigervnc11-rh692048.patch b/SOURCES/tigervnc11-rh692048.patch deleted file mode 100644 index 7d0d487..0000000 --- a/SOURCES/tigervnc11-rh692048.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 1f8aba3147ec13aaa70a44372775b72bb4e59941 Mon Sep 17 00:00:00 2001 -From: Pierre Ossman -Date: Tue, 29 Dec 2015 15:02:11 +0100 -Subject: Add workaround for Vino's VeNCrypt implementation - - -diff --git a/common/rfb/Security.cxx b/common/rfb/Security.cxx -index e623ab5..0666041 100644 ---- a/common/rfb/Security.cxx -+++ b/common/rfb/Security.cxx -@@ -74,7 +74,18 @@ const std::list Security::GetEnabledSecTypes(void) - list result; - list::iterator i; - -- result.push_back(secTypeVeNCrypt); -+ /* Partial workaround for Vino's stupid behaviour. It doesn't allow -+ * the basic authentication types as part of the VeNCrypt handshake, -+ * making it impossible for a client to do opportunistic encryption. -+ * At least make it possible to connect when encryption is explicitly -+ * disabled. */ -+ for (i = enabledSecTypes.begin(); i != enabledSecTypes.end(); i++) { -+ if (*i >= 0x100) { -+ result.push_back(secTypeVeNCrypt); -+ break; -+ } -+ } -+ - for (i = enabledSecTypes.begin(); i != enabledSecTypes.end(); i++) - if (*i < 0x100) - result.push_back(*i); diff --git a/SOURCES/vncserver.service b/SOURCES/vncserver.service index 911986e..45fd823 100644 --- a/SOURCES/vncserver.service +++ b/SOURCES/vncserver.service @@ -2,10 +2,9 @@ # # Quick HowTo: # 1. Copy this file to /etc/systemd/system/vncserver@.service -# 2. Edit /etc/systemd/system/vncserver@.service, replacing -# with the actual user name. Leave the remaining lines of the file unmodified -# (ExecStart=/usr/sbin/runuser -l -c "/usr/bin/vncserver %i" -# PIDFile=/home//.vnc/%H%i.pid) +# 2. Replace with the actual user name and edit vncserver +# parameters appropriately +# ("User=" and "/home//.vnc/%H%i.pid") # 3. Run `systemctl daemon-reload` # 4. Run `systemctl enable vncserver@:.service` # @@ -37,11 +36,13 @@ After=syslog.target network.target [Service] Type=forking +User= + # Clean any existing files in /tmp/.X11-unix environment -ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :' -ExecStart=/usr/sbin/runuser -l -c "/usr/bin/vncserver %i" +ExecStartPre=-/usr/bin/vncserver -kill %i +ExecStart=/usr/bin/vncserver %i PIDFile=/home//.vnc/%H%i.pid -ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :' +ExecStop=-/usr/bin/vncserver -kill %i [Install] WantedBy=multi-user.target diff --git a/SOURCES/vncviewer.desktop b/SOURCES/vncviewer.desktop deleted file mode 100644 index fab46f0..0000000 --- a/SOURCES/vncviewer.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Name=TigerVNC Viewer -Name[fr]=Visionneur TigerVNC -Comment=Connect to VNC server and display remote desktop -Comment[fr]=Se connecter à un serveur VNC et afficher le bureau distant -Exec=/usr/bin/vncviewer -Icon=tigervnc -Terminal=false -Type=Application -StartupWMClass=TigerVNC Viewer: Connection Details -Categories=Network;RemoteAccess; diff --git a/SOURCES/xvnc.service b/SOURCES/xvnc.service new file mode 100644 index 0000000..3471e1f --- /dev/null +++ b/SOURCES/xvnc.service @@ -0,0 +1,38 @@ +# The vncserver service unit file +# +# Quick HowTo: +# 1. Copy this file to /etc/systemd/system/xvnc@.service +# 2. Copy xvnc.socket to /etc/systemd/system/xvnc.socket +# 3. Run `systemctl daemon-reload` +# 4. Run `systemctl enable xvnc.socket` +# +# DO NOT RUN THIS SERVICE if your local area network is +# untrusted! For a secure way of using VNC, you should +# limit connections to the local host and then tunnel from +# the machine you want to view VNC on (host A) to the machine +# whose VNC output you want to view (host B) +# +# [user@hostA ~]$ ssh -v -C -L 590N:localhost:590M hostB +# +# this will open a connection on port 590N of your hostA to hostB's port 590M +# (in fact, it ssh-connects to hostB and then connects to localhost (on hostB). +# See the ssh man page for details on port forwarding) +# +# You can then point a VNC client on hostA at vncdisplay N of localhost and with +# the help of ssh, you end up seeing what hostB makes available on port 590M +# +# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP. +# +# Use "-localhost" to prevent remote VNC clients connecting except when +# doing so through a secure tunnel. See the "-via" option in the +# `man vncviewer' manual page. + + +[Unit] +Description=XVNC Per-Connection Daemon + +[Service] +ExecStart=-/usr/bin/Xvnc -inetd -query localhost -geometry 1024x768 -depth 24 -once -SecurityTypes=None +User=nobody +StandardInput=socket +StandardError=syslog diff --git a/SOURCES/xvnc.socket b/SOURCES/xvnc.socket new file mode 100644 index 0000000..9b3f92d --- /dev/null +++ b/SOURCES/xvnc.socket @@ -0,0 +1,9 @@ +[Unit] +Description=XVNC Server + +[Socket] +ListenStream=5900 +Accept=yes + +[Install] +WantedBy=sockets.target diff --git a/SPECS/tigervnc.spec b/SPECS/tigervnc.spec index de0ed46..7975342 100644 --- a/SPECS/tigervnc.spec +++ b/SPECS/tigervnc.spec @@ -1,6 +1,6 @@ Name: tigervnc -Version: 1.3.1 -Release: 9%{?dist} +Version: 1.8.0 +Release: 1%{?dist} Summary: A TigerVNC remote display system Group: User Interface/Desktops @@ -11,11 +11,12 @@ Source0: %{name}-%{version}.tar.gz Source1: vncserver.service Source2: vncserver.sysconfig Source3: 10-libvnc.conf -Source6: vncviewer.desktop +Source4: xvnc.service +Source5: xvnc.socket BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: libX11-devel, automake, autoconf, libtool, gettext, gettext-autopoint -BuildRequires: libXext-devel, xorg-x11-server-source, libXi-devel +BuildRequires: libXext-devel, xorg-x11-server-source, libXi-devel, libxshmfence-devel BuildRequires: xorg-x11-xtrans-devel, xorg-x11-util-macros, libXtst-devel BuildRequires: libdrm-devel, libXt-devel, pixman-devel libXfont-devel BuildRequires: libxkbfile-devel, openssl-devel, libpciaccess-devel @@ -25,6 +26,15 @@ BuildRequires: desktop-file-utils, java-devel, jpackage-utils BuildRequires: libjpeg-turbo-devel, gnutls-devel, pam-devel BuildRequires: systemd, cmake, fltk-devel +BuildRequires: libXfont2-devel + +# TigerVNC 1.4.x requires fltk 1.3.3 for keyboard handling support +# See https://github.com/TigerVNC/tigervnc/issues/8, also bug #1208814 +BuildRequires: fltk-devel >= 1.3.3 +%ifnarch s390 s390x +BuildRequires: xorg-x11-server-devel +%endif + Requires(post): coreutils Requires(postun): coreutils @@ -37,35 +47,17 @@ Obsoletes: vnc < 4.1.3-2, vnc-libs < 4.1.3-2 Provides: tightvnc = 1.5.0-0.15.20090204svn3586 Obsoletes: tightvnc < 1.5.0-0.15.20090204svn3586 -Patch4: tigervnc-cookie.patch -Patch10: tigervnc11-ldnow.patch -Patch11: tigervnc11-gethomedir.patch -Patch13: tigervnc11-rh692048.patch -Patch14: tigervnc-inetd-nowait.patch -Patch15: tigervnc-setcursor-crash.patch -Patch16: tigervnc-manpages.patch -Patch17: tigervnc-shebang.patch -Patch18: tigervnc-1.3.1-xserver-1.16.patch -Patch19: tigervnc-1.3.1-xserver-1.17.patch -Patch20: tigervnc-zrle-crash.patch -Patch21: tigervnc-cursor.patch -Patch22: tigervnc-xstartup.patch -Patch23: tigervnc-no-warning-with-wformat-security.patch -Patch24: tigervnc-check-return-value-from-xshmattach.patch -Patch25: tigervnc-pointersync.patch -Patch26: tigervnc-inputreset.patch -Patch27: tigervnc-ipv6-support.patch -Patch28: tigervnc-set-initial-mode-as-prefered.patch -Patch29: tigervnc-CVE-2014-8241.patch -Patch30: tigervnc-1.3.1-CVE-2014-8240.patch -Patch31: tigervnc-inetd-crash.patch -Patch32: tigervnc-1.3.1-repair-so-reuseaddr.patch -Patch33: tigervnc-1.3.1-do-not-die-when-port-is-already-taken.patch +Patch2: tigervnc-shebang.patch +Patch3: tigervnc-manpages.patch +Patch4: tigervnc-cursor.patch +Patch6: tigervnc-xstartup.patch +Patch7: tigervnc-1.3.1-CVE-2014-8240.patch +Patch8: tigervnc-1.3.1-do-not-die-when-port-is-already-taken.patch # This is tigervnc-%{version}/unix/xserver116.patch rebased on the latest xorg -Patch100: tigervnc-xserver117.patch +Patch100: tigervnc-xserver119.patch # 1326867 - [RHEL7.3] GLX applications in an Xvnc session fails to start -Patch101: 0001-rpath-hack.patch +Patch101: 0001-rpath-hack.patch %description Virtual Network Computing (VNC) is a remote display system which @@ -160,78 +152,32 @@ This package contains icons for TigerVNC viewer %prep %setup -q -n %{name}-%{version} -%patch4 -p1 -b .cookie -%patch10 -p1 -b .ldnow -%patch11 -p1 -b .gethomedir -%patch13 -p1 -b .rh692048 - cp -r /usr/share/xorg-x11-server-source/* unix/xserver pushd unix/xserver for all in `find . -type f -perm -001`; do chmod -x "$all" done -%patch100 -p1 -b .xserver117 +%patch100 -p1 -b .xserver119 %patch101 -p1 -b .rpath popd -# Applied Debian patch to fix busy loop when run from inetd in nowait -# mode (bug #920373). -%patch14 -p1 -b .inetd-nowait - -%patch15 -p1 -b .setcursor-crash - -# Synchronise manpages and --help output (bug #980870). -%patch16 -p1 -b .manpages - # Don't use shebang in vncserver script. -%patch17 -p1 -b .shebang - -# source compatibility with xserver 1.16 and 1.17 -%patch18 -p1 -b .xserver-1.16 -%patch19 -p1 -b .xserver-1.17 +%patch2 -p1 -b .shebang -# Avoid invalid read when ZRLE connection closed (upstream bug #133). -%patch20 -p1 -b .zrle-crash +%patch3 -p1 -b .manpages # Fixed viewer crash when cursor has not been set (bug #1051333). -%patch21 -p1 -b .cursor +%patch4 -p1 -b .cursor # Clearer xstartup file (bug #923655). -%patch22 -p1 -b .xstartup - -# No warning when compiling with gcc's -Wformat-security option -%patch23 -p1 -b .no-warning-with-wformat-security - -# Check the return value from XShmAttach -%patch24 -p1 -b .check-return-value-from-xshmattach - -# Keep pointer in sync -%patch25 -p1 -b .pointersync - -# Input reset fixes from upstream -%patch26 -p1 -b .inputreset - -# Add IPv6 support -%patch27 -p1 -b .ipv6-support - -# Set initial mode as prefered -%patch28 -p1 -b .set-initial-mode-as-prefered - -# CVE-2014-8241 tigervnc: NULL pointer dereference flaw in XRegion -%patch29 -p1 -b .tigervnc-CVE-2014-8241 +%patch6 -p1 -b .xstartup # CVE-2014-8240 tigervnc: integer overflow flaw, leading to a heap-based # buffer overflow in screen size handling -%patch30 -p1 -b .tigervnc-1.3.1-CVE-2014-8240 - -# Bug 1283925 - segfault in network::TcpListener::TcpListener -%patch31 -p1 -b .tigervnc-inetd-crash - -# Bug 1332575 - vncExtInit: failed to bind socket: Address already in use (98) -%patch32 -p1 -b .repair-so-reuseaddr +%patch7 -p1 -b .tigervnc-1.3.1-CVE-2014-8240 # Bug 1322155 - Xorg socket conflict for VNC port 5901 -%patch33 -p1 -b .do-not-die-when-port-is-already-taken +%patch8 -p1 -b .do-not-die-when-port-is-already-taken %build %ifarch sparcv9 sparc64 s390 s390x @@ -254,17 +200,13 @@ autoreconf -fiv --with-fontdir=%{_datadir}/X11/fonts \ --with-xkb-output=%{_localstatedir}/lib/xkb \ --enable-install-libxf86config \ - --enable-glx --disable-dri --enable-dri2 \ - --disable-wayland \ - --disable-present \ - --disable-config-dbus \ + --enable-glx --disable-dri --enable-dri2 --enable-dri3 \ + --disable-unit-tests \ --disable-config-hal \ --disable-config-udev \ --with-dri-driver-path=%{_libdir}/dri \ --without-dtrace \ - --disable-unit-tests \ --disable-devel-docs \ - --disable-selective-werror \ --enable-listen-tcp make %{?_smp_mflags} @@ -278,12 +220,12 @@ popd # Build Java applet pushd java %{cmake} . -make +JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8" make popd %install -rm -rf $RPM_BUILD_ROOT -make install DESTDIR=$RPM_BUILD_ROOT +%make_install +rm -f $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/{README.txt,LICENCE.TXT} pushd unix/xserver/hw/vnc make install DESTDIR=$RPM_BUILD_ROOT @@ -292,6 +234,8 @@ popd # Install systemd unit file mkdir -p %{buildroot}%{_unitdir} install -m644 %{SOURCE1} %{buildroot}%{_unitdir}/vncserver@.service +install -m644 %{SOURCE4} %{buildroot}%{_unitdir}/xvnc@.service +install -m644 %{SOURCE5} %{buildroot}%{_unitdir}/xvnc.socket rm -rf %{buildroot}%{_initrddir} mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig @@ -306,11 +250,6 @@ install -m644 tigervnc_$s.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/${s}x$s/a done popd -mkdir $RPM_BUILD_ROOT%{_datadir}/applications -desktop-file-install \ - --dir $RPM_BUILD_ROOT%{_datadir}/applications \ - %{SOURCE6} - # Install Java applet pushd java mkdir -p $RPM_BUILD_ROOT%{_datadir}/vnc/classes @@ -347,6 +286,8 @@ fi %post server %systemd_post vncserver.service +%systemd_post xvnc.service +%systemd_post xvnc.socket %triggerun -- tigervnc-server < 1.0.90-6 %{_bindir}/systemd-sysv-convert --save vncserver >/dev/null 2>&1 ||: @@ -354,28 +295,29 @@ fi %preun server %systemd_preun vncserver.service +%systemd_preun xvnc.service +%systemd_preun xvnc.socket %postun server %systemd_postun %files -f %{name}.lang -%defattr(-,root,root,-) -%doc %{_docdir}/%{name}-%{version}/README.txt +%doc README.txt %{_bindir}/vncviewer %{_datadir}/applications/* %{_mandir}/man1/vncviewer.1* %files server -%defattr(-,root,root,-) %config(noreplace) %{_sysconfdir}/sysconfig/vncservers %{_unitdir}/vncserver@.service +%{_unitdir}/xvnc@.service +%{_unitdir}/xvnc.socket %{_bindir}/x0vncserver %{_bindir}/vncserver %{_mandir}/man1/vncserver.1* %{_mandir}/man1/x0vncserver.1* %files server-minimal -%defattr(-,root,root,-) %{_bindir}/vncconfig %{_bindir}/vncpasswd %{_bindir}/Xvnc @@ -385,24 +327,61 @@ fi %ifnarch s390 s390x %files server-module -%defattr(-,root,root,-) %{_libdir}/xorg/modules/extensions/libvnc.so %config %{_sysconfdir}/X11/xorg.conf.d/10-libvnc.conf %endif %files server-applet -%defattr(-,root,root,-) %doc java/com/tigervnc/vncviewer/README %{_datadir}/vnc/classes/* %files license -%doc %{_docdir}/%{name}-%{version}/LICENCE.TXT +%license LICENCE.TXT %files icons -%defattr(-,root,root,-) %{_datadir}/icons/hicolor/*/apps/* %changelog +* Wed May 17 2017 Jan Grulich - 1.8.0-1 +- Update to 1.8.0 + Resolves: bz#1388620 + +* Tue May 02 2017 Jan Grulich - 1.7.90-2 +- Make RandR callbacks optional + Resolves: bz#1444948 + +* Thu Apr 20 2017 Jan Grulich - 1.7.90-1 +- Update to 1.7.90 + Resolves: bz#1388620 + +* Wed Apr 05 2017 Jan Grulich - 1.7.1-3 +- Delete underlying ssecurity in SSecurityVeNCrypt [CCVE-2017-7392] + Resolves: bz#1439127 + Prevent double free by crafted fences [CVE-2017-7393] + Resolves: bz#1439134 + +* Wed Apr 05 2017 Jan Grulich - 1.7.1-2 +- Be more restrictive with shared memory mode bits + Resolves: bz#1152552 + Limit max username/password size in SSecurityPlain [CVE-2017-7394] + Resolves: bz#1438737 + Fix crash from integer overflow in SMsgReader::readClientCutText [CVE-2017-7395] + Resolves: bz#1438742 + +* Tue Feb 21 2017 Jan Grulich - 1.7.1-1 +- Update to 1.7.1 + Resolves: bz#1388620 + Resolves: bz#1343899 + Resolves: bz#1410164 + Resolves: bz#1415547 + Resolves: bz#1418945 + Resolves: bz#1416290 + Resolves: bz#1342956 +- Fix shared memory leakage + Resolves: bz#1358090 +- Added systemd unit file for xvnc + Resolves: bz#1393971 + * Tue Sep 13 2016 Adam Jackson - 1.3.1-9 - Force DT_RUNPATH to point to Mesa's libGL Resolves: bz#1326867