summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Harrison <colin.harrison@virgin.net>2009-11-06 17:46:58 +0000
committerJon TURNEY <jon.turney@dronecode.org.uk>2009-11-09 20:33:42 +0000
commit72f81f4e449defb0654e9bdb2c9ec014475a3977 (patch)
treed9b393603e77cf1878a2f434d2bbac3fd9939ac7
parent6dbf8f27c885ea3a761548183fb00ba3df2df553 (diff)
Xming: Make -auth option work in with -multiwindow
Use an internally generated cookie for authentication of the internal window manager client when using the -auth option in -multiwindow mode. Copyright (C) Colin Harrison 2005-2008 http://www.straightrunning.com/XmingNotes/ http://sourceforge.net/projects/xming/ Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
-rw-r--r--hw/xwin/InitOutput.c4
-rw-r--r--hw/xwin/winglobals.c3
-rw-r--r--hw/xwin/winmultiwindowwm.c13
-rwxr-xr-xhw/xwin/winprocarg.c11
4 files changed, 30 insertions, 1 deletions
diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index 9aff336e1..45dccce18 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -1,6 +1,7 @@
/*
Copyright 1993, 1998 The Open Group
+Copyright (C) Colin Harrison 2005-2008
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
@@ -73,6 +74,7 @@ extern int g_iLogVerbose;
Bool g_fLogInited;
extern Bool g_fXdmcpEnabled;
+extern Bool g_fAuthEnabled;
#ifdef HAS_DEVWINDOWS
extern int g_fdMessageQueue;
#endif
@@ -1022,7 +1024,7 @@ InitOutput (ScreenInfo *screenInfo, int argc, char *argv[])
#if defined(XCSECURITY)
/* Generate a cookie used by internal clients for authorization */
- if (g_fXdmcpEnabled)
+ if (g_fXdmcpEnabled || g_fAuthEnabled)
winGenerateAuthorization ();
#endif
diff --git a/hw/xwin/winglobals.c b/hw/xwin/winglobals.c
index 3eb6091e6..57b3bf3b8 100644
--- a/hw/xwin/winglobals.c
+++ b/hw/xwin/winglobals.c
@@ -1,5 +1,6 @@
/*
*Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
+ *Copyright (C) Colin Harrison 2005-2008
*
*Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -26,6 +27,7 @@
*from Harold L Hunt II.
*
* Authors: Harold L Hunt II
+ * Colin Harrison
*/
#ifdef HAVE_XWIN_CONFIG_H
@@ -63,6 +65,7 @@ HWND g_hDlgExit = NULL;
HWND g_hDlgAbout = NULL;
const char * g_pszQueryHost = NULL;
Bool g_fXdmcpEnabled = FALSE;
+Bool g_fAuthEnabled = FALSE;
HICON g_hIconX = NULL;
HICON g_hSmallIconX = NULL;
#ifndef RELOCATE_PROJECTROOT
diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index 8fb80f45a..7cdac0c10 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -90,6 +90,7 @@ extern void winUpdateRgnMultiWindow(WindowPtr pWin);
#endif
#define WIN_JMP_OKAY 0
#define WIN_JMP_ERROR_IO 2
+#define AUTH_NAME "MIT-MAGIC-COOKIE-1"
/*
@@ -139,6 +140,10 @@ typedef struct _XMsgProcArgRec {
extern char *display;
extern void ErrorF (const char* /*f*/, ...);
+#if defined(XCSECURITY)
+extern unsigned int g_uiAuthDataLen;
+extern char *g_pAuthData;
+#endif
/*
@@ -1317,6 +1322,14 @@ winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
/* Print the display connection string */
ErrorF ("winInitMultiWindowWM - DISPLAY=%s\n", pszDisplay);
+
+#if defined(XCSECURITY)
+ /* Use our generated cookie for authentication */
+ XSetAuthorization (AUTH_NAME,
+ strlen (AUTH_NAME),
+ g_pAuthData,
+ g_uiAuthDataLen);
+#endif
/* Open the X display */
do
diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c
index 56af643db..3732ecb63 100755
--- a/hw/xwin/winprocarg.c
+++ b/hw/xwin/winprocarg.c
@@ -1,6 +1,7 @@
/*
Copyright 1993, 1998 The Open Group
+Copyright (C) Colin Harrison 2005-2008
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
@@ -57,6 +58,7 @@ extern char * g_pszLogFile;
extern Bool g_fLogFileChanged;
#endif
extern Bool g_fXdmcpEnabled;
+extern Bool g_fAuthEnabled;
extern char * g_pszCommandLine;
extern Bool g_fKeyboardHookLL;
extern Bool g_fNoHelpMessageBox;
@@ -1289,6 +1291,15 @@ ddxProcessArgument (int argc, char *argv[], int i)
}
/*
+ * Look for the '-auth' argument
+ */
+ if (IS_OPTION ("-auth"))
+ {
+ g_fAuthEnabled = TRUE;
+ return 0; /* Let DIX parse this again */
+ }
+
+ /*
* Look for the '-indirect' or '-broadcast' arguments
*/
if (IS_OPTION ("-indirect")