From 4055fed1e7933c05afe143cbd18743c1ff1c7fee Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Sun, 1 Jul 2018 15:53:42 +0100 Subject: [PATCH] hw/xwin: Remove XSetAuthorization() for helper clients All helper client code now uses xcb, so calling XSetAuthorization() is no longer needed. This is the last reference to libX11 from helper clients, so linking with x11-xcb and libX11 is no longer required. Also drop (unneeded?) linking with libXau. Also drop installing these prerequistes on AppvVeyor. Also move prototypes for functions in winauth.c from win.h into a new header, winauth.h, and include that where needed. --- .appveyor.yml | 2 -- configure.ac | 2 +- hw/xwin/InitOutput.c | 1 + hw/xwin/meson.build | 1 - hw/xwin/win.h | 8 -------- hw/xwin/winauth.c | 27 ++++++--------------------- hw/xwin/winauth.h | 26 ++++++++++++++++++++++++++ hw/xwin/winclipboardinit.c | 6 +----- hw/xwin/winmultiwindowwm.c | 2 +- 9 files changed, 36 insertions(+), 39 deletions(-) create mode 100644 hw/xwin/winauth.h diff --git a/.appveyor.yml b/.appveyor.yml index b86e33ed4..b243ff43b 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -37,9 +37,7 @@ libGL-devel,\ libnettle-devel,\ libpixman1-devel,\ libtirpc-devel,\ -libX11-devel,\ libXRes-devel,\ -libXau-devel,\ libXaw-devel,\ libXdmcp-devel,\ libXext-devel,\ diff --git a/configure.ac b/configure.ac index add563c8b..af5df61dc 100644 --- a/configure.ac +++ b/configure.ac @@ -2081,7 +2081,7 @@ if test "x$XWIN" = xyes; then AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support]) AC_CHECK_TOOL(WINDRES, windres) - PKG_CHECK_MODULES([XWINMODULES],[x11 xau xdmcp x11-xcb xcb-aux xcb-composite xcb-image xcb-ewmh xcb-icccm xcb-xfixes]) + PKG_CHECK_MODULES([XWINMODULES],[xcb-aux xcb-composite xcb-image xcb-ewmh xcb-icccm xcb-xfixes]) if test "x$WINDOWSDRI" = xauto; then PKG_CHECK_EXISTS([windowsdriproto], [WINDOWSDRI=yes], [WINDOWSDRI=no]) diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index 872a1fdcd..d04b47cdc 100644 --- a/hw/xwin/InitOutput.c +++ b/hw/xwin/InitOutput.c @@ -66,6 +66,7 @@ typedef WINAPI HRESULT(*SHGETFOLDERPATHPROC) (HWND hwndOwner, #include "glx/glwindows.h" #include "dri/windowsdri.h" #endif +#include "winauth.h" /* * References to external symbols diff --git a/hw/xwin/meson.build b/hw/xwin/meson.build index c1a2917b8..62d9ba782 100644 --- a/hw/xwin/meson.build +++ b/hw/xwin/meson.build @@ -132,7 +132,6 @@ srcs_windows += pfiles xwin_dep = [ common_dep, - dependency('x11-xcb'), dependency('xcb-aux'), dependency('xcb-image'), dependency('xcb-ewmh'), diff --git a/hw/xwin/win.h b/hw/xwin/win.h index 6f3437284..50554e7dd 100644 --- a/hw/xwin/win.h +++ b/hw/xwin/win.h @@ -669,14 +669,6 @@ Bool Bool winAllocateCmapPrivates(ColormapPtr pCmap); -/* - * winauth.c - */ - -Bool - winGenerateAuthorization(void); -void winSetAuthorization(void); - /* * winblock.c */ diff --git a/hw/xwin/winauth.c b/hw/xwin/winauth.c index 14278390f..8d3bcb447 100644 --- a/hw/xwin/winauth.c +++ b/hw/xwin/winauth.c @@ -32,7 +32,8 @@ #include #endif -#include "win.h" +#include "winauth.h" +#include "winmsg.h" /* Includes for authorization */ #include "securitysrv.h" @@ -40,14 +41,6 @@ #include -/* Need to get this from Xlib.h */ -extern void XSetAuthorization( - const char * /* name */, - int /* namelen */, - const char * /* data */, - int /* datalen */ -); - /* * Constants */ @@ -68,9 +61,7 @@ static xcb_auth_info_t auth_info; */ #ifndef XCSECURITY - -static - XID +static XID GenerateAuthorization(unsigned name_length, const char *name, unsigned data_length, @@ -89,7 +80,9 @@ GenerateAuthorization(unsigned name_length, Bool winGenerateAuthorization(void) { +#ifdef XCSECURITY SecurityAuthorizationPtr pAuth = NULL; +#endif /* Call OS layer to generate authorization key */ g_authId = GenerateAuthorization(strlen(AUTH_NAME), @@ -106,7 +99,7 @@ winGenerateAuthorization(void) g_uiAuthDataLen, g_pAuthData); } - auth_info.name = AUTH_NAME; + auth_info.name = strdup(AUTH_NAME); auth_info.namelen = strlen(AUTH_NAME); auth_info.data = g_pAuthData; auth_info.datalen = g_uiAuthDataLen; @@ -141,14 +134,6 @@ winGenerateAuthorization(void) return TRUE; } -/* Use our generated cookie for authentication */ -void -winSetAuthorization(void) -{ - XSetAuthorization(AUTH_NAME, - strlen(AUTH_NAME), g_pAuthData, g_uiAuthDataLen); -} - xcb_auth_info_t * winGetXcbAuthInfo(void) { diff --git a/hw/xwin/winauth.h b/hw/xwin/winauth.h new file mode 100644 index 000000000..68d3ac0cb --- /dev/null +++ b/hw/xwin/winauth.h @@ -0,0 +1,26 @@ +/* + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include // for Bool + +Bool winGenerateAuthorization(void); +xcb_auth_info_t * winGetXcbAuthInfo(void); diff --git a/hw/xwin/winclipboardinit.c b/hw/xwin/winclipboardinit.c index 1e920f51f..814899f8e 100644 --- a/hw/xwin/winclipboardinit.c +++ b/hw/xwin/winclipboardinit.c @@ -38,12 +38,11 @@ #include "win.h" #include "winclipboard/winclipboard.h" #include "windisplay.h" +#include "winauth.h" #define WIN_CLIPBOARD_RETRIES 40 #define WIN_CLIPBOARD_DELAY 1 -extern xcb_auth_info_t *winGetXcbAuthInfo(void); - /* * Local variables */ @@ -66,9 +65,6 @@ winClipboardThreadProc(void *arg) ++clipboardRestarts; - /* Use our generated cookie for authentication */ - winSetAuthorization(); - /* Setup the display connection string */ /* * NOTE: Always connect to screen 0 since we require that screen diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c index fa339a9fb..9801b14c9 100644 --- a/hw/xwin/winmultiwindowwm.c +++ b/hw/xwin/winmultiwindowwm.c @@ -63,6 +63,7 @@ #include "winglobals.h" #include "windisplay.h" #include "winmultiwindowicons.h" +#include "winauth.h" /* We need the native HWND atom for intWM, so for consistency use the same name as extWM does */ @@ -75,7 +76,6 @@ extern void winDebug(const char *format, ...); extern void winReshapeMultiWindow(WindowPtr pWin); extern void winUpdateRgnMultiWindow(WindowPtr pWin); -extern xcb_auth_info_t *winGetXcbAuthInfo(void); #ifndef CYGDEBUG #define CYGDEBUG NO