Module Name: xsrc
Committed By: mrg
Date: Wed Mar 8 07:39:44 UTC 2017
Modified Files:
xsrc/external/mit/xorg-server/dist: configure.ac
xsrc/external/mit/xorg-server/dist/include: dix-config.h.in
xsrc/external/mit/xorg-server/dist/os: auth.c
xsrc/external/mit/xorg-server/include: dix-config.h
Log Message:
apply
https://cgit.freedesktop.org/xorg/xserver/commit/?id=957e8db38f27932d353e86e9aa69cf16778b18f1
--
Use arc4random_buf(3) if available to generate cookies.
Reviewed-by: Adam Jackson <[email protected]>
Signed-off-by: Matthieu Herrb <[email protected]>
--
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 xsrc/external/mit/xorg-server/dist/configure.ac
cvs rdiff -u -r1.2 -r1.3 \
xsrc/external/mit/xorg-server/dist/include/dix-config.h.in
cvs rdiff -u -r1.2 -r1.3 xsrc/external/mit/xorg-server/dist/os/auth.c
cvs rdiff -u -r1.26 -r1.27 xsrc/external/mit/xorg-server/include/dix-config.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: xsrc/external/mit/xorg-server/dist/configure.ac
diff -u xsrc/external/mit/xorg-server/dist/configure.ac:1.4 xsrc/external/mit/xorg-server/dist/configure.ac:1.5
--- xsrc/external/mit/xorg-server/dist/configure.ac:1.4 Wed Mar 8 07:14:11 2017
+++ xsrc/external/mit/xorg-server/dist/configure.ac Wed Mar 8 07:39:44 2017
@@ -223,6 +223,8 @@ AC_CHECK_FUNCS([backtrace ffs geteuid ge
AC_REPLACE_FUNCS([reallocarray strcasecmp strcasestr strlcat strlcpy strndup\
timingsafe_memcmp])
+AC_CHECK_LIB([bsd], [arc4random_buf])
+
AC_CHECK_DECLS([program_invocation_short_name], [], [], [[#include <errno.h>]])
dnl Check for SO_PEERCRED #define
Index: xsrc/external/mit/xorg-server/dist/include/dix-config.h.in
diff -u xsrc/external/mit/xorg-server/dist/include/dix-config.h.in:1.2 xsrc/external/mit/xorg-server/dist/include/dix-config.h.in:1.3
--- xsrc/external/mit/xorg-server/dist/include/dix-config.h.in:1.2 Wed Mar 8 07:14:11 2017
+++ xsrc/external/mit/xorg-server/dist/include/dix-config.h.in Wed Mar 8 07:39:44 2017
@@ -125,6 +125,9 @@
/* Build a standalone xpbproxy */
#undef STANDALONE_XPBPROXY
+/* Define to 1 if you have the `bsd' library (-lbsd). */
+#undef HAVE_LIBBSD
+
/* Define to 1 if you have the `m' library (-lm). */
#undef HAVE_LIBM
@@ -155,6 +158,9 @@
/* Define to 1 if you have the <rpcsvc/dbm.h> header file. */
#undef HAVE_RPCSVC_DBM_H
+/* Define to 1 if you have the `arc4random_buf' function. */
+#undef HAVE_ARC4RANDOM_BUF
+
/* Define to use libc SHA1 functions */
#undef HAVE_SHA1_IN_LIBC
Index: xsrc/external/mit/xorg-server/dist/os/auth.c
diff -u xsrc/external/mit/xorg-server/dist/os/auth.c:1.2 xsrc/external/mit/xorg-server/dist/os/auth.c:1.3
--- xsrc/external/mit/xorg-server/dist/os/auth.c:1.2 Wed Mar 8 06:54:39 2017
+++ xsrc/external/mit/xorg-server/dist/os/auth.c Wed Mar 8 07:39:44 2017
@@ -45,6 +45,9 @@ from The Open Group.
#ifdef WIN32
#include <X11/Xw32defs.h>
#endif
+#ifdef HAVE_LIBBSD
+#include <bsd/stdlib.h> /* for arc4random_buf() */
+#endif
struct protocol {
unsigned short name_length;
@@ -302,11 +305,15 @@ GenerateAuthorization(unsigned name_leng
void
GenerateRandomData(int len, char *buf)
{
+#ifdef HAVE_ARC4RANDOMBUF
+ arc4random_buf(buf, len);
+#else
int fd;
fd = open("/dev/urandom", O_RDONLY);
read(fd, buf, len);
close(fd);
+#endif
}
#endif /* XCSECURITY */
Index: xsrc/external/mit/xorg-server/include/dix-config.h
diff -u xsrc/external/mit/xorg-server/include/dix-config.h:1.26 xsrc/external/mit/xorg-server/include/dix-config.h:1.27
--- xsrc/external/mit/xorg-server/include/dix-config.h:1.26 Wed Mar 8 07:14:11 2017
+++ xsrc/external/mit/xorg-server/include/dix-config.h Wed Mar 8 07:39:44 2017
@@ -128,6 +128,9 @@
/* Build a standalone xpbproxy */
/* #undef STANDALONE_XPBPROXY */
+/* Define to 1 if you have the `bsd' library (-lbsd). */
+/* #undef HAVE_LIBBSD */
+
/* Define to 1 if you have the `m' library (-lm). */
#define HAVE_LIBM 1
@@ -158,6 +161,9 @@
/* Define to 1 if you have the <rpcsvc/dbm.h> header file. */
/* #undef HAVE_RPCSVC_DBM_H */
+/* Define to 1 if you have the `arc4random_buf' function. */
+#define HAVE_ARC4RANDOM_BUF 1
+
/* Define to use libc SHA1 functions */
#define HAVE_SHA1_IN_LIBC 1