diff options
author | Matthias Dieter Wallnöfer <mdw@samba.org> | 2011-10-25 20:10:30 +0200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2012-03-26 00:57:29 +0200 |
commit | 438971e214e6f55f19148ed2afc03ec1c7066f65 (patch) | |
tree | fdc6cd5ce73a4da1490e3fea85d8ce39c7f6ed41 /source4/scripting/bin | |
parent | fa1c7615d0809a124109713e1b340f71d9c4594f (diff) | |
download | samba-438971e214e6f55f19148ed2afc03ec1c7066f65.tar.gz samba-438971e214e6f55f19148ed2afc03ec1c7066f65.tar.bz2 samba-438971e214e6f55f19148ed2afc03ec1c7066f65.zip |
LDB/s4 - do not use the "(dn=...)" syntax on filters anymore
Make it AD-compatible using "(distinguishedName=...)".
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/scripting/bin')
-rwxr-xr-x | source4/scripting/bin/rebuildextendeddn | 2 | ||||
-rwxr-xr-x | source4/scripting/bin/renamedc | 2 | ||||
-rwxr-xr-x | source4/scripting/bin/upgradeprovision | 23 |
3 files changed, 14 insertions, 13 deletions
diff --git a/source4/scripting/bin/rebuildextendeddn b/source4/scripting/bin/rebuildextendeddn index 5ab90c9fbd..5a0ab1295a 100755 --- a/source4/scripting/bin/rebuildextendeddn +++ b/source4/scripting/bin/rebuildextendeddn @@ -119,7 +119,7 @@ def rebuild_en_dn(credentials,session_info,paths): saveatt.append(str(res[i][att][j])) m[att] = ldb.MessageElement(saveatt, ldb.FLAG_MOD_REPLACE, att) sam_ldb.modify(m) - res3 = sam_ldb.search(expression="(&(dn=%s)(%s=*))"%(dn,att),scope=SCOPE_SUBTREE, attrs=[att],controls=["search_options:1:2"]) + res3 = sam_ldb.search(expression="(&(distinguishedName=%s)(%s=*))"%(dn,att),scope=SCOPE_SUBTREE, attrs=[att],controls=["search_options:1:2"]) if( len(res3) == 0 or (len(res3[0][att])!= len(saveatt))): print >>sys.stderr, str(dn) + " has no attr " +att+ " or a wrong value" for satt in saveatt: diff --git a/source4/scripting/bin/renamedc b/source4/scripting/bin/renamedc index 9d6f5c4c29..1fa19b25fb 100755 --- a/source4/scripting/bin/renamedc +++ b/source4/scripting/bin/renamedc @@ -114,7 +114,7 @@ if __name__ == '__main__': ldbs.sam.modify(msg) # Do a self join one more time to resync the secrets file - res = ldbs.sam.search(expression=("dn=%s" % newdn), + res = ldbs.sam.search(expression=("distinguishedName=%s" % newdn), attrs=["msDs-keyVersionNumber", "serverReferenceBL"]) assert(len(res) == 1) kvno = int(str(res[0]["msDs-keyVersionNumber"])) diff --git a/source4/scripting/bin/upgradeprovision b/source4/scripting/bin/upgradeprovision index e578c14b80..344d7f56c2 100755 --- a/source4/scripting/bin/upgradeprovision +++ b/source4/scripting/bin/upgradeprovision @@ -513,12 +513,12 @@ def handle_special_add(samdb, dn, names): "CN=WellKnown Security Principals," "CN=Configuration,%s" % names.rootdn) - res = samdb.search(expression="(dn=%s)" % oldDn, + res = samdb.search(expression="(distinguishedName=%s)" % oldDn, base=str(names.rootdn), scope=SCOPE_SUBTREE, attrs=["dn"], controls=["search_options:1:2"]) - res2 = samdb.search(expression="(dn=%s)" % dn, + res2 = samdb.search(expression="(distinguishedName=%s)" % dn, base=str(names.rootdn), scope=SCOPE_SUBTREE, attrs=["dn"], controls=["search_options:1:2"]) @@ -538,7 +538,7 @@ def handle_special_add(samdb, dn, names): if len(res) == 0: return 2 - res = samdb.search(expression="(dn=%s)" % dntoremove, + res = samdb.search(expression="(distinguishedName=%s)" % dntoremove, base=str(names.rootdn), scope=SCOPE_SUBTREE, attrs=["dn"], controls=["search_options:1:2"]) @@ -604,8 +604,9 @@ def add_missing_object(ref_samdb, samdb, dn, names, basedn, hash, index): return True - reference = ref_samdb.search(expression="dn=%s" % (str(dn)), base=basedn, - scope=SCOPE_SUBTREE, controls=["search_options:1:2"]) + reference = ref_samdb.search(expression="(distinguishedName=%s)" % (str(dn)), + base=basedn, scope=SCOPE_SUBTREE, + controls=["search_options:1:2"]) empty = Message() delta = samdb.msg_diff(empty, reference[0]) delta.dn @@ -1029,10 +1030,10 @@ def update_present(ref_samdb, samdb, basedn, listPresent, usns): if usns is not None: message(CHANGE, "Using replPropertyMetadata for change selection") for dn in listPresent: - reference = ref_samdb.search(expression="dn=%s" % (str(dn)), base=basedn, + reference = ref_samdb.search(expression="(distinguishedName=%s)" % (str(dn)), base=basedn, scope=SCOPE_SUBTREE, controls=controls) - current = samdb.search(expression="dn=%s" % (str(dn)), base=basedn, + current = samdb.search(expression="(distinguishedName=%s)" % (str(dn)), base=basedn, scope=SCOPE_SUBTREE, controls=controls) if ( @@ -1043,7 +1044,7 @@ def update_present(ref_samdb, samdb, basedn, listPresent, usns): "Renaming %s to %s" % (str(current[0].dn), str(reference[0].dn))) identic_rename(samdb, reference[0].dn) - current = samdb.search(expression="dn=%s" % (str(dn)), base=basedn, + current = samdb.search(expression="(distinguishedName=%s)" % (str(dn)), base=basedn, scope=SCOPE_SUBTREE, controls=controls) @@ -1064,7 +1065,7 @@ def update_present(ref_samdb, samdb, basedn, listPresent, usns): if nb_items > 1 and usns is not None: # Fetch the replPropertyMetaData - res = samdb.search(expression="dn=%s" % (str(dn)), base=basedn, + res = samdb.search(expression="(distinguishedName=%s)" % (str(dn)), base=basedn, scope=SCOPE_SUBTREE, controls=controls, attrs=["replPropertyMetaData"]) ctr = ndr_unpack(drsblobs.replPropertyMetaDataBlob, @@ -1361,7 +1362,7 @@ def rebuild_sd(samdb, names): return def hasATProvision(samdb): - entry = samdb.search(expression="dn=@PROVISION", base = "", + entry = samdb.search(expression="(distinguishedName=@PROVISION)", base = "", scope=SCOPE_BASE, attrs=["dn"]) @@ -1372,7 +1373,7 @@ def hasATProvision(samdb): def removeProvisionUSN(samdb): attrs = [samba.provision.LAST_PROVISION_USN_ATTRIBUTE, "dn"] - entry = samdb.search(expression="dn=@PROVISION", base = "", + entry = samdb.search(expression="(distinguishedName=@PROVISION)", base = "", scope=SCOPE_BASE, attrs=attrs) empty = Message() |