aboutsummaryrefslogtreecommitdiff
path: root/libXdmcp
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-08-19 09:07:37 +0200
committermarha <marha@users.sourceforge.net>2013-08-19 09:07:37 +0200
commit2d042f719910c5aa1ba9f4a47b21009c729c345e (patch)
tree2b20d89d5f1ca342ca6f1d817c18b324adf7086f /libXdmcp
parentc3d3ea464f7f4e53e8fe3e11ecada36cb209ba4d (diff)
parent854ec4da20ddff9b830be0a7d5b81d8cb4774132 (diff)
downloadvcxsrv-2d042f719910c5aa1ba9f4a47b21009c729c345e.tar.gz
vcxsrv-2d042f719910c5aa1ba9f4a47b21009c729c345e.tar.bz2
vcxsrv-2d042f719910c5aa1ba9f4a47b21009c729c345e.zip
Merge remote-tracking branch 'origin/released'
* origin/released: fontconfig libX11 libXdmcp libxcb xkeyboard-config mesa pixman xserver git update 19 aug 2013 Conflicts: fontconfig/src/fccache.c
Diffstat (limited to 'libXdmcp')
-rw-r--r--libXdmcp/Key.c10
-rw-r--r--libXdmcp/configure.ac3
2 files changed, 12 insertions, 1 deletions
diff --git a/libXdmcp/Key.c b/libXdmcp/Key.c
index 995ec2ae6..bdefe2b71 100644
--- a/libXdmcp/Key.c
+++ b/libXdmcp/Key.c
@@ -32,6 +32,11 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xmd.h>
#include <X11/Xdmcp.h>
+#ifdef HAVE_LIBBSD
+#include <bsd/stdlib.h> /* for arc4random_buf() */
+#endif
+
+#ifndef HAVE_ARC4RANDOM_BUF
static void
getbits (long data, unsigned char *dst)
{
@@ -40,6 +45,7 @@ getbits (long data, unsigned char *dst)
dst[2] = (data >> 16) & 0xff;
dst[3] = (data >> 24) & 0xff;
}
+#endif
#define Time_t time_t
@@ -53,6 +59,7 @@ getbits (long data, unsigned char *dst)
void
XdmcpGenerateKey (XdmAuthKeyPtr key)
{
+#ifndef HAVE_ARC4RANDOM_BUF
long lowbits, highbits;
srandom ((int)getpid() ^ time((Time_t *)0));
@@ -60,6 +67,9 @@ XdmcpGenerateKey (XdmAuthKeyPtr key)
highbits = random ();
getbits (lowbits, key->data);
getbits (highbits, key->data + 4);
+#else
+ arc4random_buf(key->data, 8);
+#endif
}
int
diff --git a/libXdmcp/configure.ac b/libXdmcp/configure.ac
index 08c046ae0..d8ddfae93 100644
--- a/libXdmcp/configure.ac
+++ b/libXdmcp/configure.ac
@@ -53,7 +53,8 @@ AC_PROG_LN_S
AC_SEARCH_LIBS([recvfrom],[socket])
# Checks for library functions.
-AC_CHECK_FUNCS([srand48 lrand48])
+AC_CHECK_LIB([bsd], [arc4random_buf])
+AC_CHECK_FUNCS([srand48 lrand48 arc4random_buf])
# Obtain compiler/linker options for depedencies
PKG_CHECK_MODULES(XDMCP, xproto)