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>
This commit is contained in:
Colin Harrison 2009-11-06 17:46:58 +00:00 committed by Jon TURNEY
parent 6dbf8f27c8
commit 72f81f4e44
4 changed files with 30 additions and 1 deletions

View File

@ -1,6 +1,7 @@
/* /*
Copyright 1993, 1998 The Open Group Copyright 1993, 1998 The Open Group
Copyright (C) Colin Harrison 2005-2008
Permission to use, copy, modify, distribute, and sell this software and its Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that documentation for any purpose is hereby granted without fee, provided that
@ -73,6 +74,7 @@ extern int g_iLogVerbose;
Bool g_fLogInited; Bool g_fLogInited;
extern Bool g_fXdmcpEnabled; extern Bool g_fXdmcpEnabled;
extern Bool g_fAuthEnabled;
#ifdef HAS_DEVWINDOWS #ifdef HAS_DEVWINDOWS
extern int g_fdMessageQueue; extern int g_fdMessageQueue;
#endif #endif
@ -1022,7 +1024,7 @@ InitOutput (ScreenInfo *screenInfo, int argc, char *argv[])
#if defined(XCSECURITY) #if defined(XCSECURITY)
/* Generate a cookie used by internal clients for authorization */ /* Generate a cookie used by internal clients for authorization */
if (g_fXdmcpEnabled) if (g_fXdmcpEnabled || g_fAuthEnabled)
winGenerateAuthorization (); winGenerateAuthorization ();
#endif #endif

View File

@ -1,5 +1,6 @@
/* /*
*Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved. *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 *Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the * a copy of this software and associated documentation files (the
@ -26,6 +27,7 @@
*from Harold L Hunt II. *from Harold L Hunt II.
* *
* Authors: Harold L Hunt II * Authors: Harold L Hunt II
* Colin Harrison
*/ */
#ifdef HAVE_XWIN_CONFIG_H #ifdef HAVE_XWIN_CONFIG_H
@ -63,6 +65,7 @@ HWND g_hDlgExit = NULL;
HWND g_hDlgAbout = NULL; HWND g_hDlgAbout = NULL;
const char * g_pszQueryHost = NULL; const char * g_pszQueryHost = NULL;
Bool g_fXdmcpEnabled = FALSE; Bool g_fXdmcpEnabled = FALSE;
Bool g_fAuthEnabled = FALSE;
HICON g_hIconX = NULL; HICON g_hIconX = NULL;
HICON g_hSmallIconX = NULL; HICON g_hSmallIconX = NULL;
#ifndef RELOCATE_PROJECTROOT #ifndef RELOCATE_PROJECTROOT

View File

@ -90,6 +90,7 @@ extern void winUpdateRgnMultiWindow(WindowPtr pWin);
#endif #endif
#define WIN_JMP_OKAY 0 #define WIN_JMP_OKAY 0
#define WIN_JMP_ERROR_IO 2 #define WIN_JMP_ERROR_IO 2
#define AUTH_NAME "MIT-MAGIC-COOKIE-1"
/* /*
@ -139,6 +140,10 @@ typedef struct _XMsgProcArgRec {
extern char *display; extern char *display;
extern void ErrorF (const char* /*f*/, ...); 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 */ /* Print the display connection string */
ErrorF ("winInitMultiWindowWM - DISPLAY=%s\n", pszDisplay); 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 */ /* Open the X display */
do do

View File

@ -1,6 +1,7 @@
/* /*
Copyright 1993, 1998 The Open Group Copyright 1993, 1998 The Open Group
Copyright (C) Colin Harrison 2005-2008
Permission to use, copy, modify, distribute, and sell this software and its Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that documentation for any purpose is hereby granted without fee, provided that
@ -57,6 +58,7 @@ extern char * g_pszLogFile;
extern Bool g_fLogFileChanged; extern Bool g_fLogFileChanged;
#endif #endif
extern Bool g_fXdmcpEnabled; extern Bool g_fXdmcpEnabled;
extern Bool g_fAuthEnabled;
extern char * g_pszCommandLine; extern char * g_pszCommandLine;
extern Bool g_fKeyboardHookLL; extern Bool g_fKeyboardHookLL;
extern Bool g_fNoHelpMessageBox; extern Bool g_fNoHelpMessageBox;
@ -1288,6 +1290,15 @@ ddxProcessArgument (int argc, char *argv[], int i)
return 0; /* Let DIX parse this again */ return 0; /* Let DIX parse this again */
} }
/*
* 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 * Look for the '-indirect' or '-broadcast' arguments
*/ */