]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
samba-tool: Allow ;format=UnixTime etc to operate on virtual attributes
authorAndrew Bartlett <abartlet@samba.org>
Wed, 28 Feb 2024 04:27:31 +0000 (17:27 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 29 Feb 2024 01:31:31 +0000 (01:31 +0000)
To convert a virtual attribute we must understand that it has
been put into "obj" under the name including the ;format= part
and so we must look it back up with that name when looking to
covert it from (say) NTTIME to a unix time.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
python/samba/netcmd/user/readpasswords/common.py

index c32d0de4d6b24c17d50c7c865010ac735c2af02d..27c8e6e4a2be6f2b151f34602d392d3975b06a15 100644 (file)
@@ -856,10 +856,14 @@ class GetPasswordCommand(Command):
                     continue
                 if ra["vformat"] != fm:
                     continue
+
                 srcattr = get_src_attrname(ra["attr"])
+                if srcattr is not None:
+                    an = "%s;format=%s" % (srcattr, fm)
+                else:
+                    srcattr = an = get_src_attrname(ra["raw_attr"])
                 if srcattr is None:
                     continue
-                an = "%s;format=%s" % (srcattr, fm)
                 if an in generated_formats:
                     continue
                 generated_formats[an] = fm