port to xorg-server 1.10: apply https://cgit.freedesktop.org/xorg/xserver/commit/?id=957e8db38f27932d353e86e9aa69cf16778b18f1 -- Use arc4random_buf(3) if available to generate cookies. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Matthieu Herrb <matthieu@herrb.eu> --diff -r1.1.1.1 -r1.2 xsrc/external/mit/xorg-server.old/dist/configure.ac
(mrg)
--- xsrc/external/mit/xorg-server.old/dist/configure.ac 2016/06/09 09:07:55 1.1.1.1
+++ xsrc/external/mit/xorg-server.old/dist/configure.ac 2017/03/08 07:44:16 1.2
@@ -210,26 +210,28 @@ AC_CHECK_FUNC([getdtablesize], | @@ -210,26 +210,28 @@ AC_CHECK_FUNC([getdtablesize], | |||
210 | AC_DEFINE(HAS_GETDTABLESIZE, 1, [Have the 'getdtablesize' function.])) | 210 | AC_DEFINE(HAS_GETDTABLESIZE, 1, [Have the 'getdtablesize' function.])) | |
211 | AC_CHECK_FUNC([getifaddrs], | 211 | AC_CHECK_FUNC([getifaddrs], | |
212 | AC_DEFINE(HAS_GETIFADDRS, 1, [Have the 'getifaddrs' function.])) | 212 | AC_DEFINE(HAS_GETIFADDRS, 1, [Have the 'getifaddrs' function.])) | |
213 | AC_CHECK_FUNC([getpeereid], | 213 | AC_CHECK_FUNC([getpeereid], | |
214 | AC_DEFINE(HAS_GETPEEREID, 1, [Have the 'getpeereid' function.])) | 214 | AC_DEFINE(HAS_GETPEEREID, 1, [Have the 'getpeereid' function.])) | |
215 | AC_CHECK_FUNC([getpeerucred], | 215 | AC_CHECK_FUNC([getpeerucred], | |
216 | AC_DEFINE(HAS_GETPEERUCRED, 1, [Have the 'getpeerucred' function.])) | 216 | AC_DEFINE(HAS_GETPEERUCRED, 1, [Have the 'getpeerucred' function.])) | |
217 | AC_CHECK_FUNC([strlcat], HAVE_STRLCAT=yes, HAVE_STRLCAT=no) | 217 | AC_CHECK_FUNC([strlcat], HAVE_STRLCAT=yes, HAVE_STRLCAT=no) | |
218 | AM_CONDITIONAL(NEED_STRLCAT, [test x$HAVE_STRLCAT = xno]) | 218 | AM_CONDITIONAL(NEED_STRLCAT, [test x$HAVE_STRLCAT = xno]) | |
219 | AC_CHECK_FUNC([strlcpy], AC_DEFINE(HAS_STRLCPY, 1, [Have the 'strlcpy' function])) | 219 | AC_CHECK_FUNC([strlcpy], AC_DEFINE(HAS_STRLCPY, 1, [Have the 'strlcpy' function])) | |
220 | 220 | |||
221 | AM_CONDITIONAL(NEED_VSNPRINTF, [test x$HAVE_VSNPRINTF = xno]) | 221 | AM_CONDITIONAL(NEED_VSNPRINTF, [test x$HAVE_VSNPRINTF = xno]) | |
222 | 222 | |||
223 | AC_CHECK_LIB([bsd], [arc4random_buf]) | |||
224 | ||||
223 | dnl Check for mmap support for Xvfb | 225 | dnl Check for mmap support for Xvfb | |
224 | AC_CHECK_FUNC([mmap], AC_DEFINE(HAS_MMAP, 1, [Have the 'mmap' function.])) | 226 | AC_CHECK_FUNC([mmap], AC_DEFINE(HAS_MMAP, 1, [Have the 'mmap' function.])) | |
225 | 227 | |||
226 | dnl Find the math libary | 228 | dnl Find the math libary | |
227 | AC_CHECK_LIB(m, sqrt) | 229 | AC_CHECK_LIB(m, sqrt) | |
228 | AC_CHECK_LIB(m, cbrt, AC_DEFINE(HAVE_CBRT, 1, [Have the 'cbrt' function])) | 230 | AC_CHECK_LIB(m, cbrt, AC_DEFINE(HAVE_CBRT, 1, [Have the 'cbrt' function])) | |
229 | 231 | |||
230 | AC_CHECK_HEADERS([ndbm.h dbm.h rpcsvc/dbm.h]) | 232 | AC_CHECK_HEADERS([ndbm.h dbm.h rpcsvc/dbm.h]) | |
231 | 233 | |||
232 | dnl AGPGART headers | 234 | dnl AGPGART headers | |
233 | AC_CHECK_HEADERS([linux/agpgart.h sys/agpio.h sys/agpgart.h], AGP=yes) | 235 | AC_CHECK_HEADERS([linux/agpgart.h sys/agpio.h sys/agpgart.h], AGP=yes) | |
234 | AM_CONDITIONAL(AGP, [test "x$AGP" = xyes]) | 236 | AM_CONDITIONAL(AGP, [test "x$AGP" = xyes]) | |
235 | 237 |
--- xsrc/external/mit/xorg-server.old/dist/include/dix-config.h.in 2017/03/08 07:31:42 1.2
+++ xsrc/external/mit/xorg-server.old/dist/include/dix-config.h.in 2017/03/08 07:44:16 1.3
@@ -123,26 +123,29 @@ | @@ -123,26 +123,29 @@ | |||
123 | 123 | |||
124 | /* Have Quartz */ | 124 | /* Have Quartz */ | |
125 | #undef XQUARTZ | 125 | #undef XQUARTZ | |
126 | 126 | |||
127 | /* Support application updating through sparkle. */ | 127 | /* Support application updating through sparkle. */ | |
128 | #undef XQUARTZ_SPARKLE | 128 | #undef XQUARTZ_SPARKLE | |
129 | 129 | |||
130 | /* Prefix to use for launchd identifiers */ | 130 | /* Prefix to use for launchd identifiers */ | |
131 | #undef LAUNCHD_ID_PREFIX | 131 | #undef LAUNCHD_ID_PREFIX | |
132 | 132 | |||
133 | /* Build a standalone xpbproxy */ | 133 | /* Build a standalone xpbproxy */ | |
134 | #undef STANDALONE_XPBPROXY | 134 | #undef STANDALONE_XPBPROXY | |
135 | 135 | |||
136 | /* Define to 1 if you have the `bsd' library (-lbsd). */ | |||
137 | #undef HAVE_LIBBSD | |||
138 | ||||
136 | /* Define to 1 if you have the `m' library (-lm). */ | 139 | /* Define to 1 if you have the `m' library (-lm). */ | |
137 | #undef HAVE_LIBM | 140 | #undef HAVE_LIBM | |
138 | 141 | |||
139 | /* Define to 1 if you have the `link' function. */ | 142 | /* Define to 1 if you have the `link' function. */ | |
140 | #undef HAVE_LINK | 143 | #undef HAVE_LINK | |
141 | 144 | |||
142 | /* Define to 1 if you have the <linux/agpgart.h> header file. */ | 145 | /* Define to 1 if you have the <linux/agpgart.h> header file. */ | |
143 | #undef HAVE_LINUX_AGPGART_H | 146 | #undef HAVE_LINUX_AGPGART_H | |
144 | 147 | |||
145 | /* Define to 1 if you have the <linux/apm_bios.h> header file. */ | 148 | /* Define to 1 if you have the <linux/apm_bios.h> header file. */ | |
146 | #undef HAVE_LINUX_APM_BIOS_H | 149 | #undef HAVE_LINUX_APM_BIOS_H | |
147 | 150 | |||
148 | /* Define to 1 if you have the <linux/fb.h> header file. */ | 151 | /* Define to 1 if you have the <linux/fb.h> header file. */ | |
@@ -150,26 +153,29 @@ | @@ -150,26 +153,29 @@ | |||
150 | 153 | |||
151 | /* Define to 1 if you have the `mkstemp' function. */ | 154 | /* Define to 1 if you have the `mkstemp' function. */ | |
152 | #undef HAVE_MKSTEMP | 155 | #undef HAVE_MKSTEMP | |
153 | 156 | |||
154 | /* Define to 1 if you have the <ndbm.h> header file. */ | 157 | /* Define to 1 if you have the <ndbm.h> header file. */ | |
155 | #undef HAVE_NDBM_H | 158 | #undef HAVE_NDBM_H | |
156 | 159 | |||
157 | /* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ | 160 | /* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ | |
158 | #undef HAVE_NDIR_H | 161 | #undef HAVE_NDIR_H | |
159 | 162 | |||
160 | /* Define to 1 if you have the <rpcsvc/dbm.h> header file. */ | 163 | /* Define to 1 if you have the <rpcsvc/dbm.h> header file. */ | |
161 | #undef HAVE_RPCSVC_DBM_H | 164 | #undef HAVE_RPCSVC_DBM_H | |
162 | 165 | |||
166 | /* Define to 1 if you have the `arc4random_buf' function. */ | |||
167 | #undef HAVE_ARC4RANDOM_BUF | |||
168 | ||||
163 | /* Define to use libc SHA1 functions */ | 169 | /* Define to use libc SHA1 functions */ | |
164 | #undef HAVE_SHA1_IN_LIBC | 170 | #undef HAVE_SHA1_IN_LIBC | |
165 | 171 | |||
166 | /* Define to use CommonCrypto SHA1 functions */ | 172 | /* Define to use CommonCrypto SHA1 functions */ | |
167 | #undef HAVE_SHA1_IN_COMMONCRYPTO | 173 | #undef HAVE_SHA1_IN_COMMONCRYPTO | |
168 | 174 | |||
169 | /* Define to use libmd SHA1 functions */ | 175 | /* Define to use libmd SHA1 functions */ | |
170 | #undef HAVE_SHA1_IN_LIBMD | 176 | #undef HAVE_SHA1_IN_LIBMD | |
171 | 177 | |||
172 | /* Define to use libgcrypt SHA1 functions */ | 178 | /* Define to use libgcrypt SHA1 functions */ | |
173 | #undef HAVE_SHA1_IN_LIBGCRYPT | 179 | #undef HAVE_SHA1_IN_LIBGCRYPT | |
174 | 180 | |||
175 | /* Define to use libsha1 for SHA1 */ | 181 | /* Define to use libsha1 for SHA1 */ |
--- xsrc/external/mit/xorg-server.old/dist/os/auth.c 2017/03/08 07:18:47 1.2
+++ xsrc/external/mit/xorg-server.old/dist/os/auth.c 2017/03/08 07:44:16 1.3
@@ -35,26 +35,29 @@ from The Open Group. | @@ -35,26 +35,29 @@ from The Open Group. | |||
35 | #include <dix-config.h> | 35 | #include <dix-config.h> | |
36 | #endif | 36 | #endif | |
37 | 37 | |||
38 | # include <X11/X.h> | 38 | # include <X11/X.h> | |
39 | # include <X11/Xauth.h> | 39 | # include <X11/Xauth.h> | |
40 | # include "misc.h" | 40 | # include "misc.h" | |
41 | # include "osdep.h" | 41 | # include "osdep.h" | |
42 | # include "dixstruct.h" | 42 | # include "dixstruct.h" | |
43 | # include <sys/types.h> | 43 | # include <sys/types.h> | |
44 | # include <sys/stat.h> | 44 | # include <sys/stat.h> | |
45 | #ifdef WIN32 | 45 | #ifdef WIN32 | |
46 | #include <X11/Xw32defs.h> | 46 | #include <X11/Xw32defs.h> | |
47 | #endif | 47 | #endif | |
48 | #ifdef HAVE_LIBBSD | |||
49 | #include <bsd/stdlib.h> /* for arc4random_buf() */ | |||
50 | #endif | |||
48 | 51 | |||
49 | struct protocol { | 52 | struct protocol { | |
50 | unsigned short name_length; | 53 | unsigned short name_length; | |
51 | char *name; | 54 | char *name; | |
52 | AuthAddCFunc Add; /* new authorization data */ | 55 | AuthAddCFunc Add; /* new authorization data */ | |
53 | AuthCheckFunc Check; /* verify client authorization data */ | 56 | AuthCheckFunc Check; /* verify client authorization data */ | |
54 | AuthRstCFunc Reset; /* delete all authorization data entries */ | 57 | AuthRstCFunc Reset; /* delete all authorization data entries */ | |
55 | AuthFromIDFunc FromID; /* convert ID to cookie */ | 58 | AuthFromIDFunc FromID; /* convert ID to cookie */ | |
56 | AuthRemCFunc Remove; /* remove a specific cookie */ | 59 | AuthRemCFunc Remove; /* remove a specific cookie */ | |
57 | #ifdef XCSECURITY | 60 | #ifdef XCSECURITY | |
58 | AuthGenCFunc Generate; | 61 | AuthGenCFunc Generate; | |
59 | #endif | 62 | #endif | |
60 | }; | 63 | }; | |
@@ -307,21 +310,25 @@ GenerateAuthorization( | @@ -307,21 +310,25 @@ GenerateAuthorization( | |||
307 | memcmp (protocols[i].name, name, (int) name_length) == 0 && | 310 | memcmp (protocols[i].name, name, (int) name_length) == 0 && | |
308 | protocols[i].Generate) | 311 | protocols[i].Generate) | |
309 | { | 312 | { | |
310 | return (*protocols[i].Generate) (data_length, data, | 313 | return (*protocols[i].Generate) (data_length, data, | |
311 | FakeClientID(0), data_length_return, data_return); | 314 | FakeClientID(0), data_length_return, data_return); | |
312 | } | 315 | } | |
313 | } | 316 | } | |
314 | return -1; | 317 | return -1; | |
315 | } | 318 | } | |
316 | 319 | |||
317 | void | 320 | void | |
318 | GenerateRandomData (int len, char *buf) | 321 | GenerateRandomData (int len, char *buf) | |
319 | { | 322 | { | |
323 | #ifdef HAVE_ARC4RANDOMBUF | |||
324 | arc4random_buf(buf, len); | |||
325 | #else | |||
320 | int fd; | 326 | int fd; | |
321 | 327 | |||
322 | fd = open("/dev/urandom", O_RDONLY); | 328 | fd = open("/dev/urandom", O_RDONLY); | |
323 | read(fd, buf, len); | 329 | read(fd, buf, len); | |
324 | close(fd); | 330 | close(fd); | |
331 | #endif | |||
325 | } | 332 | } | |
326 | 333 | |||
327 | #endif /* XCSECURITY */ | 334 | #endif /* XCSECURITY */ |
--- xsrc/external/mit/xorg-server.old/include/dix-config.h 2017/03/08 07:31:42 1.3
+++ xsrc/external/mit/xorg-server.old/include/dix-config.h 2017/03/08 07:44:16 1.4
@@ -124,26 +124,29 @@ | @@ -124,26 +124,29 @@ | |||
124 | 124 | |||
125 | /* Have Quartz */ | 125 | /* Have Quartz */ | |
126 | /* #undef XQUARTZ */ | 126 | /* #undef XQUARTZ */ | |
127 | 127 | |||
128 | /* Support application updating through sparkle. */ | 128 | /* Support application updating through sparkle. */ | |
129 | /* #undef XQUARTZ_SPARKLE */ | 129 | /* #undef XQUARTZ_SPARKLE */ | |
130 | 130 | |||
131 | /* Prefix to use for launchd identifiers */ | 131 | /* Prefix to use for launchd identifiers */ | |
132 | #define LAUNCHD_ID_PREFIX "org.x" | 132 | #define LAUNCHD_ID_PREFIX "org.x" | |
133 | 133 | |||
134 | /* Build a standalone xpbproxy */ | 134 | /* Build a standalone xpbproxy */ | |
135 | /* #undef STANDALONE_XPBPROXY */ | 135 | /* #undef STANDALONE_XPBPROXY */ | |
136 | 136 | |||
137 | /* Define to 1 if you have the `bsd' library (-lbsd). */ | |||
138 | /* #undef HAVE_LIBBSD */ | |||
139 | ||||
137 | /* Define to 1 if you have the `m' library (-lm). */ | 140 | /* Define to 1 if you have the `m' library (-lm). */ | |
138 | #define HAVE_LIBM 1 | 141 | #define HAVE_LIBM 1 | |
139 | 142 | |||
140 | /* Define to 1 if you have the `link' function. */ | 143 | /* Define to 1 if you have the `link' function. */ | |
141 | #define HAVE_LINK 1 | 144 | #define HAVE_LINK 1 | |
142 | 145 | |||
143 | /* Define to 1 if you have the <linux/agpgart.h> header file. */ | 146 | /* Define to 1 if you have the <linux/agpgart.h> header file. */ | |
144 | /* #undef HAVE_LINUX_AGPGART_H */ | 147 | /* #undef HAVE_LINUX_AGPGART_H */ | |
145 | 148 | |||
146 | /* Define to 1 if you have the <linux/apm_bios.h> header file. */ | 149 | /* Define to 1 if you have the <linux/apm_bios.h> header file. */ | |
147 | /* #undef HAVE_LINUX_APM_BIOS_H */ | 150 | /* #undef HAVE_LINUX_APM_BIOS_H */ | |
148 | 151 | |||
149 | /* Define to 1 if you have the <linux/fb.h> header file. */ | 152 | /* Define to 1 if you have the <linux/fb.h> header file. */ | |
@@ -151,26 +154,29 @@ | @@ -151,26 +154,29 @@ | |||
151 | 154 | |||
152 | /* Define to 1 if you have the `mkstemp' function. */ | 155 | /* Define to 1 if you have the `mkstemp' function. */ | |
153 | #define HAVE_MKSTEMP 1 | 156 | #define HAVE_MKSTEMP 1 | |
154 | 157 | |||
155 | /* Define to 1 if you have the <ndbm.h> header file. */ | 158 | /* Define to 1 if you have the <ndbm.h> header file. */ | |
156 | #define HAVE_NDBM_H 1 | 159 | #define HAVE_NDBM_H 1 | |
157 | 160 | |||
158 | /* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ | 161 | /* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ | |
159 | /* #undef HAVE_NDIR_H */ | 162 | /* #undef HAVE_NDIR_H */ | |
160 | 163 | |||
161 | /* Define to 1 if you have the <rpcsvc/dbm.h> header file. */ | 164 | /* Define to 1 if you have the <rpcsvc/dbm.h> header file. */ | |
162 | /* #undef HAVE_RPCSVC_DBM_H */ | 165 | /* #undef HAVE_RPCSVC_DBM_H */ | |
163 | 166 | |||
167 | /* Define to 1 if you have the `arc4random_buf' function. */ | |||
168 | #define HAVE_ARC4RANDOM_BUF 1 | |||
169 | ||||
164 | /* Define to use libc SHA1 functions */ | 170 | /* Define to use libc SHA1 functions */ | |
165 | #define HAVE_SHA1_IN_LIBC 1 | 171 | #define HAVE_SHA1_IN_LIBC 1 | |
166 | 172 | |||
167 | /* Define to use CommonCrypto SHA1 functions */ | 173 | /* Define to use CommonCrypto SHA1 functions */ | |
168 | /* #undef HAVE_SHA1_IN_COMMONCRYPTO */ | 174 | /* #undef HAVE_SHA1_IN_COMMONCRYPTO */ | |
169 | 175 | |||
170 | /* Define to use libmd SHA1 functions */ | 176 | /* Define to use libmd SHA1 functions */ | |
171 | /* #undef HAVE_SHA1_IN_LIBMD */ | 177 | /* #undef HAVE_SHA1_IN_LIBMD */ | |
172 | 178 | |||
173 | /* Define to use libgcrypt SHA1 functions */ | 179 | /* Define to use libgcrypt SHA1 functions */ | |
174 | /* #undef HAVE_SHA1_IN_LIBGCRYPT */ | 180 | /* #undef HAVE_SHA1_IN_LIBGCRYPT */ | |
175 | 181 | |||
176 | /* Define to use libsha1 for SHA1 */ | 182 | /* Define to use libsha1 for SHA1 */ |