File U_Fix-compilation-error-when-arc4random_buf-is-not-ava.patch of Package libXdmcp

From 6d1aee0310001eca8f6ded9814a2a70b3a774896 Mon Sep 17 00:00:00 2001
From: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Date: Thu, 4 May 2017 11:12:13 +0200
Subject: [PATCH] Fix compilation error when arc4random_buf is not available

Not sure how I missed that, but I did.

Also rename emulate_getrandom_buf() into insecure_getrandom_buf() as
requested in the previous patch reviews.

Last, getbits() expects an unsigned char, so remove the warning.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
 Key.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Index: libXdmcp-1.1.2/Key.c
===================================================================
--- libXdmcp-1.1.2.orig/Key.c
+++ libXdmcp-1.1.2/Key.c
@@ -65,15 +65,15 @@ getbits (long data, unsigned char *dst)
 #ifndef HAVE_ARC4RANDOM_BUF
 
 static void
-emulate_getrandom_buf (char *auth, int len)
+insecure_getrandom_buf (unsigned char *auth, int len)
 {
     long    lowbits, highbits;
 
     srandom ((int)getpid() ^ time((Time_t *)0));
     lowbits = random ();
     highbits = random ();
-    getbits (lowbits, key->data);
-    getbits (highbits, key->data + 4);
+    getbits (lowbits, auth);
+    getbits (highbits, auth + 4);
 }
 
 #ifndef _GNU_SOURCE
@@ -211,7 +211,7 @@ arc4random_buf (void *auth, int len)
     if (ret == 0)
 	return;
 
-    emulate_getrandom_buf (auth, len);
+    insecure_getrandom_buf (auth, len);
 }
 
 #endif /* !defined(HAVE_ARC4RANDOM_BUF) */
openSUSE Build Service is sponsored by