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 (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

View File

@ -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

View File

@ -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
/*
@ -1318,6 +1323,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
{

View File

@ -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;
@ -1288,6 +1290,15 @@ ddxProcessArgument (int argc, char *argv[], int i)
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
*/