[Freeipa-devel] [PATCH] Use SystemRandom for better random passwords

Simo Sorce ssorce at redhat.com
Fri Aug 8 19:42:00 UTC 2008


On Fri, 2008-08-08 at 14:47 -0400, Rob Crittenden wrote:
> Simo Sorce wrote:
> > While reviewing some code I realized we could do a better job at
> > generating random password (and this was already implemented for one of
> > our functions).
> > The current code is *not* flawed, but using better methods is always a
> > good thing.
> 
> ack but looks like you can remove the 'generator = 
> random.SystemRandom()' as well.

arghh no, thanks for point this out because the bug is that the last
line should look like:

+            password += generator.choice(password_chars)

and NOT

+            password += r.choice(password_chars)

bloody copy&paste errors :-)

Simo.




More information about the Freeipa-devel mailing list