[SCM] Samba Shared Repository - branch master updated

simo idra at samba.org
Wed Apr 25 06:04:13 MDT 2012


On Wed, 2012-04-25 at 11:44 +0200, Andrew Bartlett wrote:
> commit b8055132b1c62dd19981fea2822ab9e1829a8ded
> Author: Andrew Bartlett <abartlet at samba.org>
> Date:   Wed Apr 25 17:53:18 2012 +1000
> 
>     s4-messaging: Use generate_random() to get a unique ID for
> messaging clients
>     
>     The call to random() resulted in duplicate values for s3fs
> configurations
>     which, due to the forked child, all started with the same random
> seed.
>     
>     A future improvement would be to move to a proven unique value.
>     
>     Andrew Bartlett
>     
>     Autobuild-User: Andrew Bartlett <abartlet at samba.org>
>     Autobuild-Date: Wed Apr 25 11:43:40 CEST 2012 on sn-devel-104


Andrew are you sure you need to use /dev/urandom here ? It doesn't look
like you need absolutelu unpredictable numbers here, just non-colliding
numbers.
You changed the code to draw from urandom, and if it is used often it
mean it will suck a lot of entropy out of the system, causing any
application that need to use /dev/random to halt.
Wouldn't it have been simpler to just run srand(time(NULL)*pid) to get a
new seed for the process ?

Simo.

-- 
Simo Sorce
Samba Team GPL Compliance Officer <simo at samba.org>
Principal Software Engineer at Red Hat, Inc. <simo at redhat.com>



More information about the samba-cvs mailing list