From 04f8ee3ab34bc4dc3b1993dece24c7c407df92d8 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 2 Jun 2016 14:25:12 +0200 Subject: [PATCH] samba-tool: do a password retype validation check for 'samba-tool user setpassword' This matches the behavior of 'samba-tool user create' and 'samba-tool user password'. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11441 Signed-off-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett --- python/samba/netcmd/user.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/python/samba/netcmd/user.py b/python/samba/netcmd/user.py index 2a93a30197e..3caa51820f0 100644 --- a/python/samba/netcmd/user.py +++ b/python/samba/netcmd/user.py @@ -597,15 +597,19 @@ Example3 shows how an administrator would reset TestUser3 user's password to pas if filter is None and username is None: raise CommandError("Either the username or '--filter' must be specified!") + password = newpassword + if random_password: password = generate_random_password(128, 255) - else: - password = newpassword - while 1: + while True: if password is not None and password is not '': break password = getpass("New Password: ") + passwordverify = getpass("Retype Password: ") + if not password == passwordverify: + password = None + self.outf.write("Sorry, passwords do not match.\n") if filter is None: filter = "(&(objectClass=user)(sAMAccountName=%s))" % (ldb.binary_encode(username)) -- 2.47.3