[SCM] Samba Shared Repository - branch master updated
Andrew Bartlett
abartlet at samba.org
Wed Nov 21 09:47:02 UTC 2018
The branch, master has been updated
via 24b1aa9da2e logger: use color automatically for a tty
via c4bd785ac12 samba-tool ldapcmp: print DNs on predictable order
via 7ebbd3731d0 netcmd/ldapcmp: make code pythonic
via 26f0992c242 netcmd/ldapcmp: promote re object to global
via 7d9282bf7c0 netcmd/ldapcmp: use set instead of list to compare attrs
via 10855509852 netcmd/ldapcmp: fix wrong way for string copy
via 2851cd5bccd netcmd/ldapcmp: pass --skip-missing-dn to LDAPBase
via bbd082e7929 netcmd/ldapcmp: avoid modifying data while looping on dict
via 04713870896 netcmd/ldapcmp: rm unused global var summary
via f821f84f2e9 netcmd/ldapcmp: use set instead of list to find missing DNs
via 86882bd12e5 netcmd/ldapcmp: avoid list comprehension in for loop
via e71d0d71203 netcmd/ldapcmp: add choices arg to --view option
via 263f0207847 netcmd/ldapcmp: add choices arg to --scope option
via 683342b7a00 netcmd/ldapcmp: rename __eq__ to diff
via 5f47c04cf3e netcmd/ldapcmp: fix typo for Bundle
from a370f217bb9 replmd: Make replmd_process_linked_attribute() mem dependencies clearer
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 24b1aa9da2e53e0dba89811f6a8d14b810bd48a8
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Wed Oct 24 16:35:50 2018 +1300
logger: use color automatically for a tty
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Wed Nov 21 10:46:20 CET 2018 on sn-devel-144
commit c4bd785ac12fe80e11e985c8c50e459be4ec9898
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Wed Nov 21 15:33:57 2018 +1300
samba-tool ldapcmp: print DNs on predictable order
Rather than unstable hash order. Ideally we'd do them in proper DN order.
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
commit 7ebbd3731d0f510c040e7dc59532a8fb5c0f609a
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Tue Nov 6 22:10:55 2018 +1300
netcmd/ldapcmp: make code pythonic
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
commit 26f0992c24281514dd3ef079c1951a56277373a4
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Tue Nov 6 21:37:47 2018 +1300
netcmd/ldapcmp: promote re object to global
Then we can reuse the re obj.
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
commit 7d9282bf7c02df351f976701ac6b4ed121be72f1
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Tue Nov 6 18:16:34 2018 +1300
netcmd/ldapcmp: use set instead of list to compare attrs
This will simplify the logic and improve performance.
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
commit 10855509852f8e6bc42d5410e59e76fbf2f14657
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Tue Nov 6 17:41:12 2018 +1300
netcmd/ldapcmp: fix wrong way for string copy
Two mistakes here:
- res[:-1] will copy but lost the last char
- string is immutable in python, there is no need to copy it explicitly
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
commit 2851cd5bccde53a049bbd3774911b7dc4b970467
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Mon Oct 29 17:45:28 2018 +1300
netcmd/ldapcmp: pass --skip-missing-dn to LDAPBase
This option has default value False, and was actually not passed down from cli
to LDAPBase. However, LDAPBase.__init__ has default value True for it.
After the change, a few tests using ldapcmp are affected.
Add --skip-missing-dn explicitly to keep the behavior consistent,
otherwise test will fail.
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
commit bbd082e7929010545deb5ce59e370ebe934aa23e
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Mon Oct 29 17:28:56 2018 +1300
netcmd/ldapcmp: avoid modifying data while looping on dict
Just define another dict for return value, seems no need to modify
original dict.
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
commit 047138708965d61c122dce64d57a42419e21e501
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Mon Oct 29 16:44:20 2018 +1300
netcmd/ldapcmp: rm unused global var summary
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
commit f821f84f2e9a8489dcf8842ce716546f6f8c5ff0
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Mon Oct 29 15:00:15 2018 +1300
netcmd/ldapcmp: use set instead of list to find missing DNs
This simplify the logic and improve performance a lot.
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
commit 86882bd12e506e3a7ceac4f3e9e282df55398a7f
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Mon Oct 29 10:16:02 2018 +1300
netcmd/ldapcmp: avoid list comprehension in for loop
The list comprehension will repeat for each item.
For large database, this make the command freeze.
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
commit e71d0d71203474b1b30c8c8250c28ba4889b1f20
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Mon Oct 29 12:12:38 2018 +1300
netcmd/ldapcmp: add choices arg to --view option
So we don't need to validate ourselves.
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
commit 263f02078471a29cad97889a28c02db4ea06a422
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Mon Oct 29 11:54:57 2018 +1300
netcmd/ldapcmp: add choices arg to --scope option
So we don't need to validate ourselves.
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
commit 683342b7a000f370cdc7456ce51cfb69783ced58
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Mon Oct 29 14:49:28 2018 +1300
netcmd/ldapcmp: rename __eq__ to diff
This method actually changed both objects and print info.
__eq__ is not a proper name and is not designed for this case.
Rename to diff.
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
commit 5f47c04cf3e7ef90a3521c097f60af49bd37615d
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Mon Oct 29 12:29:58 2018 +1300
netcmd/ldapcmp: fix typo for Bundle
Bundel -> Bundle
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
-----------------------------------------------------------------------
Summary of changes:
python/samba/logger.py | 7 +-
python/samba/netcmd/ldapcmp.py | 207 +++++++++++++-------------------
testprogs/blackbox/functionalprep.sh | 2 +-
testprogs/blackbox/ldapcmp_restoredc.sh | 2 +-
testprogs/blackbox/schemaupgrade.sh | 2 +-
5 files changed, 92 insertions(+), 128 deletions(-)
Changeset truncated at 500 lines:
diff --git a/python/samba/logger.py b/python/samba/logger.py
index a3db3beeec8..667c6487a51 100644
--- a/python/samba/logger.py
+++ b/python/samba/logger.py
@@ -39,7 +39,7 @@ class ColoredFormatter(logging.Formatter):
def get_samba_logger(
- name='samba', stream=sys.stderr, use_color=True,
+ name='samba', stream=sys.stderr,
level=None, verbose=False, quiet=False,
fmt=('%(levelname)s %(asctime)s pid:%(process)d '
'%(pathname)s #%(lineno)d: %(message)s'),
@@ -56,7 +56,10 @@ def get_samba_logger(
logger.setLevel(level)
- Formatter = use_color and ColoredFormatter or logging.Formatter
+ if (hasattr(stream, 'isatty') and stream.isatty()):
+ Formatter = ColoredFormatter
+ else:
+ Formatter = logging.Formatter
formatter = Formatter(fmt=fmt, datefmt=datefmt)
handler = logging.StreamHandler(stream=stream)
diff --git a/python/samba/netcmd/ldapcmp.py b/python/samba/netcmd/ldapcmp.py
index 312c8ecba0a..17c62928a55 100644
--- a/python/samba/netcmd/ldapcmp.py
+++ b/python/samba/netcmd/ldapcmp.py
@@ -37,8 +37,7 @@ from samba.netcmd import (
Option,
)
-global summary
-summary = {}
+RE_RANGED_RESULT = re.compile("^([^;]+);range=(\d+)-(\d+|\*)$")
class LDAPBase(object):
@@ -106,17 +105,14 @@ class LDAPBase(object):
res = self.ldb.search(base="OU=Domain Controllers,%s" % self.base_dn,
scope=SCOPE_SUBTREE, expression="(objectClass=computer)", attrs=["cn"])
assert len(res) > 0
- srv = []
- for x in res:
- srv.append(str(x["cn"][0]))
- return srv
+ return [str(x["cn"][0]) for x in res]
def find_netbios(self):
res = self.ldb.search(base="CN=Partitions,%s" % self.config_dn,
scope=SCOPE_SUBTREE, attrs=["nETBIOSName"])
assert len(res) > 0
for x in res:
- if "nETBIOSName" in x.keys():
+ if "nETBIOSName" in x:
return x["nETBIOSName"][0]
def object_exists(self, object_dn):
@@ -141,9 +137,7 @@ class LDAPBase(object):
It resolved ranged results e.g. member;range=0-1499
"""
- r = re.compile("^([^;]+);range=(\d+)-(\d+|\*)$")
-
- m = r.match(key)
+ m = RE_RANGED_RESULT.match(key)
if m is None:
return key
@@ -154,9 +148,7 @@ class LDAPBase(object):
It resolved ranged results e.g. member;range=0-1499
"""
- r = re.compile("^([^;]+);range=(\d+)-(\d+|\*)$")
-
- m = r.match(key)
+ m = RE_RANGED_RESULT.match(key)
if m is None:
# no range, just return the values
return vals
@@ -177,8 +169,8 @@ class LDAPBase(object):
fm = None
fvals = None
- for key in res.keys():
- m = r.match(key)
+ for key in res:
+ m = RE_RANGED_RESULT.match(key)
if m is None:
continue
@@ -211,13 +203,15 @@ class LDAPBase(object):
res = dict(res[0])
# 'Dn' element is not iterable and we have it as 'distinguishedName'
del res["dn"]
- for key in list(res.keys()):
- vals = list(res[key])
- del res[key]
+
+ attributes = {}
+ for key, vals in res.items():
name = self.get_attribute_name(key)
- res[name] = self.get_attribute_values(object_dn, key, vals)
+ # sort vals and return a list, help to compare
+ vals = sorted(vals)
+ attributes[name] = self.get_attribute_values(object_dn, key, vals)
- return res
+ return attributes
def get_descriptor_sddl(self, object_dn):
res = self.ldb.search(base=object_dn, scope=SCOPE_BASE, attrs=["nTSecurityDescriptor"])
@@ -345,10 +339,8 @@ class Descriptor(object):
common_aces = []
self_aces = []
other_aces = []
- self_dacl_list_fixed = []
- other_dacl_list_fixed = []
- [self_dacl_list_fixed.append(self.fix_sid(ace)) for ace in self.dacl_list]
- [other_dacl_list_fixed.append(other.fix_sid(ace)) for ace in other.dacl_list]
+ self_dacl_list_fixed = [self.fix_sid(ace) for ace in self.dacl_list]
+ other_dacl_list_fixed = [other.fix_sid(ace) for ace in other.dacl_list]
for ace in self_dacl_list_fixed:
try:
other_dacl_list_fixed.index(ace)
@@ -510,7 +502,7 @@ class LDAPObject(object):
self.other_attributes = ["name", "DC", ]
self.other_attributes = [x.upper() for x in self.other_attributes]
#
- self.ignore_attributes = [x.upper() for x in self.ignore_attributes]
+ self.ignore_attributes = set([x.upper() for x in self.ignore_attributes])
def log(self, msg):
"""
@@ -566,42 +558,33 @@ class LDAPObject(object):
else:
raise Exception("Unknown --view option value.")
#
- self.screen_output = res[1][:-1]
- other.screen_output = res[1][:-1]
+ self.screen_output = res[1]
+ other.screen_output = res[1]
#
return res[0]
def cmp_attrs(self, other):
res = ""
- self.unique_attrs = []
self.df_value_attrs = []
- other.unique_attrs = []
- if self.attributes.keys() != other.attributes.keys():
- #
- title = 4 * " " + "Attributes found only in %s:" % self.con.host
- for x in self.attributes.keys():
- if x not in other.attributes.keys() and \
- not x.upper() in [q.upper() for q in other.ignore_attributes]:
- if title:
- res += title + "\n"
- title = None
- res += 8 * " " + x + "\n"
- self.unique_attrs.append(x)
- #
- title = 4 * " " + "Attributes found only in %s:" % other.con.host
- for x in other.attributes.keys():
- if x not in self.attributes.keys() and \
- not x.upper() in [q.upper() for q in self.ignore_attributes]:
- if title:
- res += title + "\n"
- title = None
- res += 8 * " " + x + "\n"
- other.unique_attrs.append(x)
- #
- missing_attrs = [x.upper() for x in self.unique_attrs]
- missing_attrs += [x.upper() for x in other.unique_attrs]
+
+ self_attrs = set([attr.upper() for attr in self.attributes])
+ other_attrs = set([attr.upper() for attr in other.attributes])
+
+ self_unique_attrs = self_attrs - other_attrs - other.ignore_attributes
+ if self_unique_attrs:
+ res += 4 * " " + "Attributes found only in %s:" % self.con.host
+ for x in self_unique_attrs:
+ res += 8 * " " + x + "\n"
+
+ other_unique_attrs = other_attrs - self_attrs - self.ignore_attributes
+ if other_unique_attrs:
+ res += 4 * " " + "Attributes found only in %s:" % other.con.host
+ for x in other_unique_attrs:
+ res += 8 * " " + x + "\n"
+
+ missing_attrs = self_unique_attrs & other_unique_attrs
title = 4 * " " + "Difference in attribute values:"
- for x in self.attributes.keys():
+ for x in self.attributes:
if x.upper() in self.ignore_attributes or x.upper() in missing_attrs:
continue
if isinstance(self.attributes[x], list) and isinstance(other.attributes[x], list):
@@ -675,20 +658,20 @@ class LDAPObject(object):
res += 8 * " " + x + " => \n%s\n%s" % (self.attributes[x], other.attributes[x]) + "\n"
self.df_value_attrs.append(x)
#
- if self.unique_attrs + other.unique_attrs != []:
- assert self.unique_attrs != other.unique_attrs
- self.summary["unique_attrs"] += self.unique_attrs
+ if missing_attrs:
+ assert self_unique_attrs != other_unique_attrs
+ self.summary["unique_attrs"] += list(self_unique_attrs)
self.summary["df_value_attrs"] += self.df_value_attrs
- other.summary["unique_attrs"] += other.unique_attrs
+ other.summary["unique_attrs"] += list(other_unique_attrs)
other.summary["df_value_attrs"] += self.df_value_attrs # they are the same
#
- self.screen_output = res[:-1]
- other.screen_output = res[:-1]
+ self.screen_output = res
+ other.screen_output = res
#
return res == ""
-class LDAPBundel(object):
+class LDAPBundle(object):
def __init__(self, connection, context, dn_list=None, filter_list=None,
outf=sys.stdout, errf=sys.stderr):
@@ -713,7 +696,7 @@ class LDAPBundel(object):
self.context = context.upper()
self.dn_list = self.get_dn_list(context)
else:
- raise Exception("Unknown initialization data for LDAPBundel().")
+ raise Exception("Unknown initialization data for LDAPBundle().")
counter = 0
while counter < len(self.dn_list) and self.two_domains:
# Use alias reference
@@ -740,75 +723,61 @@ class LDAPBundel(object):
self.size = len(self.dn_list)
self.dn_list = sorted(self.dn_list)
- def __eq__(self, other):
+ def diff(self, other):
res = True
if self.size != other.size:
self.log("\n* DN lists have different size: %s != %s" % (self.size, other.size))
if not self.skip_missing_dn:
res = False
+
+ self_dns = set([q.upper() for q in self.dn_list])
+ other_dns = set([q.upper() for q in other.dn_list])
+
#
# This is the case where we want to explicitly compare two objects with different DNs.
# It does not matter if they are in the same DC, in two DC in one domain or in two
# different domains.
- if self.search_scope != SCOPE_BASE:
- title = "\n* DNs found only in %s:" % self.con.host
- for x in self.dn_list:
- if not x.upper() in [q.upper() for q in other.dn_list]:
- if title and not self.skip_missing_dn:
- self.log(title)
- title = None
- res = False
+ if self.search_scope != SCOPE_BASE and not self.skip_missing_dn:
+
+ self_only = self_dns - other_dns # missing in other
+ if self_only:
+ res = False
+ self.log("\n* DNs found only in %s:" % self.con.host)
+ for x in sorted(self_only):
self.log(4 * " " + x)
- self.dn_list[self.dn_list.index(x)] = ""
- self.dn_list = [x for x in self.dn_list if x]
- #
- title = "\n* DNs found only in %s:" % other.con.host
- for x in other.dn_list:
- if not x.upper() in [q.upper() for q in self.dn_list]:
- if title and not self.skip_missing_dn:
- self.log(title)
- title = None
- res = False
+
+ other_only = other_dns - self_dns # missing in self
+ if other_only:
+ res = False
+ self.log("\n* DNs found only in %s:" % other.con.host)
+ for x in sorted(other_only):
self.log(4 * " " + x)
- other.dn_list[other.dn_list.index(x)] = ""
- other.dn_list = [x for x in other.dn_list if x]
- #
- self.update_size()
- other.update_size()
- assert self.size == other.size
- assert sorted([x.upper() for x in self.dn_list]) == sorted([x.upper() for x in other.dn_list])
- self.log("\n* Objects to be compared: %s" % self.size)
- index = 0
- while index < self.size:
- skip = False
+ common_dns = self_dns & other_dns
+ self.log("\n* Objects to be compared: %d" % len(common_dns))
+
+ for dn in common_dns:
+
try:
object1 = LDAPObject(connection=self.con,
- dn=self.dn_list[index],
+ dn=dn,
summary=self.summary,
filter_list=self.filter_list,
outf=self.outf, errf=self.errf)
except LdbError as e:
- (enum, estr) = e.args
- if enum == ERR_NO_SUCH_OBJECT:
- self.log("\n!!! Object not found: %s" % self.dn_list[index])
- skip = True
- raise
+ self.log("LdbError for dn %s: %s" % (dn, e))
+ continue
+
try:
object2 = LDAPObject(connection=other.con,
- dn=other.dn_list[index],
+ dn=dn,
summary=other.summary,
filter_list=self.filter_list,
outf=self.outf, errf=self.errf)
- except LdbError as e1:
- (enum, estr) = e1.args
- if enum == ERR_NO_SUCH_OBJECT:
- self.log("\n!!! Object not found: %s" % other.dn_list[index])
- skip = True
- raise
- if skip:
- index += 1
+ except LdbError as e:
+ self.log("LdbError for dn %s: %s" % (dn, e))
continue
+
if object1 == object2:
if self.con.verbose:
self.log("\nComparing:")
@@ -824,8 +793,7 @@ class LDAPBundel(object):
res = False
self.summary = object1.summary
other.summary = object2.summary
- index += 1
- #
+
return res
def get_dn_list(self, context):
@@ -863,9 +831,6 @@ class LDAPBundel(object):
raise
for x in res:
dn_list.append(x["dn"].get_linearized())
- #
- global summary
- #
return dn_list
def print_summary(self):
@@ -905,13 +870,13 @@ class cmd_ldapcmp(Command):
help="Compare nTSecurityDescriptor attibutes only"),
Option("--sort-aces", dest="sort_aces", action="store_true", default=False,
help="Sort ACEs before comparison of nTSecurityDescriptor attribute"),
- Option("--view", dest="view", default="section",
+ Option("--view", dest="view", default="section", choices=["section", "collision"],
help="Display mode for nTSecurityDescriptor results. Possible values: section or collision."),
Option("--base", dest="base", default="",
help="Pass search base that will build DN list for the first DC."),
Option("--base2", dest="base2", default="",
help="Pass search base that will build DN list for the second DC. Used when --two or when compare two different DNs."),
- Option("--scope", dest="scope", default="SUB",
+ Option("--scope", dest="scope", default="SUB", choices=["SUB", "ONE", "BASE"],
help="Pass search scope that builds DN list. Options: SUB, ONE, BASE"),
Option("--filter", dest="filter", default="",
help="List of comma separated attributes to ignore in the comparision"),
@@ -964,21 +929,17 @@ class cmd_ldapcmp(Command):
raise CommandError("You cannot set --verbose and --quiet together")
if (not base and base2) or (base and not base2):
raise CommandError("You need to specify both --base and --base2 at the same time")
- if descriptor and view.upper() not in ["SECTION", "COLLISION"]:
- raise CommandError("Invalid --view value. Choose from: section or collision")
- if not scope.upper() in ["SUB", "ONE", "BASE"]:
- raise CommandError("Invalid --scope value. Choose from: SUB, ONE, BASE")
con1 = LDAPBase(URL1, creds, lp,
two=two, quiet=quiet, descriptor=descriptor, sort_aces=sort_aces,
verbose=verbose, view=view, base=base, scope=scope,
- outf=self.outf, errf=self.errf)
+ outf=self.outf, errf=self.errf, skip_missing_dn=skip_missing_dn)
assert len(con1.base_dn) > 0
con2 = LDAPBase(URL2, creds2, lp,
two=two, quiet=quiet, descriptor=descriptor, sort_aces=sort_aces,
verbose=verbose, view=view, base=base2, scope=scope,
- outf=self.outf, errf=self.errf)
+ outf=self.outf, errf=self.errf, skip_missing_dn=skip_missing_dn)
assert len(con2.base_dn) > 0
filter_list = filter.split(",")
@@ -988,12 +949,12 @@ class cmd_ldapcmp(Command):
if not quiet:
self.outf.write("\n* Comparing [%s] context...\n" % context)
- b1 = LDAPBundel(con1, context=context, filter_list=filter_list,
+ b1 = LDAPBundle(con1, context=context, filter_list=filter_list,
outf=self.outf, errf=self.errf)
- b2 = LDAPBundel(con2, context=context, filter_list=filter_list,
+ b2 = LDAPBundle(con2, context=context, filter_list=filter_list,
outf=self.outf, errf=self.errf)
- if b1 == b2:
+ if b1.diff(b2):
if not quiet:
self.outf.write("\n* Result for [%s]: SUCCESS\n" %
context)
diff --git a/testprogs/blackbox/functionalprep.sh b/testprogs/blackbox/functionalprep.sh
index 8a5eafb0966..80e82252d45 100755
--- a/testprogs/blackbox/functionalprep.sh
+++ b/testprogs/blackbox/functionalprep.sh
@@ -61,7 +61,7 @@ provision_2012r2() {
ldapcmp_ignore() {
# At some point we will need to ignore, but right now, it should be perfect
IGNORE_ATTRS=$1
- $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX_ABS/$2/private/sam.ldb tdb://$PREFIX_ABS/$3/private/sam.ldb --two
+ $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX_ABS/$2/private/sam.ldb tdb://$PREFIX_ABS/$3/private/sam.ldb --two --skip-missing-dn
}
ldapcmp() {
diff --git a/testprogs/blackbox/ldapcmp_restoredc.sh b/testprogs/blackbox/ldapcmp_restoredc.sh
index d7a51aebbf2..82804b218ca 100755
--- a/testprogs/blackbox/ldapcmp_restoredc.sh
+++ b/testprogs/blackbox/ldapcmp_restoredc.sh
@@ -59,7 +59,7 @@ ldapcmp_with_orig() {
IGNORE_ATTRS="$IGNORE_ATTRS,serverReferenceBL,msDS-IsDomainFor"
LDAPCMP_CMD="$PYTHON $BINDIR/samba-tool ldapcmp"
- $LDAPCMP_CMD $DB1_PATH $DB2_PATH --two --filter=$IGNORE_ATTRS $BASE_DN_OPTS
+ $LDAPCMP_CMD $DB1_PATH $DB2_PATH --two --skip-missing-dn --filter=$IGNORE_ATTRS $BASE_DN_OPTS
}
# check that the restored testenv DC basically matches the original
diff --git a/testprogs/blackbox/schemaupgrade.sh b/testprogs/blackbox/schemaupgrade.sh
index d04a8212454..19b71e5810e 100755
--- a/testprogs/blackbox/schemaupgrade.sh
+++ b/testprogs/blackbox/schemaupgrade.sh
@@ -50,7 +50,7 @@ ldapcmp_ignore() {
# objects, but we don't have the 2012 DisplaySpecifiers documentation...
IGNORE_ATTRS="$IGNORE_ATTRS,adminContextMenu,adminPropertyPages"
- $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX_ABS/$2_schema/private/sam.ldb tdb://$PREFIX_ABS/$3_schema/private/sam.ldb --two --filter=$IGNORE_ATTRS
+ $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX_ABS/$2_schema/private/sam.ldb tdb://$PREFIX_ABS/$3_schema/private/sam.ldb --two --filter=$IGNORE_ATTRS --skip-missing-dn
}
ldapcmp_old() {
--
Samba Shared Repository
More information about the samba-cvs
mailing list