s4-provision: add password verification in interactive mode
authorBjörn Baumbach <bb@sernet.de>
Thu, 8 Mar 2012 14:27:05 +0000 (15:27 +0100)
committerMichael Adam <obnox@samba.org>
Wed, 21 Mar 2012 15:11:24 +0000 (16:11 +0100)
Since we do not print the password out (anymore), it is necessary to
verify the entered password.

Signed-off-by: Michael Adam <obnox@samba.org>
source4/setup/provision

index 4316ad00c6f5f13bf60ceb8e8d3e4528b7376fd8..57183540db252eda5c3e652b1af381b68b9c0663 100755 (executable)
@@ -165,11 +165,17 @@ if opts.interactive:
 
     opts.server_role = ask("Server Role (dc, member, standalone)", "dc")
     for i in range(3):
-        opts.adminpass = getpass("Administrator password: ")
-        if not opts.adminpass:
+        adminpass = getpass("Administrator password: ")
+        if not adminpass:
             print >>sys.stderr, "Invalid administrator password."
         else:
-            break
+            adminpassverify = getpass("Retype password: ")
+            if not adminpass == adminpassverify:
+                print >>sys.stderr, "Sorry, passwords do not match."
+            else:
+                opts.adminpass = adminpass
+                break
+
 else:
     if opts.realm in (None, ""):
         opts.realm = sambaopts._lp.get('realm')