scripting: Modify samba.descriptor.get_diff_sds() to cope with a missing reference...
authorAndrew Bartlett <abartlet@samba.org>
Fri, 22 Mar 2013 11:16:03 +0000 (22:16 +1100)
committerKarolin Seeger <kseeger@samba.org>
Sun, 7 Apr 2013 19:35:23 +0000 (21:35 +0200)
This allows the reference SD not to have an owner specified, and still
have the comparison with a database SD that does have an owner pass.
(And the same for owning group).

Andrew Bartlett

Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 874a93bc1c437543474a6c574b0065b7b953ad38)

python/samba/descriptor.py

index 4137bc3a12ab8ed8fbff27448b2d4baeee2edb22..164b0bf2541e92774b721a49a6293fe840b1af2d 100644 (file)
@@ -528,13 +528,13 @@ def get_diff_sds(refsd, cursd, domainsid, checkSacl = True):
 
     if not hash_cur.has_key("owner"):
         txt = "\tNo owner in current SD"
-    elif hash_cur["owner"] != hash_ref["owner"]:
+    elif hash_ref.has_key("owner") and hash_cur["owner"] != hash_ref["owner"]:
         txt = "\tOwner mismatch: %s (in ref) %s" \
               "(in current)\n" % (hash_ref["owner"], hash_cur["owner"])
 
     if not hash_cur.has_key("group"):
         txt = "%s\tNo group in current SD" % txt
-    elif hash_cur["group"] != hash_ref["group"]:
+    elif hash_ref.has_key("group") and hash_cur["group"] != hash_ref["group"]:
         txt = "%s\tGroup mismatch: %s (in ref) %s" \
               "(in current)\n" % (txt, hash_ref["group"], hash_cur["group"])