summaryrefslogtreecommitdiff
path: root/scripts/TestUtil.py
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2015-04-01 14:49:36 +0200
committerJose <jose@zeroc.com>2015-04-01 14:49:36 +0200
commiteb5749bee9ea0fc46211d365f1e21a6b460bc30d (patch)
treea5f44b79782cb2997e89dc6e3aafb0397f554afe /scripts/TestUtil.py
parentSSL fixes (bis) (diff)
downloadice-eb5749bee9ea0fc46211d365f1e21a6b460bc30d.tar.bz2
ice-eb5749bee9ea0fc46211d365f1e21a6b460bc30d.tar.xz
ice-eb5749bee9ea0fc46211d365f1e21a6b460bc30d.zip
ICE-6383 - Update crypt password usage
Added new script to create crypt passwords using passlib scripts/cryptpasswd.py Remove tests passwords files they are now generated using cryptpasswd script Update CryptPermissionsVerifierI to support PBKDF2 password schemes in Windows and OS X, and MD5/SHA256/SHA512 crypt in Linux, on other systems fallback to DES_crypt from openssl
Diffstat (limited to 'scripts/TestUtil.py')
-rwxr-xr-xscripts/TestUtil.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/TestUtil.py b/scripts/TestUtil.py
index 2a9f847016d..0ee9a0b73af 100755
--- a/scripts/TestUtil.py
+++ b/scripts/TestUtil.py
@@ -827,6 +827,27 @@ def getIceExe(name):
def getNodeCommand():
return nodeCmd
+#
+# Create a passwords file that contains the given users/passwords using cryptpasswd.py
+#
+def cryptPasswords(filePath, entries):
+ if os.path.exists(filePath):
+ os.remove(filePath)
+ passwords = open(filePath, "a")
+ for user, password in entries.items():
+ p = subprocess.Popen(
+ "%s %s" % (sys.executable, os.path.abspath(os.path.join(os.path.dirname(__file__), "cryptpasswd.py"))),
+ shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE)
+ p.stdin.write(password.encode('UTF-8'))
+ p.stdin.write('\r\n'.encode('UTF-8'))
+ p.stdin.flush()
+ if(p.wait() != 0):
+ print("cryptpasswd.py failed:\n" + p.stdout.read().decode('UTF-8').strip())
+ passwords.close()
+ sys.exit(1)
+ passwords.write("%s %s\n" % (user, p.stdout.readline().decode('UTF-8').strip()))
+ passwords.close()
+
class InvalidSelectorString(Exception):
def __init__(self, value):
self.value = value