xsrc/external/mit/xorg-server.old/dist/configure.ac 1.2 (patch) xsrc/external/mit/xorg-server.old/dist/include/dix-config.h.in 1.2 (patch) xsrc/external/mit/xorg-server.old/dist/include/dix-config.h.in 1.3 (patch) xsrc/external/mit/xorg-server.old/dist/include/os.h 1.2 (patch) xsrc/external/mit/xorg-server.old/dist/os/auth.c 1.2 (patch) xsrc/external/mit/xorg-server.old/dist/os/auth.c 1.3 (patch) xsrc/external/mit/xorg-server.old/dist/os/mitauth.c 1.2 (patch) xsrc/external/mit/xorg-server.old/dist/os/mitauth.c 1.3 (patch) xsrc/external/mit/xorg-server.old/dist/os/osdep.h 1.2 (patch) xsrc/external/mit/xorg-server.old/dist/os/rpcauth.c 1.2 (patch) xsrc/external/mit/xorg-server.old/dist/os/timingsafe_memcmp.c 1.1 (patch) xsrc/external/mit/xorg-server.old/dist/os/xdmauth.c 1.2 (patch) xsrc/external/mit/xorg-server.old/include/dix-config.h 1.3 (patch) xsrc/external/mit/xorg-server.old/include/dix-config.h 1.4 (patch) xsrc/external/mit/xorg-server/dist/configure.ac 1.4 (patch) xsrc/external/mit/xorg-server/dist/configure.ac 1.5 (patch) xsrc/external/mit/xorg-server/dist/include/dix-config.h.in 1.2 (patch) xsrc/external/mit/xorg-server/dist/include/dix-config.h.in 1.3 (patch) xsrc/external/mit/xorg-server/dist/include/os.h 1.8 (patch) xsrc/external/mit/xorg-server/dist/os/auth.c 1.2 (patch) xsrc/external/mit/xorg-server/dist/os/auth.c 1.3 (patch) xsrc/external/mit/xorg-server/dist/os/mitauth.c 1.2 (patch) xsrc/external/mit/xorg-server/dist/os/mitauth.c 1.3 (patch) xsrc/external/mit/xorg-server/dist/os/osdep.h 1.2 (patch) xsrc/external/mit/xorg-server/dist/os/rpcauth.c 1.4 (patch) xsrc/external/mit/xorg-server/dist/os/timingsafe_memcmp.c 1.1 (patch) xsrc/external/mit/xorg-server/dist/os/xdmauth.c 1.2 (patch) xsrc/external/mit/xorg-server/include/dix-config.h 1.26 (patch) xsrc/external/mit/xorg-server/include/dix-config.h 1.27 (patch) Apply upstream fixes for generation and comparision of MIT-MAGIC-COOKIES, fixing CVE-2017-2624 [mrg, ticket #1381]diff -r1.1.1.8.2.1 -r1.1.1.8.2.2 xsrc/external/mit/xorg-server/dist/configure.ac
(martin)
--- xsrc/external/mit/xorg-server/dist/configure.ac 2014/12/09 19:43:12 1.1.1.8.2.1
+++ xsrc/external/mit/xorg-server/dist/configure.ac 2017/03/08 14:47:24 1.1.1.8.2.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/dist/include/dix-config.h.in 2011/08/02 06:57:02 1.1.1.4
+++ xsrc/external/mit/xorg-server/dist/include/dix-config.h.in 2017/03/08 14:47:24 1.1.1.4.2.1
@@ -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 */ | |
@@ -218,26 +224,29 @@ | @@ -218,26 +224,29 @@ | |||
218 | 224 | |||
219 | /* Define to 1 if you have the <sys/stat.h> header file. */ | 225 | /* Define to 1 if you have the <sys/stat.h> header file. */ | |
220 | #undef HAVE_SYS_STAT_H | 226 | #undef HAVE_SYS_STAT_H | |
221 | 227 | |||
222 | /* Define to 1 if you have the <sys/types.h> header file. */ | 228 | /* Define to 1 if you have the <sys/types.h> header file. */ | |
223 | #undef HAVE_SYS_TYPES_H | 229 | #undef HAVE_SYS_TYPES_H | |
224 | 230 | |||
225 | /* Define to 1 if you have the <sys/utsname.h> header file. */ | 231 | /* Define to 1 if you have the <sys/utsname.h> header file. */ | |
226 | #undef HAVE_SYS_UTSNAME_H | 232 | #undef HAVE_SYS_UTSNAME_H | |
227 | 233 | |||
228 | /* Define to 1 if you have the <sys/vm86.h> header file. */ | 234 | /* Define to 1 if you have the <sys/vm86.h> header file. */ | |
229 | #undef HAVE_SYS_VM86_H | 235 | #undef HAVE_SYS_VM86_H | |
230 | 236 | |||
237 | /* Define to 1 if you have the `timingsafe_memcmp' function. */ | |||
238 | #undef HAVE_TIMINGSAFE_MEMCMP | |||
239 | ||||
231 | /* Define to 1 if you have the <tslib.h> header file. */ | 240 | /* Define to 1 if you have the <tslib.h> header file. */ | |
232 | #undef HAVE_TSLIB_H | 241 | #undef HAVE_TSLIB_H | |
233 | 242 | |||
234 | /* Define to 1 if you have the <unistd.h> header file. */ | 243 | /* Define to 1 if you have the <unistd.h> header file. */ | |
235 | #undef HAVE_UNISTD_H | 244 | #undef HAVE_UNISTD_H | |
236 | 245 | |||
237 | /* Define to 1 if you have the <fnmatch.h> header file. */ | 246 | /* Define to 1 if you have the <fnmatch.h> header file. */ | |
238 | #undef HAVE_FNMATCH_H | 247 | #undef HAVE_FNMATCH_H | |
239 | 248 | |||
240 | /* Have /dev/urandom */ | 249 | /* Have /dev/urandom */ | |
241 | #undef HAVE_URANDOM | 250 | #undef HAVE_URANDOM | |
242 | 251 | |||
243 | /* Define to 1 if you have the `vprintf' function. */ | 252 | /* Define to 1 if you have the `vprintf' function. */ |
--- xsrc/external/mit/xorg-server/dist/include/os.h 2011/08/02 07:15:06 1.6
+++ xsrc/external/mit/xorg-server/dist/include/os.h 2017/03/08 14:47:24 1.6.2.1
@@ -485,26 +485,31 @@ extern _X_EXPORT int xstrcasecmp(const c | @@ -485,26 +485,31 @@ extern _X_EXPORT int xstrcasecmp(const c | |||
485 | extern _X_EXPORT int xstrncasecmp(const char *s1, const char *s2, size_t n); | 485 | extern _X_EXPORT int xstrncasecmp(const char *s1, const char *s2, size_t n); | |
486 | #endif | 486 | #endif | |
487 | 487 | |||
488 | #if NEED_STRCASESTR | 488 | #if NEED_STRCASESTR | |
489 | #define strcasestr xstrcasestr | 489 | #define strcasestr xstrcasestr | |
490 | extern _X_EXPORT char *xstrcasestr(const char *s, const char *find); | 490 | extern _X_EXPORT char *xstrcasestr(const char *s, const char *find); | |
491 | #endif | 491 | #endif | |
492 | 492 | |||
493 | #ifndef HAS_STRLCPY | 493 | #ifndef HAS_STRLCPY | |
494 | extern _X_EXPORT size_t strlcpy(char *dst, const char *src, size_t siz); | 494 | extern _X_EXPORT size_t strlcpy(char *dst, const char *src, size_t siz); | |
495 | extern _X_EXPORT size_t strlcat(char *dst, const char *src, size_t siz); | 495 | extern _X_EXPORT size_t strlcat(char *dst, const char *src, size_t siz); | |
496 | #endif | 496 | #endif | |
497 | 497 | |||
498 | #ifndef HAVE_TIMINGSAFE_MEMCMP | |||
499 | extern _X_EXPORT int | |||
500 | timingsafe_memcmp(const void *b1, const void *b2, size_t len); | |||
501 | #endif | |||
502 | ||||
498 | /* Logging. */ | 503 | /* Logging. */ | |
499 | typedef enum _LogParameter { | 504 | typedef enum _LogParameter { | |
500 | XLOG_FLUSH, | 505 | XLOG_FLUSH, | |
501 | XLOG_SYNC, | 506 | XLOG_SYNC, | |
502 | XLOG_VERBOSITY, | 507 | XLOG_VERBOSITY, | |
503 | XLOG_FILE_VERBOSITY | 508 | XLOG_FILE_VERBOSITY | |
504 | } LogParameter; | 509 | } LogParameter; | |
505 | 510 | |||
506 | /* Flags for log messages. */ | 511 | /* Flags for log messages. */ | |
507 | typedef enum { | 512 | typedef enum { | |
508 | X_PROBED, /* Value was probed */ | 513 | X_PROBED, /* Value was probed */ | |
509 | X_CONFIG, /* Value was given in the config file */ | 514 | X_CONFIG, /* Value was given in the config file */ | |
510 | X_DEFAULT, /* Value is a default */ | 515 | X_DEFAULT, /* Value is a default */ |
--- xsrc/external/mit/xorg-server/dist/os/auth.c 2010/11/23 05:22:09 1.1.1.3
+++ xsrc/external/mit/xorg-server/dist/os/auth.c 2017/03/08 14:47:24 1.1.1.3.2.1
@@ -35,62 +35,64 @@ from The Open Group. | @@ -35,62 +35,64 @@ 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 | AuthToIDFunc ToID; /* convert cookie to ID */ | |||
56 | AuthFromIDFunc FromID; /* convert ID to cookie */ | 58 | AuthFromIDFunc FromID; /* convert ID to cookie */ | |
57 | AuthRemCFunc Remove; /* remove a specific cookie */ | 59 | AuthRemCFunc Remove; /* remove a specific cookie */ | |
58 | #ifdef XCSECURITY | 60 | #ifdef XCSECURITY | |
59 | AuthGenCFunc Generate; | 61 | AuthGenCFunc Generate; | |
60 | #endif | 62 | #endif | |
61 | }; | 63 | }; | |
62 | 64 | |||
63 | static struct protocol protocols[] = { | 65 | static struct protocol protocols[] = { | |
64 | { (unsigned short) 18, "MIT-MAGIC-COOKIE-1", | 66 | { (unsigned short) 18, "MIT-MAGIC-COOKIE-1", | |
65 | MitAddCookie, MitCheckCookie, MitResetCookie, | 67 | MitAddCookie, MitCheckCookie, MitResetCookie, | |
66 | MitToID, MitFromID, MitRemoveCookie, | 68 | MitFromID, MitRemoveCookie, | |
67 | #ifdef XCSECURITY | 69 | #ifdef XCSECURITY | |
68 | MitGenerateCookie | 70 | MitGenerateCookie | |
69 | #endif | 71 | #endif | |
70 | }, | 72 | }, | |
71 | #ifdef HASXDMAUTH | 73 | #ifdef HASXDMAUTH | |
72 | { (unsigned short) 19, "XDM-AUTHORIZATION-1", | 74 | { (unsigned short) 19, "XDM-AUTHORIZATION-1", | |
73 | XdmAddCookie, XdmCheckCookie, XdmResetCookie, | 75 | XdmAddCookie, XdmCheckCookie, XdmResetCookie, | |
74 | XdmToID, XdmFromID, XdmRemoveCookie, | 76 | XdmFromID, XdmRemoveCookie, | |
75 | #ifdef XCSECURITY | 77 | #ifdef XCSECURITY | |
76 | NULL | 78 | NULL | |
77 | #endif | 79 | #endif | |
78 | }, | 80 | }, | |
79 | #endif | 81 | #endif | |
80 | #ifdef SECURE_RPC | 82 | #ifdef SECURE_RPC | |
81 | { (unsigned short) 9, "SUN-DES-1", | 83 | { (unsigned short) 9, "SUN-DES-1", | |
82 | SecureRPCAdd, SecureRPCCheck, SecureRPCReset, | 84 | SecureRPCAdd, SecureRPCCheck, SecureRPCReset, | |
83 | SecureRPCToID, SecureRPCFromID,SecureRPCRemove, | 85 | SecureRPCFromID,SecureRPCRemove, | |
84 | #ifdef XCSECURITY | 86 | #ifdef XCSECURITY | |
85 | NULL | 87 | NULL | |
86 | #endif | 88 | #endif | |
87 | }, | 89 | }, | |
88 | #endif | 90 | #endif | |
89 | }; | 91 | }; | |
90 | 92 | |||
91 | # define NUM_AUTHORIZATION (sizeof (protocols) /\ | 93 | # define NUM_AUTHORIZATION (sizeof (protocols) /\ | |
92 | sizeof (struct protocol)) | 94 | sizeof (struct protocol)) | |
93 | 95 | |||
94 | /* | 96 | /* | |
95 | * Initialize all classes of authorization by reading the | 97 | * Initialize all classes of authorization by reading the | |
96 | * specified authorization file | 98 | * specified authorization file | |
@@ -308,21 +310,25 @@ GenerateAuthorization( | @@ -308,21 +310,25 @@ GenerateAuthorization( | |||
308 | memcmp (protocols[i].name, name, (int) name_length) == 0 && | 310 | memcmp (protocols[i].name, name, (int) name_length) == 0 && | |
309 | protocols[i].Generate) | 311 | protocols[i].Generate) | |
310 | { | 312 | { | |
311 | return (*protocols[i].Generate) (data_length, data, | 313 | return (*protocols[i].Generate) (data_length, data, | |
312 | FakeClientID(0), data_length_return, data_return); | 314 | FakeClientID(0), data_length_return, data_return); | |
313 | } | 315 | } | |
314 | } | 316 | } | |
315 | return -1; | 317 | return -1; | |
316 | } | 318 | } | |
317 | 319 | |||
318 | void | 320 | void | |
319 | GenerateRandomData (int len, char *buf) | 321 | GenerateRandomData (int len, char *buf) | |
320 | { | 322 | { | |
323 | #ifdef HAVE_ARC4RANDOMBUF | |||
324 | arc4random_buf(buf, len); | |||
325 | #else | |||
321 | int fd; | 326 | int fd; | |
322 | 327 | |||
323 | fd = open("/dev/urandom", O_RDONLY); | 328 | fd = open("/dev/urandom", O_RDONLY); | |
324 | read(fd, buf, len); | 329 | read(fd, buf, len); | |
325 | close(fd); | 330 | close(fd); | |
331 | #endif | |||
326 | } | 332 | } | |
327 | 333 | |||
328 | #endif /* XCSECURITY */ | 334 | #endif /* XCSECURITY */ |
--- xsrc/external/mit/xorg-server/dist/os/xdmauth.c 2010/11/23 05:22:10 1.1.1.3
+++ xsrc/external/mit/xorg-server/dist/os/xdmauth.c 2017/03/08 14:47:24 1.1.1.3.2.1
@@ -413,51 +413,26 @@ XdmResetCookie (void) | @@ -413,51 +413,26 @@ XdmResetCookie (void) | |||
413 | next_auth = auth->next; | 413 | next_auth = auth->next; | |
414 | free(auth); | 414 | free(auth); | |
415 | } | 415 | } | |
416 | xdmAuth = 0; | 416 | xdmAuth = 0; | |
417 | for (client = xdmClients; client; client=next_client) | 417 | for (client = xdmClients; client; client=next_client) | |
418 | { | 418 | { | |
419 | next_client = client->next; | 419 | next_client = client->next; | |
420 | free(client); | 420 | free(client); | |
421 | } | 421 | } | |
422 | xdmClients = (XdmClientAuthPtr) 0; | 422 | xdmClients = (XdmClientAuthPtr) 0; | |
423 | return 1; | 423 | return 1; | |
424 | } | 424 | } | |
425 | 425 | |||
426 | XID | |||
427 | XdmToID (unsigned short cookie_length, char *cookie) | |||
428 | { | |||
429 | XdmAuthorizationPtr auth; | |||
430 | XdmClientAuthPtr client; | |||
431 | unsigned char *plain; | |||
432 | ||||
433 | plain = malloc(cookie_length); | |||
434 | if (!plain) | |||
435 | return (XID) -1; | |||
436 | for (auth = xdmAuth; auth; auth=auth->next) { | |||
437 | XdmcpUnwrap ((unsigned char *)cookie, (unsigned char *)&auth->key, plain, cookie_length); | |||
438 | if ((client = XdmAuthorizationValidate (plain, cookie_length, &auth->rho, NULL, NULL)) != NULL) | |||
439 | { | |||
440 | free(client); | |||
441 | free(cookie); | |||
442 | free(plain); | |||
443 | return auth->id; | |||
444 | } | |||
445 | } | |||
446 | free(cookie); | |||
447 | free(plain); | |||
448 | return (XID) -1; | |||
449 | } | |||
450 | ||||
451 | int | 426 | int | |
452 | XdmFromID (XID id, unsigned short *data_lenp, char **datap) | 427 | XdmFromID (XID id, unsigned short *data_lenp, char **datap) | |
453 | { | 428 | { | |
454 | XdmAuthorizationPtr auth; | 429 | XdmAuthorizationPtr auth; | |
455 | 430 | |||
456 | for (auth = xdmAuth; auth; auth=auth->next) { | 431 | for (auth = xdmAuth; auth; auth=auth->next) { | |
457 | if (id == auth->id) { | 432 | if (id == auth->id) { | |
458 | *data_lenp = 16; | 433 | *data_lenp = 16; | |
459 | *datap = (char *) &auth->rho; | 434 | *datap = (char *) &auth->rho; | |
460 | return 1; | 435 | return 1; | |
461 | } | 436 | } | |
462 | } | 437 | } | |
463 | return 0; | 438 | return 0; |
--- xsrc/external/mit/xorg-server/dist/os/mitauth.c 2010/11/23 05:22:09 1.1.1.2
+++ xsrc/external/mit/xorg-server/dist/os/mitauth.c 2017/03/08 14:47:24 1.1.1.2.2.1
@@ -72,62 +72,47 @@ MitAddCookie ( | @@ -72,62 +72,47 @@ MitAddCookie ( | |||
72 | } | 72 | } | |
73 | 73 | |||
74 | XID | 74 | XID | |
75 | MitCheckCookie ( | 75 | MitCheckCookie ( | |
76 | unsigned short data_length, | 76 | unsigned short data_length, | |
77 | const char *data, | 77 | const char *data, | |
78 | ClientPtr client, | 78 | ClientPtr client, | |
79 | char **reason) | 79 | char **reason) | |
80 | { | 80 | { | |
81 | struct auth *auth; | 81 | struct auth *auth; | |
82 | 82 | |||
83 | for (auth = mit_auth; auth; auth=auth->next) { | 83 | for (auth = mit_auth; auth; auth=auth->next) { | |
84 | if (data_length == auth->len && | 84 | if (data_length == auth->len && | |
85 | memcmp (data, auth->data, (int) data_length) == 0) | 85 | timingsafe_memcmp(data, auth->data, (int) data_length) == 0) | |
86 | return auth->id; | 86 | return auth->id; | |
87 | } | 87 | } | |
88 | *reason = "Invalid MIT-MAGIC-COOKIE-1 key"; | 88 | *reason = "Invalid MIT-MAGIC-COOKIE-1 key"; | |
89 | return (XID) -1; | 89 | return (XID) -1; | |
90 | } | 90 | } | |
91 | 91 | |||
92 | int | 92 | int | |
93 | MitResetCookie (void) | 93 | MitResetCookie (void) | |
94 | { | 94 | { | |
95 | struct auth *auth, *next; | 95 | struct auth *auth, *next; | |
96 | 96 | |||
97 | for (auth = mit_auth; auth; auth=next) { | 97 | for (auth = mit_auth; auth; auth=next) { | |
98 | next = auth->next; | 98 | next = auth->next; | |
99 | free(auth->data); | 99 | free(auth->data); | |
100 | free(auth); | 100 | free(auth); | |
101 | } | 101 | } | |
102 | mit_auth = 0; | 102 | mit_auth = 0; | |
103 | return 0; | 103 | return 0; | |
104 | } | 104 | } | |
105 | 105 | |||
106 | XID | |||
107 | MitToID ( | |||
108 | unsigned short data_length, | |||
109 | char *data) | |||
110 | { | |||
111 | struct auth *auth; | |||
112 | ||||
113 | for (auth = mit_auth; auth; auth=auth->next) { | |||
114 | if (data_length == auth->len && | |||
115 | memcmp (data, auth->data, data_length) == 0) | |||
116 | return auth->id; | |||
117 | } | |||
118 | return (XID) -1; | |||
119 | } | |||
120 | ||||
121 | int | 106 | int | |
122 | MitFromID ( | 107 | MitFromID ( | |
123 | XID id, | 108 | XID id, | |
124 | unsigned short *data_lenp, | 109 | unsigned short *data_lenp, | |
125 | char **datap) | 110 | char **datap) | |
126 | { | 111 | { | |
127 | struct auth *auth; | 112 | struct auth *auth; | |
128 | 113 | |||
129 | for (auth = mit_auth; auth; auth=auth->next) { | 114 | for (auth = mit_auth; auth; auth=auth->next) { | |
130 | if (id == auth->id) { | 115 | if (id == auth->id) { | |
131 | *data_lenp = auth->len; | 116 | *data_lenp = auth->len; | |
132 | *datap = auth->data; | 117 | *datap = auth->data; | |
133 | return 1; | 118 | return 1; |
--- xsrc/external/mit/xorg-server/dist/os/osdep.h 2011/08/02 06:57:04 1.1.1.4
+++ xsrc/external/mit/xorg-server/dist/os/osdep.h 2017/03/08 14:47:24 1.1.1.4.2.1
@@ -148,29 +148,26 @@ typedef XID (*AuthCheckFunc) (AuthCheckA | @@ -148,29 +148,26 @@ typedef XID (*AuthCheckFunc) (AuthCheckA | |||
148 | 148 | |||
149 | #define AuthFromIDArgs XID id, unsigned short *data_lenp, char **datap | 149 | #define AuthFromIDArgs XID id, unsigned short *data_lenp, char **datap | |
150 | typedef int (*AuthFromIDFunc) (AuthFromIDArgs); | 150 | typedef int (*AuthFromIDFunc) (AuthFromIDArgs); | |
151 | 151 | |||
152 | #define AuthGenCArgs unsigned data_length, const char *data, XID id, unsigned *data_length_return, char **data_return | 152 | #define AuthGenCArgs unsigned data_length, const char *data, XID id, unsigned *data_length_return, char **data_return | |
153 | typedef XID (*AuthGenCFunc) (AuthGenCArgs); | 153 | typedef XID (*AuthGenCFunc) (AuthGenCArgs); | |
154 | 154 | |||
155 | #define AuthRemCArgs unsigned short data_length, const char *data | 155 | #define AuthRemCArgs unsigned short data_length, const char *data | |
156 | typedef int (*AuthRemCFunc) (AuthRemCArgs); | 156 | typedef int (*AuthRemCFunc) (AuthRemCArgs); | |
157 | 157 | |||
158 | #define AuthRstCArgs void | 158 | #define AuthRstCArgs void | |
159 | typedef int (*AuthRstCFunc) (AuthRstCArgs); | 159 | typedef int (*AuthRstCFunc) (AuthRstCArgs); | |
160 | 160 | |||
161 | #define AuthToIDArgs unsigned short data_length, char *data | |||
162 | typedef XID (*AuthToIDFunc) (AuthToIDArgs); | |||
163 | ||||
164 | typedef void (*OsCloseFunc)(ClientPtr); | 161 | typedef void (*OsCloseFunc)(ClientPtr); | |
165 | 162 | |||
166 | typedef int (*OsFlushFunc)(ClientPtr who, struct _osComm * oc, char* extraBuf, int extraCount); | 163 | typedef int (*OsFlushFunc)(ClientPtr who, struct _osComm * oc, char* extraBuf, int extraCount); | |
167 | 164 | |||
168 | typedef struct _osComm { | 165 | typedef struct _osComm { | |
169 | int fd; | 166 | int fd; | |
170 | ConnectionInputPtr input; | 167 | ConnectionInputPtr input; | |
171 | ConnectionOutputPtr output; | 168 | ConnectionOutputPtr output; | |
172 | XID auth_id; /* authorization id */ | 169 | XID auth_id; /* authorization id */ | |
173 | CARD32 conn_time; /* timestamp if not established, else 0 */ | 170 | CARD32 conn_time; /* timestamp if not established, else 0 */ | |
174 | struct _XtransConnInfo *trans_conn; /* transport connection object */ | 171 | struct _XtransConnInfo *trans_conn; /* transport connection object */ | |
175 | Bool local_client; | 172 | Bool local_client; | |
176 | } OsCommRec, *OsCommPtr; | 173 | } OsCommRec, *OsCommPtr; | |
@@ -217,47 +214,44 @@ typedef long int fd_mask; | @@ -217,47 +214,44 @@ typedef long int fd_mask; | |||
217 | #endif | 214 | #endif | |
218 | #define ffs mffs | 215 | #define ffs mffs | |
219 | extern int mffs(fd_mask); | 216 | extern int mffs(fd_mask); | |
220 | 217 | |||
221 | /* in access.c */ | 218 | /* in access.c */ | |
222 | extern Bool ComputeLocalClient(ClientPtr client); | 219 | extern Bool ComputeLocalClient(ClientPtr client); | |
223 | 220 | |||
224 | /* in auth.c */ | 221 | /* in auth.c */ | |
225 | extern void GenerateRandomData (int len, char *buf); | 222 | extern void GenerateRandomData (int len, char *buf); | |
226 | 223 | |||
227 | /* in mitauth.c */ | 224 | /* in mitauth.c */ | |
228 | extern XID MitCheckCookie (AuthCheckArgs); | 225 | extern XID MitCheckCookie (AuthCheckArgs); | |
229 | extern XID MitGenerateCookie (AuthGenCArgs); | 226 | extern XID MitGenerateCookie (AuthGenCArgs); | |
230 | extern XID MitToID (AuthToIDArgs); | |||
231 | extern int MitAddCookie (AuthAddCArgs); | 227 | extern int MitAddCookie (AuthAddCArgs); | |
232 | extern int MitFromID (AuthFromIDArgs); | 228 | extern int MitFromID (AuthFromIDArgs); | |
233 | extern int MitRemoveCookie (AuthRemCArgs); | 229 | extern int MitRemoveCookie (AuthRemCArgs); | |
234 | extern int MitResetCookie (AuthRstCArgs); | 230 | extern int MitResetCookie (AuthRstCArgs); | |
235 | 231 | |||
236 | /* in xdmauth.c */ | 232 | /* in xdmauth.c */ | |
237 | #ifdef HASXDMAUTH | 233 | #ifdef HASXDMAUTH | |
238 | extern XID XdmCheckCookie (AuthCheckArgs); | 234 | extern XID XdmCheckCookie (AuthCheckArgs); | |
239 | extern XID XdmToID (AuthToIDArgs); | |||
240 | extern int XdmAddCookie (AuthAddCArgs); | 235 | extern int XdmAddCookie (AuthAddCArgs); | |
241 | extern int XdmFromID (AuthFromIDArgs); | 236 | extern int XdmFromID (AuthFromIDArgs); | |
242 | extern int XdmRemoveCookie (AuthRemCArgs); | 237 | extern int XdmRemoveCookie (AuthRemCArgs); | |
243 | extern int XdmResetCookie (AuthRstCArgs); | 238 | extern int XdmResetCookie (AuthRstCArgs); | |
244 | #endif | 239 | #endif | |
245 | 240 | |||
246 | /* in rpcauth.c */ | 241 | /* in rpcauth.c */ | |
247 | #ifdef SECURE_RPC | 242 | #ifdef SECURE_RPC | |
248 | extern void SecureRPCInit (AuthInitArgs); | 243 | extern void SecureRPCInit (AuthInitArgs); | |
249 | extern XID SecureRPCCheck (AuthCheckArgs); | 244 | extern XID SecureRPCCheck (AuthCheckArgs); | |
250 | extern XID SecureRPCToID (AuthToIDArgs); | |||
251 | extern int SecureRPCAdd (AuthAddCArgs); | 245 | extern int SecureRPCAdd (AuthAddCArgs); | |
252 | extern int SecureRPCFromID (AuthFromIDArgs); | 246 | extern int SecureRPCFromID (AuthFromIDArgs); | |
253 | extern int SecureRPCRemove (AuthRemCArgs); | 247 | extern int SecureRPCRemove (AuthRemCArgs); | |
254 | extern int SecureRPCReset (AuthRstCArgs); | 248 | extern int SecureRPCReset (AuthRstCArgs); | |
255 | #endif | 249 | #endif | |
256 | 250 | |||
257 | #ifdef XDMCP | 251 | #ifdef XDMCP | |
258 | /* in xdmcp.c */ | 252 | /* in xdmcp.c */ | |
259 | extern void XdmcpUseMsg (void); | 253 | extern void XdmcpUseMsg (void); | |
260 | extern int XdmcpOptions(int argc, char **argv, int i); | 254 | extern int XdmcpOptions(int argc, char **argv, int i); | |
261 | extern void XdmcpRegisterConnection ( | 255 | extern void XdmcpRegisterConnection ( | |
262 | int type, | 256 | int type, | |
263 | const char *address, | 257 | const char *address, |
--- xsrc/external/mit/xorg-server/dist/os/rpcauth.c 2014/12/09 19:43:13 1.1.1.3.2.1
+++ xsrc/external/mit/xorg-server/dist/os/rpcauth.c 2017/03/08 14:47:24 1.1.1.3.2.2
@@ -167,31 +167,25 @@ SecureRPCAdd (unsigned short data_length | @@ -167,31 +167,25 @@ SecureRPCAdd (unsigned short data_length | |||
167 | if (data_length) | 167 | if (data_length) | |
168 | AddHost ((pointer) 0, FamilyNetname, data_length, data); | 168 | AddHost ((pointer) 0, FamilyNetname, data_length, data); | |
169 | rpc_id = id; | 169 | rpc_id = id; | |
170 | return 1; | 170 | return 1; | |
171 | } | 171 | } | |
172 | 172 | |||
173 | _X_HIDDEN int | 173 | _X_HIDDEN int | |
174 | SecureRPCReset (void) | 174 | SecureRPCReset (void) | |
175 | { | 175 | { | |
176 | rpc_id = (XID) ~0L; | 176 | rpc_id = (XID) ~0L; | |
177 | return 1; | 177 | return 1; | |
178 | } | 178 | } | |
179 | 179 | |||
180 | _X_HIDDEN XID | |||
181 | SecureRPCToID (unsigned short data_length, char *data) | |||
182 | { | |||
183 | return rpc_id; | |||
184 | } | |||
185 | ||||
186 | _X_HIDDEN int | 180 | _X_HIDDEN int | |
187 | SecureRPCFromID (XID id, unsigned short *data_lenp, char **datap) | 181 | SecureRPCFromID (XID id, unsigned short *data_lenp, char **datap) | |
188 | { | 182 | { | |
189 | return 0; | 183 | return 0; | |
190 | } | 184 | } | |
191 | 185 | |||
192 | _X_HIDDEN int | 186 | _X_HIDDEN int | |
193 | SecureRPCRemove (unsigned short data_length, const char *data) | 187 | SecureRPCRemove (unsigned short data_length, const char *data) | |
194 | { | 188 | { | |
195 | return 0; | 189 | return 0; | |
196 | } | 190 | } | |
197 | #endif /* SECURE_RPC */ | 191 | #endif /* SECURE_RPC */ |
/*
* Copyright (c) 2014 Google Inc.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <limits.h>
#include <string.h>
#include <X11/Xfuncproto.h>
#include <dix-config.h>
#include "os.h"
int
timingsafe_memcmp(const void *b1, const void *b2, size_t len)
{
const unsigned char *p1 = b1, *p2 = b2;
size_t i;
int res = 0, done = 0;
for (i = 0; i < len; i++) {
/* lt is -1 if p1[i] < p2[i]; else 0. */
int lt = (p1[i] - p2[i]) >> CHAR_BIT;
/* gt is -1 if p1[i] > p2[i]; else 0. */
int gt = (p2[i] - p1[i]) >> CHAR_BIT;
/* cmp is 1 if p1[i] > p2[i]; -1 if p1[i] < p2[i]; else 0. */
int cmp = lt - gt;
/* set res = cmp if !done. */
res |= cmp & ~done;
/* set done if p1[i] != p2[i]. */
done |= lt | gt;
}
return (res);
}
--- xsrc/external/mit/xorg-server/include/dix-config.h 2011/08/02 22:45:52 1.19
+++ xsrc/external/mit/xorg-server/include/dix-config.h 2017/03/08 14:47:24 1.19.2.1
@@ -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 */ | |
@@ -219,26 +225,29 @@ | @@ -219,26 +225,29 @@ | |||
219 | 225 | |||
220 | /* Define to 1 if you have the <sys/stat.h> header file. */ | 226 | /* Define to 1 if you have the <sys/stat.h> header file. */ | |
221 | #define HAVE_SYS_STAT_H 1 | 227 | #define HAVE_SYS_STAT_H 1 | |
222 | 228 | |||
223 | /* Define to 1 if you have the <sys/types.h> header file. */ | 229 | /* Define to 1 if you have the <sys/types.h> header file. */ | |
224 | #define HAVE_SYS_TYPES_H 1 | 230 | #define HAVE_SYS_TYPES_H 1 | |
225 | 231 | |||
226 | /* Define to 1 if you have the <sys/utsname.h> header file. */ | 232 | /* Define to 1 if you have the <sys/utsname.h> header file. */ | |
227 | #define HAVE_SYS_UTSNAME_H 1 | 233 | #define HAVE_SYS_UTSNAME_H 1 | |
228 | 234 | |||
229 | /* Define to 1 if you have the <sys/vm86.h> header file. */ | 235 | /* Define to 1 if you have the <sys/vm86.h> header file. */ | |
230 | /* #undef HAVE_SYS_VM86_H */ | 236 | /* #undef HAVE_SYS_VM86_H */ | |
231 | 237 | |||
238 | /* Define to 1 if you have the `timingsafe_memcmp' function. */ | |||
239 | /* #undef HAVE_TIMINGSAFE_MEMCMP */ | |||
240 | ||||
232 | /* Define to 1 if you have the <tslib.h> header file. */ | 241 | /* Define to 1 if you have the <tslib.h> header file. */ | |
233 | /* #undef HAVE_TSLIB_H */ | 242 | /* #undef HAVE_TSLIB_H */ | |
234 | 243 | |||
235 | /* Define to 1 if you have the <unistd.h> header file. */ | 244 | /* Define to 1 if you have the <unistd.h> header file. */ | |
236 | #define HAVE_UNISTD_H 1 | 245 | #define HAVE_UNISTD_H 1 | |
237 | 246 | |||
238 | /* Define to 1 if you have the <fnmatch.h> header file. */ | 247 | /* Define to 1 if you have the <fnmatch.h> header file. */ | |
239 | #define HAVE_FNMATCH_H 1 | 248 | #define HAVE_FNMATCH_H 1 | |
240 | 249 | |||
241 | /* Have /dev/urandom */ | 250 | /* Have /dev/urandom */ | |
242 | /* #undef HAVE_URANDOM */ | 251 | /* #undef HAVE_URANDOM */ | |
243 | 252 | |||
244 | /* Define to 1 if you have the `vprintf' function. */ | 253 | /* Define to 1 if you have the `vprintf' function. */ |
--- xsrc/xfree/xc/programs/Xserver/include/Attic/os.h 2005/03/18 14:55:16 1.5
+++ xsrc/xfree/xc/programs/Xserver/include/Attic/os.h 2017/03/08 14:47:24 1.5.14.1
@@ -522,26 +522,31 @@ typedef struct { | @@ -522,26 +522,31 @@ typedef struct { | |||
522 | pointer replyData; | 522 | pointer replyData; | |
523 | unsigned long dataLenBytes; | 523 | unsigned long dataLenBytes; | |
524 | unsigned long bytesRemaining; | 524 | unsigned long bytesRemaining; | |
525 | Bool startOfReply; | 525 | Bool startOfReply; | |
526 | } ReplyInfoRec; | 526 | } ReplyInfoRec; | |
527 | 527 | |||
528 | /* stuff for FlushCallback */ | 528 | /* stuff for FlushCallback */ | |
529 | extern CallbackListPtr FlushCallback; | 529 | extern CallbackListPtr FlushCallback; | |
530 | 530 | |||
531 | extern void AbortDDX(void); | 531 | extern void AbortDDX(void); | |
532 | extern void ddxGiveUp(void); | 532 | extern void ddxGiveUp(void); | |
533 | extern int TimeSinceLastInputEvent(void); | 533 | extern int TimeSinceLastInputEvent(void); | |
534 | 534 | |||
535 | #ifndef HAVE_TIMINGSAFE_MEMCMP | |||
536 | extern int | |||
537 | timingsafe_memcmp(const void *b1, const void *b2, size_t len); | |||
538 | #endif | |||
539 | ||||
535 | /* Logging. */ | 540 | /* Logging. */ | |
536 | typedef enum _LogParameter { | 541 | typedef enum _LogParameter { | |
537 | XLOG_FLUSH, | 542 | XLOG_FLUSH, | |
538 | XLOG_SYNC, | 543 | XLOG_SYNC, | |
539 | XLOG_VERBOSITY, | 544 | XLOG_VERBOSITY, | |
540 | XLOG_FILE_VERBOSITY | 545 | XLOG_FILE_VERBOSITY | |
541 | } LogParameter; | 546 | } LogParameter; | |
542 | 547 | |||
543 | /* Flags for log messages. */ | 548 | /* Flags for log messages. */ | |
544 | typedef enum { | 549 | typedef enum { | |
545 | X_PROBED, /* Value was probed */ | 550 | X_PROBED, /* Value was probed */ | |
546 | X_CONFIG, /* Value was given in the config file */ | 551 | X_CONFIG, /* Value was given in the config file */ | |
547 | X_DEFAULT, /* Value is a default */ | 552 | X_DEFAULT, /* Value is a default */ |
--- xsrc/xfree/xc/programs/Xserver/os/Attic/auth.c 2004/03/05 16:33:09 1.4
+++ xsrc/xfree/xc/programs/Xserver/os/Attic/auth.c 2017/03/08 14:47:24 1.4.26.1
@@ -40,81 +40,83 @@ from The Open Group. | @@ -40,81 +40,83 @@ from The Open Group. | |||
40 | # include <X11/Xauth.h> | 40 | # include <X11/Xauth.h> | |
41 | # include "misc.h" | 41 | # include "misc.h" | |
42 | # include "osdep.h" | 42 | # include "osdep.h" | |
43 | # include "dixstruct.h" | 43 | # include "dixstruct.h" | |
44 | # include <sys/types.h> | 44 | # include <sys/types.h> | |
45 | # include <sys/stat.h> | 45 | # include <sys/stat.h> | |
46 | #ifdef XCSECURITY | 46 | #ifdef XCSECURITY | |
47 | #define _SECURITY_SERVER | 47 | #define _SECURITY_SERVER | |
48 | # include "extensions/security.h" | 48 | # include "extensions/security.h" | |
49 | #endif | 49 | #endif | |
50 | #ifdef WIN32 | 50 | #ifdef WIN32 | |
51 | #include "Xw32defs.h" | 51 | #include "Xw32defs.h" | |
52 | #endif | 52 | #endif | |
53 | #ifdef HAVE_LIBBSD | |||
54 | #include <bsd/stdlib.h> /* for arc4random_buf() */ | |||
55 | #endif | |||
53 | 56 | |||
54 | struct protocol { | 57 | struct protocol { | |
55 | unsigned short name_length; | 58 | unsigned short name_length; | |
56 | char *name; | 59 | char *name; | |
57 | AuthAddCFunc Add; /* new authorization data */ | 60 | AuthAddCFunc Add; /* new authorization data */ | |
58 | AuthCheckFunc Check; /* verify client authorization data */ | 61 | AuthCheckFunc Check; /* verify client authorization data */ | |
59 | AuthRstCFunc Reset; /* delete all authorization data entries */ | 62 | AuthRstCFunc Reset; /* delete all authorization data entries */ | |
60 | AuthToIDFunc ToID; /* convert cookie to ID */ | |||
61 | AuthFromIDFunc FromID; /* convert ID to cookie */ | 63 | AuthFromIDFunc FromID; /* convert ID to cookie */ | |
62 | AuthRemCFunc Remove; /* remove a specific cookie */ | 64 | AuthRemCFunc Remove; /* remove a specific cookie */ | |
63 | #ifdef XCSECURITY | 65 | #ifdef XCSECURITY | |
64 | AuthGenCFunc Generate; | 66 | AuthGenCFunc Generate; | |
65 | #endif | 67 | #endif | |
66 | }; | 68 | }; | |
67 | 69 | |||
68 | static struct protocol protocols[] = { | 70 | static struct protocol protocols[] = { | |
69 | { (unsigned short) 18, "MIT-MAGIC-COOKIE-1", | 71 | { (unsigned short) 18, "MIT-MAGIC-COOKIE-1", | |
70 | MitAddCookie, MitCheckCookie, MitResetCookie, | 72 | MitAddCookie, MitCheckCookie, MitResetCookie, | |
71 | MitToID, MitFromID, MitRemoveCookie, | 73 | MitFromID, MitRemoveCookie, | |
72 | #ifdef XCSECURITY | 74 | #ifdef XCSECURITY | |
73 | MitGenerateCookie | 75 | MitGenerateCookie | |
74 | #endif | 76 | #endif | |
75 | }, | 77 | }, | |
76 | #ifdef HASXDMAUTH | 78 | #ifdef HASXDMAUTH | |
77 | { (unsigned short) 19, "XDM-AUTHORIZATION-1", | 79 | { (unsigned short) 19, "XDM-AUTHORIZATION-1", | |
78 | XdmAddCookie, XdmCheckCookie, XdmResetCookie, | 80 | XdmAddCookie, XdmCheckCookie, XdmResetCookie, | |
79 | XdmToID, XdmFromID, XdmRemoveCookie, | 81 | XdmFromID, XdmRemoveCookie, | |
80 | #ifdef XCSECURITY | 82 | #ifdef XCSECURITY | |
81 | NULL | 83 | NULL | |
82 | #endif | 84 | #endif | |
83 | }, | 85 | }, | |
84 | #endif | 86 | #endif | |
85 | #ifdef SECURE_RPC | 87 | #ifdef SECURE_RPC | |
86 | { (unsigned short) 9, "SUN-DES-1", | 88 | { (unsigned short) 9, "SUN-DES-1", | |
87 | SecureRPCAdd, SecureRPCCheck, SecureRPCReset, | 89 | SecureRPCAdd, SecureRPCCheck, SecureRPCReset, | |
88 | SecureRPCToID, SecureRPCFromID,SecureRPCRemove, | 90 | SecureRPCFromID,SecureRPCRemove, | |
89 | #ifdef XCSECURITY | 91 | #ifdef XCSECURITY | |
90 | NULL | 92 | NULL | |
91 | #endif | 93 | #endif | |
92 | }, | 94 | }, | |
93 | #endif | 95 | #endif | |
94 | #ifdef K5AUTH | 96 | #ifdef K5AUTH | |
95 | { (unsigned short) 14, "MIT-KERBEROS-5", | 97 | { (unsigned short) 14, "MIT-KERBEROS-5", | |
96 | K5Add, K5Check, K5Reset, | 98 | K5Add, K5Check, K5Reset, | |
97 | K5ToID, K5FromID, K5Remove, | 99 | K5FromID, K5Remove, | |
98 | #ifdef XCSECURITY | 100 | #ifdef XCSECURITY | |
99 | NULL | 101 | NULL | |
100 | #endif | 102 | #endif | |
101 | }, | 103 | }, | |
102 | #endif | 104 | #endif | |
103 | #ifdef XCSECURITY | 105 | #ifdef XCSECURITY | |
104 | { (unsigned short) XSecurityAuthorizationNameLen, | 106 | { (unsigned short) XSecurityAuthorizationNameLen, | |
105 | XSecurityAuthorizationName, | 107 | XSecurityAuthorizationName, | |
106 | NULL, AuthSecurityCheck, NULL, | 108 | NULL, AuthSecurityCheck, NULL, | |
107 | NULL, NULL, NULL, | 109 | NULL, NULL, | |
108 | NULL | 110 | NULL | |
109 | }, | 111 | }, | |
110 | #endif | 112 | #endif | |
111 | }; | 113 | }; | |
112 | 114 | |||
113 | # define NUM_AUTHORIZATION (sizeof (protocols) /\ | 115 | # define NUM_AUTHORIZATION (sizeof (protocols) /\ | |
114 | sizeof (struct protocol)) | 116 | sizeof (struct protocol)) | |
115 | 117 | |||
116 | /* | 118 | /* | |
117 | * Initialize all classes of authorization by reading the | 119 | * Initialize all classes of authorization by reading the | |
118 | * specified authorization file | 120 | * specified authorization file | |
119 | */ | 121 | */ | |
120 | 122 | |||
@@ -244,46 +246,26 @@ CheckAuthorization ( | @@ -244,46 +246,26 @@ CheckAuthorization ( | |||
244 | } | 246 | } | |
245 | 247 | |||
246 | void | 248 | void | |
247 | ResetAuthorization (void) | 249 | ResetAuthorization (void) | |
248 | { | 250 | { | |
249 | int i; | 251 | int i; | |
250 | 252 | |||
251 | for (i = 0; i < NUM_AUTHORIZATION; i++) | 253 | for (i = 0; i < NUM_AUTHORIZATION; i++) | |
252 | if (protocols[i].Reset) | 254 | if (protocols[i].Reset) | |
253 | (*protocols[i].Reset)(); | 255 | (*protocols[i].Reset)(); | |
254 | ShouldLoadAuth = TRUE; | 256 | ShouldLoadAuth = TRUE; | |
255 | } | 257 | } | |
256 | 258 | |||
257 | XID | |||
258 | AuthorizationToID ( | |||
259 | unsigned short name_length, | |||
260 | char *name, | |||
261 | unsigned short data_length, | |||
262 | char *data) | |||
263 | { | |||
264 | int i; | |||
265 | ||||
266 | for (i = 0; i < NUM_AUTHORIZATION; i++) { | |||
267 | if (protocols[i].name_length == name_length && | |||
268 | memcmp (protocols[i].name, name, (int) name_length) == 0 && | |||
269 | protocols[i].ToID) | |||
270 | { | |||
271 | return (*protocols[i].ToID) (data_length, data); | |||
272 | } | |||
273 | } | |||
274 | return (XID) ~0L; | |||
275 | } | |||
276 | ||||
277 | int | 259 | int | |
278 | AuthorizationFromID ( | 260 | AuthorizationFromID ( | |
279 | XID id, | 261 | XID id, | |
280 | unsigned short *name_lenp, | 262 | unsigned short *name_lenp, | |
281 | char **namep, | 263 | char **namep, | |
282 | unsigned short *data_lenp, | 264 | unsigned short *data_lenp, | |
283 | char **datap) | 265 | char **datap) | |
284 | { | 266 | { | |
285 | int i; | 267 | int i; | |
286 | 268 | |||
287 | for (i = 0; i < NUM_AUTHORIZATION; i++) { | 269 | for (i = 0; i < NUM_AUTHORIZATION; i++) { | |
288 | if (protocols[i].FromID && | 270 | if (protocols[i].FromID && | |
289 | (*protocols[i].FromID) (id, data_lenp, datap)) { | 271 | (*protocols[i].FromID) (id, data_lenp, datap)) { |
--- xsrc/xfree/xc/programs/Xserver/os/Attic/mitauth.c 2002/01/19 15:14:27 1.1.1.4
+++ xsrc/xfree/xc/programs/Xserver/os/Attic/mitauth.c 2017/03/08 14:47:24 1.1.1.4.28.1
@@ -70,62 +70,47 @@ MitAddCookie ( | @@ -70,62 +70,47 @@ MitAddCookie ( | |||
70 | } | 70 | } | |
71 | 71 | |||
72 | XID | 72 | XID | |
73 | MitCheckCookie ( | 73 | MitCheckCookie ( | |
74 | unsigned short data_length, | 74 | unsigned short data_length, | |
75 | char *data, | 75 | char *data, | |
76 | ClientPtr client, | 76 | ClientPtr client, | |
77 | char **reason) | 77 | char **reason) | |
78 | { | 78 | { | |
79 | struct auth *auth; | 79 | struct auth *auth; | |
80 | 80 | |||
81 | for (auth = mit_auth; auth; auth=auth->next) { | 81 | for (auth = mit_auth; auth; auth=auth->next) { | |
82 | if (data_length == auth->len && | 82 | if (data_length == auth->len && | |
83 | memcmp (data, auth->data, (int) data_length) == 0) | 83 | timingsafe_memcmp(data, auth->data, (int) data_length) == 0) | |
84 | return auth->id; | 84 | return auth->id; | |
85 | } | 85 | } | |
86 | *reason = "Invalid MIT-MAGIC-COOKIE-1 key"; | 86 | *reason = "Invalid MIT-MAGIC-COOKIE-1 key"; | |
87 | return (XID) -1; | 87 | return (XID) -1; | |
88 | } | 88 | } | |
89 | 89 | |||
90 | int | 90 | int | |
91 | MitResetCookie (void) | 91 | MitResetCookie (void) | |
92 | { | 92 | { | |
93 | struct auth *auth, *next; | 93 | struct auth *auth, *next; | |
94 | 94 | |||
95 | for (auth = mit_auth; auth; auth=next) { | 95 | for (auth = mit_auth; auth; auth=next) { | |
96 | next = auth->next; | 96 | next = auth->next; | |
97 | xfree (auth->data); | 97 | xfree (auth->data); | |
98 | xfree (auth); | 98 | xfree (auth); | |
99 | } | 99 | } | |
100 | mit_auth = 0; | 100 | mit_auth = 0; | |
101 | return 0; | 101 | return 0; | |
102 | } | 102 | } | |
103 | 103 | |||
104 | XID | |||
105 | MitToID ( | |||
106 | unsigned short data_length, | |||
107 | char *data) | |||
108 | { | |||
109 | struct auth *auth; | |||
110 | ||||
111 | for (auth = mit_auth; auth; auth=auth->next) { | |||
112 | if (data_length == auth->len && | |||
113 | memcmp (data, auth->data, data_length) == 0) | |||
114 | return auth->id; | |||
115 | } | |||
116 | return (XID) -1; | |||
117 | } | |||
118 | ||||
119 | int | 104 | int | |
120 | MitFromID ( | 105 | MitFromID ( | |
121 | XID id, | 106 | XID id, | |
122 | unsigned short *data_lenp, | 107 | unsigned short *data_lenp, | |
123 | char **datap) | 108 | char **datap) | |
124 | { | 109 | { | |
125 | struct auth *auth; | 110 | struct auth *auth; | |
126 | 111 | |||
127 | for (auth = mit_auth; auth; auth=auth->next) { | 112 | for (auth = mit_auth; auth; auth=auth->next) { | |
128 | if (id == auth->id) { | 113 | if (id == auth->id) { | |
129 | *data_lenp = auth->len; | 114 | *data_lenp = auth->len; | |
130 | *datap = auth->data; | 115 | *datap = auth->data; | |
131 | return 1; | 116 | return 1; |
--- xsrc/xfree/xc/programs/Xserver/os/Attic/osdep.h 2005/03/18 13:13:14 1.1.1.7
+++ xsrc/xfree/xc/programs/Xserver/os/Attic/osdep.h 2017/03/08 14:47:24 1.1.1.7.14.1
@@ -171,29 +171,26 @@ typedef XID (*AuthCheckFunc) (AuthCheckA | @@ -171,29 +171,26 @@ typedef XID (*AuthCheckFunc) (AuthCheckA | |||
171 | 171 | |||
172 | #define AuthFromIDArgs XID id, unsigned short *data_lenp, char **datap | 172 | #define AuthFromIDArgs XID id, unsigned short *data_lenp, char **datap | |
173 | typedef int (*AuthFromIDFunc) (AuthFromIDArgs); | 173 | typedef int (*AuthFromIDFunc) (AuthFromIDArgs); | |
174 | 174 | |||
175 | #define AuthGenCArgs unsigned data_length, char *data, XID id, unsigned *data_length_return, char **data_return | 175 | #define AuthGenCArgs unsigned data_length, char *data, XID id, unsigned *data_length_return, char **data_return | |
176 | typedef XID (*AuthGenCFunc) (AuthGenCArgs); | 176 | typedef XID (*AuthGenCFunc) (AuthGenCArgs); | |
177 | 177 | |||
178 | #define AuthRemCArgs unsigned short data_length, char *data | 178 | #define AuthRemCArgs unsigned short data_length, char *data | |
179 | typedef int (*AuthRemCFunc) (AuthRemCArgs); | 179 | typedef int (*AuthRemCFunc) (AuthRemCArgs); | |
180 | 180 | |||
181 | #define AuthRstCArgs void | 181 | #define AuthRstCArgs void | |
182 | typedef int (*AuthRstCFunc) (AuthRstCArgs); | 182 | typedef int (*AuthRstCFunc) (AuthRstCArgs); | |
183 | 183 | |||
184 | #define AuthToIDArgs unsigned short data_length, char *data | |||
185 | typedef XID (*AuthToIDFunc) (AuthToIDArgs); | |||
186 | ||||
187 | typedef void (*OsCloseFunc)(ClientPtr); | 184 | typedef void (*OsCloseFunc)(ClientPtr); | |
188 | 185 | |||
189 | typedef int (*OsFlushFunc)(ClientPtr who, struct _osComm * oc, char* extraBuf, int extraCount); | 186 | typedef int (*OsFlushFunc)(ClientPtr who, struct _osComm * oc, char* extraBuf, int extraCount); | |
190 | 187 | |||
191 | typedef struct _osComm { | 188 | typedef struct _osComm { | |
192 | int fd; | 189 | int fd; | |
193 | ConnectionInputPtr input; | 190 | ConnectionInputPtr input; | |
194 | ConnectionOutputPtr output; | 191 | ConnectionOutputPtr output; | |
195 | XID auth_id; /* authorization id */ | 192 | XID auth_id; /* authorization id */ | |
196 | #ifdef K5AUTH | 193 | #ifdef K5AUTH | |
197 | k5_state authstate; /* state of setup auth conversation */ | 194 | k5_state authstate; /* state of setup auth conversation */ | |
198 | #endif | 195 | #endif | |
199 | CARD32 conn_time; /* timestamp if not established, else 0 */ | 196 | CARD32 conn_time; /* timestamp if not established, else 0 */ | |
@@ -259,47 +256,44 @@ extern OsCommPtr AvailableInput; | @@ -259,47 +256,44 @@ extern OsCommPtr AvailableInput; | |||
259 | 256 | |||
260 | extern WorkQueuePtr workQueue; | 257 | extern WorkQueuePtr workQueue; | |
261 | 258 | |||
262 | /* added by raphael */ | 259 | /* added by raphael */ | |
263 | #define ffs mffs | 260 | #define ffs mffs | |
264 | extern int mffs(fd_mask); | 261 | extern int mffs(fd_mask); | |
265 | 262 | |||
266 | /* in auth.c */ | 263 | /* in auth.c */ | |
267 | extern void GenerateRandomData (int len, char *buf); | 264 | extern void GenerateRandomData (int len, char *buf); | |
268 | 265 | |||
269 | /* in mitauth.c */ | 266 | /* in mitauth.c */ | |
270 | extern XID MitCheckCookie (AuthCheckArgs); | 267 | extern XID MitCheckCookie (AuthCheckArgs); | |
271 | extern XID MitGenerateCookie (AuthGenCArgs); | 268 | extern XID MitGenerateCookie (AuthGenCArgs); | |
272 | extern XID MitToID (AuthToIDArgs); | |||
273 | extern int MitAddCookie (AuthAddCArgs); | 269 | extern int MitAddCookie (AuthAddCArgs); | |
274 | extern int MitFromID (AuthFromIDArgs); | 270 | extern int MitFromID (AuthFromIDArgs); | |
275 | extern int MitRemoveCookie (AuthRemCArgs); | 271 | extern int MitRemoveCookie (AuthRemCArgs); | |
276 | extern int MitResetCookie (AuthRstCArgs); | 272 | extern int MitResetCookie (AuthRstCArgs); | |
277 | 273 | |||
278 | /* in xdmauth.c */ | 274 | /* in xdmauth.c */ | |
279 | #ifdef HASXDMAUTH | 275 | #ifdef HASXDMAUTH | |
280 | extern XID XdmCheckCookie (AuthCheckArgs); | 276 | extern XID XdmCheckCookie (AuthCheckArgs); | |
281 | extern XID XdmToID (AuthToIDArgs); | |||
282 | extern int XdmAddCookie (AuthAddCArgs); | 277 | extern int XdmAddCookie (AuthAddCArgs); | |
283 | extern int XdmFromID (AuthFromIDArgs); | 278 | extern int XdmFromID (AuthFromIDArgs); | |
284 | extern int XdmRemoveCookie (AuthRemCArgs); | 279 | extern int XdmRemoveCookie (AuthRemCArgs); | |
285 | extern int XdmResetCookie (AuthRstCArgs); | 280 | extern int XdmResetCookie (AuthRstCArgs); | |
286 | #endif | 281 | #endif | |
287 | 282 | |||
288 | /* in rpcauth.c */ | 283 | /* in rpcauth.c */ | |
289 | #ifdef SECURE_RPC | 284 | #ifdef SECURE_RPC | |
290 | extern void SecureRPCInit (AuthInitArgs); | 285 | extern void SecureRPCInit (AuthInitArgs); | |
291 | extern XID SecureRPCCheck (AuthCheckArgs); | 286 | extern XID SecureRPCCheck (AuthCheckArgs); | |
292 | extern XID SecureRPCToID (AuthToIDArgs); | |||
293 | extern int SecureRPCAdd (AuthAddCArgs); | 287 | extern int SecureRPCAdd (AuthAddCArgs); | |
294 | extern int SecureRPCFromID (AuthFromIDArgs); | 288 | extern int SecureRPCFromID (AuthFromIDArgs); | |
295 | extern int SecureRPCRemove (AuthRemCArgs); | 289 | extern int SecureRPCRemove (AuthRemCArgs); | |
296 | extern int SecureRPCReset (AuthRstCArgs); | 290 | extern int SecureRPCReset (AuthRstCArgs); | |
297 | #endif | 291 | #endif | |
298 | 292 | |||
299 | /* in k5auth.c */ | 293 | /* in k5auth.c */ | |
300 | #ifdef K5AUTH | 294 | #ifdef K5AUTH | |
301 | extern XID K5Check (AuthCheckArgs); | 295 | extern XID K5Check (AuthCheckArgs); | |
302 | extern XID K5ToID (AuthToIDArgs); | 296 | extern XID K5ToID (AuthToIDArgs); | |
303 | extern int K5Add (AuthAddCArgs); | 297 | extern int K5Add (AuthAddCArgs); | |
304 | extern int K5FromID (AuthFromIDArgs); | 298 | extern int K5FromID (AuthFromIDArgs); | |
305 | extern int K5Remove (AuthRemCArgs); | 299 | extern int K5Remove (AuthRemCArgs); |
--- xsrc/xfree/xc/programs/Xserver/os/Attic/rpcauth.c 2014/12/12 07:15:06 1.1.1.5.26.1
+++ xsrc/xfree/xc/programs/Xserver/os/Attic/rpcauth.c 2017/03/08 14:47:24 1.1.1.5.26.2
@@ -174,31 +174,25 @@ SecureRPCAdd (unsigned short data_length | @@ -174,31 +174,25 @@ SecureRPCAdd (unsigned short data_length | |||
174 | if (data_length) | 174 | if (data_length) | |
175 | AddHost ((pointer) 0, FamilyNetname, data_length, data); | 175 | AddHost ((pointer) 0, FamilyNetname, data_length, data); | |
176 | rpc_id = id; | 176 | rpc_id = id; | |
177 | return 1; | 177 | return 1; | |
178 | } | 178 | } | |
179 | 179 | |||
180 | int | 180 | int | |
181 | SecureRPCReset (void) | 181 | SecureRPCReset (void) | |
182 | { | 182 | { | |
183 | rpc_id = (XID) ~0L; | 183 | rpc_id = (XID) ~0L; | |
184 | return 1; | 184 | return 1; | |
185 | } | 185 | } | |
186 | 186 | |||
187 | XID | |||
188 | SecureRPCToID (unsigned short data_length, char *data) | |||
189 | { | |||
190 | return rpc_id; | |||
191 | } | |||
192 | ||||
193 | int | 187 | int | |
194 | SecureRPCFromID (XID id, unsigned short *data_lenp, char **datap) | 188 | SecureRPCFromID (XID id, unsigned short *data_lenp, char **datap) | |
195 | { | 189 | { | |
196 | return 0; | 190 | return 0; | |
197 | } | 191 | } | |
198 | 192 | |||
199 | int | 193 | int | |
200 | SecureRPCRemove (unsigned short data_length, char *data) | 194 | SecureRPCRemove (unsigned short data_length, char *data) | |
201 | { | 195 | { | |
202 | return 0; | 196 | return 0; | |
203 | } | 197 | } | |
204 | #endif /* SECURE_RPC */ | 198 | #endif /* SECURE_RPC */ |
/*
* Copyright (c) 2014 Google Inc.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <limits.h>
#include <string.h>
#include <X11/Xfuncproto.h>
#include "os.h"
int
timingsafe_memcmp(const void *b1, const void *b2, size_t len)
{
const unsigned char *p1 = b1, *p2 = b2;
size_t i;
int res = 0, done = 0;
for (i = 0; i < len; i++) {
/* lt is -1 if p1[i] < p2[i]; else 0. */
int lt = (p1[i] - p2[i]) >> CHAR_BIT;
/* gt is -1 if p1[i] > p2[i]; else 0. */
int gt = (p2[i] - p1[i]) >> CHAR_BIT;
/* cmp is 1 if p1[i] > p2[i]; -1 if p1[i] < p2[i]; else 0. */
int cmp = lt - gt;
/* set res = cmp if !done. */
res |= cmp & ~done;
/* set done if p1[i] != p2[i]. */
done |= lt | gt;
}
return (res);
}
--- xsrc/xfree/xc/programs/Xserver/os/Attic/xdmauth.c 2005/03/18 13:13:14 1.1.1.6
+++ xsrc/xfree/xc/programs/Xserver/os/Attic/xdmauth.c 2017/03/08 14:47:24 1.1.1.6.14.1
@@ -412,52 +412,26 @@ XdmResetCookie (void) | @@ -412,52 +412,26 @@ XdmResetCookie (void) | |||
412 | next_auth = auth->next; | 412 | next_auth = auth->next; | |
413 | xfree (auth); | 413 | xfree (auth); | |
414 | } | 414 | } | |
415 | xdmAuth = 0; | 415 | xdmAuth = 0; | |
416 | for (client = xdmClients; client; client=next_client) | 416 | for (client = xdmClients; client; client=next_client) | |
417 | { | 417 | { | |
418 | next_client = client->next; | 418 | next_client = client->next; | |
419 | xfree (client); | 419 | xfree (client); | |
420 | } | 420 | } | |
421 | xdmClients = (XdmClientAuthPtr) 0; | 421 | xdmClients = (XdmClientAuthPtr) 0; | |
422 | return 1; | 422 | return 1; | |
423 | } | 423 | } | |
424 | 424 | |||
425 | XID | |||
426 | XdmToID (unsigned short cookie_length, char *cookie) | |||
427 | { | |||
428 | XdmAuthorizationPtr auth; | |||
429 | XdmClientAuthPtr client; | |||
430 | unsigned char *plain; | |||
431 | ||||
432 | plain = (unsigned char *) xalloc (cookie_length); | |||
433 | if (!plain) | |||
434 | return (XID) -1; | |||
435 | for (auth = xdmAuth; auth; auth=auth->next) { | |||
436 | XdmcpUnwrap ((unsigned char *)cookie, (unsigned char *)&auth->key, | |||
437 | plain, cookie_length); | |||
438 | client = XdmAuthorizationValidate (plain, cookie_length, &auth->rho, | |||
439 | NULL, NULL); | |||
440 | if (client != NULL) | |||
441 | { | |||
442 | xfree (client); | |||
443 | xfree (cookie); | |||
444 | return auth->id; | |||
445 | } | |||
446 | } | |||
447 | xfree (cookie); | |||
448 | return (XID) -1; | |||
449 | } | |||
450 | ||||
451 | int | 425 | int | |
452 | XdmFromID (XID id, unsigned short *data_lenp, char **datap) | 426 | XdmFromID (XID id, unsigned short *data_lenp, char **datap) | |
453 | { | 427 | { | |
454 | XdmAuthorizationPtr auth; | 428 | XdmAuthorizationPtr auth; | |
455 | 429 | |||
456 | for (auth = xdmAuth; auth; auth=auth->next) { | 430 | for (auth = xdmAuth; auth; auth=auth->next) { | |
457 | if (id == auth->id) { | 431 | if (id == auth->id) { | |
458 | *data_lenp = 16; | 432 | *data_lenp = 16; | |
459 | *datap = (char *) &auth->rho; | 433 | *datap = (char *) &auth->rho; | |
460 | return 1; | 434 | return 1; | |
461 | } | 435 | } | |
462 | } | 436 | } | |
463 | return 0; | 437 | return 0; |