Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Alexander_Naumov:SLE-12:Update
libICE.5061
U_Use-arc4random-when-available-to-produce-the-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File U_Use-arc4random-when-available-to-produce-the-auth-co.patch of Package libICE.5061
From 80f62c54fbd50a3bbdf9c37258525098c9117830 Mon Sep 17 00:00:00 2001 From: Matthieu Herrb <matthieu.herrb@laas.fr> Date: Thu, 29 Aug 2013 22:18:14 +0200 Subject: [PATCH] Use arc4random when available to produce the auth cookie. arc4random() and associated functions can be found in libbsd on GNU/Linux systems. Signed-off-by: Matthieu Herrb <matthieu.herrb@laas.fr> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> --- configure.ac | 3 ++- src/iceauth.c | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) Index: libICE-1.0.8/configure.ac =================================================================== --- libICE-1.0.8.orig/configure.ac +++ libICE-1.0.8/configure.ac @@ -38,7 +38,8 @@ XTRANS_CONNECTION_FLAGS AC_DEFINE(ICE_t, 1, [Xtrans transport type]) # Checks for library functions. -AC_CHECK_FUNCS([asprintf]) +AC_CHECK_LIB([bsd], [arc4random_buf]) +AC_CHECK_FUNCS([asprintf arc4random_buf]) # Allow checking code with lint, sparse, etc. XORG_WITH_LINT Index: libICE-1.0.8/src/iceauth.c =================================================================== --- libICE-1.0.8.orig/src/iceauth.c +++ libICE-1.0.8/src/iceauth.c @@ -36,6 +36,10 @@ Author: Ralph Mor, X Consortium #include <time.h> #define Time_t time_t +#ifdef HAVE_LIBBSD +#include <bsd/stdlib.h> /* for arc4random_buf() */ +#endif + static int was_called_state; /* @@ -50,14 +54,19 @@ IceGenerateMagicCookie ( ) { char *auth; +#ifndef HAVE_ARC4RANDOM_BUF long ldata[2]; int seed; int value; int i; +#endif if ((auth = (char *) malloc (len + 1)) == NULL) return (NULL); +#ifdef HAVE_ARC4RANDOM_BUF + arc4random_buf(auth, len); +#else #ifdef ITIMER_REAL { struct timeval now; @@ -81,8 +90,8 @@ IceGenerateMagicCookie ( value = rand (); auth[i] = value & 0xff; } +#endif auth[len] = '\0'; - return (auth); }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor