From 71ab462c81b48169b34d60dd2bbeca137a15b702 Mon Sep 17 00:00:00 2001 From: Matthieu Patou Date: Mon, 13 Jun 2011 18:34:49 +0400 Subject: [PATCH] s4-upgradeprovision: add function to know if attribute is replicated or not --- source4/scripting/bin/upgradeprovision | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/source4/scripting/bin/upgradeprovision b/source4/scripting/bin/upgradeprovision index db425437238..a9dffc0ab58 100755 --- a/source4/scripting/bin/upgradeprovision +++ b/source4/scripting/bin/upgradeprovision @@ -117,6 +117,7 @@ hashOverwrittenAtt = { "prefixMap": replace, "systemMayContain": replace, backlinked = [] forwardlinked = set() dn_syntax_att = [] +not_replicated = [] def define_what_to_log(opts): what = 0 if opts.debugchange: @@ -238,6 +239,25 @@ def populate_links(samdb, schemadn): for t in linkedAttHash.keys(): forwardlinked.add(t) +def isReplicated(att): + """ Indicate if the attribute is replicated or not + + :param att: Name of the attribute to be tested + :return: True is the attribute is replicated, False otherwise + """ + + return (att not in not_replicated) + +def populateNotReplicated(samdb, schemadn): + """Populate an array with all the attributes that are not replicated + + :param samdb: A LDB object for sam.ldb file + :param schemadn: DN of the schema for the partition""" + res = samdb.search(expression="(&(objectclass=attributeSchema)(systemflags:1.2.840.113556.1.4.803:=1))", base=Dn(samdb, + str(schemadn)), scope=SCOPE_SUBTREE, + attrs=["lDAPDisplayName"]) + for elem in res: + not_replicated.append(elem["lDAPDisplayName"]) def populate_dnsyntax(samdb, schemadn): """Populate an array with all the attributes that have DN synthax -- 2.11.4.GIT