netcmd: Small tweak to retrieving pwdProperties
authorTim Beale <timbeale@catalyst.net.nz>
Wed, 2 May 2018 23:48:21 +0000 (11:48 +1200)
committerGarming Sam <garming@samba.org>
Fri, 11 May 2018 04:01:24 +0000 (06:01 +0200)
Currently the 'samba-tool domain passwordsettings' command shares a
'set' and 'show' option, but there is very little common code between
the two. The only variable that's shared is pwd_props, but there's a
separate API we can use to get this. This allows us to split the command
into a super-command in a subsequent patch.

Fixed up erroneous comments while I'm at it.

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
python/samba/netcmd/domain.py

index da617110010d241d2ef05a550c7fdb634b1195a0..8b34bfd0f3f2beb8134bfac39e05c74afc09159a 100644 (file)
@@ -1367,6 +1367,7 @@ class cmd_domain_passwordsettings(Command):
             msgs = []
             m = ldb.Message()
             m.dn = ldb.Dn(samdb, domain_dn)
+            pwd_props = int(samdb.get_pwdProperties())
 
             if complexity is not None:
                 if complexity == "on" or complexity == "default":
@@ -1458,7 +1459,7 @@ class cmd_domain_passwordsettings(Command):
                 if account_lockout_duration < 0 or account_lockout_duration > 99999:
                     raise CommandError("Maximum password age must be in the range of 0 to 99999!")
 
-                # days -> ticks
+                # minutes -> ticks
                 if account_lockout_duration == 0:
                     account_lockout_duration_ticks = -0x8000000000000000
                 else:
@@ -1487,7 +1488,7 @@ class cmd_domain_passwordsettings(Command):
                 if reset_account_lockout_after < 0 or reset_account_lockout_after > 99999:
                     raise CommandError("Maximum password age must be in the range of 0 to 99999!")
 
-                # days -> ticks
+                # minutes -> ticks
                 if reset_account_lockout_after == 0:
                     reset_account_lockout_after_ticks = -0x8000000000000000
                 else: