aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xwin/winauth.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xwin/winauth.c')
-rw-r--r--xorg-server/hw/xwin/winauth.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/xorg-server/hw/xwin/winauth.c b/xorg-server/hw/xwin/winauth.c
index 7d4372549..10bce693b 100644
--- a/xorg-server/hw/xwin/winauth.c
+++ b/xorg-server/hw/xwin/winauth.c
@@ -37,7 +37,6 @@
/* Includes for authorization */
#include "securitysrv.h"
-
/*
* Constants
*/
@@ -57,16 +56,29 @@ static char *g_pAuthData = NULL;
* Code to generate a MIT-MAGIC-COOKIE-1, copied from under XCSECURITY
*/
+
+
#ifndef XCSECURITY
static
void
GenerateRandomData (int len, char *buf)
{
int fd;
+#ifdef _MSC_VER
+ static HANDLE hAdvApi32;
+ static BOOLEAN (_stdcall * RtlGenRandom)(void *,unsigned long);
+ if (!hAdvApi32)
+ {
+ hAdvApi32=LoadLibrary("advapi32.dll");
+ RtlGenRandom=(BOOLEAN (_stdcall *)(void*,unsigned long))GetProcAddress(hAdvApi32,"SystemFunction036");
+ }
+ RtlGenRandom(buf, len);
+#else
fd = open("/dev/urandom", O_RDONLY);
read(fd, buf, len);
close(fd);
+#endif
}
@@ -139,13 +151,14 @@ winGenerateAuthorization (void)
ErrorF ("winGenerateAuthorization - GenerateAuthorization failed\n");
goto auth_bailout;
}
-
+#ifdef WINDBG
else
{
winDebug("winGenerateAuthorization - GenerateAuthorization success!\n"
"AuthDataLen: %d AuthData: %s\n",
g_uiAuthDataLen, g_pAuthData);
}
+#endif
#ifdef XCSECURITY
/* Allocate structure for additional auth information */