Fix a test failure by limiting random.randrange to [-32768, 32767]

This commit is contained in:
James Vega 2008-08-12 04:14:44 +00:00
parent d39846ae68
commit 699bb15f23
1 changed files with 2 additions and 1 deletions

View File

@ -1,5 +1,6 @@
### ###
# Copyright (c) 2002-2005, Jeremiah Fincher # Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2008, James Vega
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -112,7 +113,7 @@ class Unix(callbacks.Plugin):
def makeSalt(): def makeSalt():
s = '\x00' s = '\x00'
while self._cryptre.sub('', s) != '': while self._cryptre.sub('', s) != '':
s = struct.pack('<h', random.randrange(2**16)) s = struct.pack('<h', random.randrange(-(2**15), 2**15))
return s return s
if not salt: if not salt:
salt = makeSalt() salt = makeSalt()