Restrict the random password to [A-Za-z0-9] to ensure there are no shell
metacharacters in the generated password.
The tests use "samba-tool user create" to create the test user.
Occasionally the generated password contained shell metachatacters and
the command failed.
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Jun 9 09:50:28 CEST 2017 on sn-devel-144
import binascii
import md5
import re
-
-USER_NAME = "CyyptSHATestUser"
-USER_PASS = samba.generate_random_password(32,32)
+import random
+import string
+
+USER_NAME = "CryptSHATestUser"
+# Create a random 32 character password, containing only letters and
+# digits to avoid issues when used on the command line.
+USER_PASS = ''.join(random.choice(string.ascii_uppercase +
+ string.ascii_lowercase +
+ string.digits) for _ in range(32))
HASH_OPTION = "password hash userPassword schemes"
# Get the value of an attribute from the output string
import binascii
import md5
import re
+import random
+import string
USER_NAME = "WdigestTestUser"
-USER_PASS = samba.generate_random_password(32, 32)
+# Create a random 32 character password, containing only letters and
+# digits to avoid issues when used on the command line.
+USER_PASS = ''.join(random.choice(string.ascii_uppercase +
+ string.ascii_lowercase +
+ string.digits) for _ in range(32))
# Calculate the MD5 password digest from the supplied user, realm and password
#