1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

samba tool - tests: Fix shell metacharacters in generated password

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
This commit is contained in:
Gary Lockyer 2017-06-08 07:21:05 +12:00 committed by Andrew Bartlett
parent 0098a7b556
commit 7bce7e150e
2 changed files with 15 additions and 3 deletions

View File

@ -31,9 +31,15 @@ from samba import dsdb
import binascii
import md5
import re
import random
import string
USER_NAME = "CyyptSHATestUser"
USER_PASS = samba.generate_random_password(32,32)
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

View File

@ -33,9 +33,15 @@ from samba.dcerpc import drsblobs
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
#