[PATCH] samba-tool visualize uptodateness

Douglas Bagnall douglas.bagnall at catalyst.net.nz
Sat Jun 9 21:02:38 UTC 2018


On 10/06/18 01:20, Andrew Bartlett wrote:
> On Sat, 2018-06-09 at 16:56 +1200, Douglas Bagnall via samba-technical
> wrote:
>> +    def get_utdv(self, samdb, dn):
>> +        """This finds the uptodateness vector in the database."""
>> +        cursors = []
>> +        for c in dsdb._dsdb_load_udv_v2(samdb, dn):
>> +            inv_id = str(c.source_dsa_invocation_id)
>> +            res = samdb.search(expression=("(&(invocationId=%s)"
>> +                                           "(objectClass=nTDSDSA))" % inv_id),
>> +                               #scope=SCOPE_SUBTREE,
>> +                               controls=["search_options:1:2"],
>> +                               attrs=["distinguishedName", "invocationId"])
> 
> This looks incomplete.  Firstly the comment, but also because the
> search looks over-broad.  I think you just want the config partition,
> eg samdb.get_config_dn().
> 
> +    def get_utdv(self, samdb, dn):
> +        """This finds the uptodateness vector in the database."""
> +        cursors = []
> +        for c in dsdb._dsdb_load_udv_v2(samdb, dn):
> +            inv_id = str(c.source_dsa_invocation_id)
> +            res = samdb.search(expression=("(&(invocationId=%s)"
> +                                           "(objectClass=nTDSDSA))" %
> inv_id),
> +                               #scope=SCOPE_SUBTREE,
> +                               controls=["search_options:1:2"],
> +                               attrs=["distinguishedName",
> "invocationId"])
> 
> Otherwise, this looks pretty good to me.  Thank you very much, this
> will be a great new feature.
> 
> Reviewed-by: Andrew Bartlett <abartlet at samba.org>
> 
> Can you fix that up and push?
> 
Thanks Andrew. Pushed.

This is what I squashed in:

--- a/python/samba/netcmd/visualize.py
+++ b/python/samba/netcmd/visualize.py
@@ -687,11 +687,12 @@ class cmd_uptodateness(GraphCommand):
     def get_utdv(self, samdb, dn):
         """This finds the uptodateness vector in the database."""
         cursors = []
+        config_dn = samdb.get_config_basedn()
         for c in dsdb._dsdb_load_udv_v2(samdb, dn):
             inv_id = str(c.source_dsa_invocation_id)
-            res = samdb.search(expression=("(&(invocationId=%s)"
+            res = samdb.search(base=config_dn,
+                               expression=("(&(invocationId=%s)"
                                            "(objectClass=nTDSDSA))" % inv_id),
-                               #scope=SCOPE_SUBTREE,
                                controls=["search_options:1:2"],
                                attrs=["distinguishedName", "invocationId"])


Douglas



More information about the samba-technical mailing list