summaryrefslogtreecommitdiff
path: root/source4/scripting/bin
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2009-12-12 18:33:53 +0300
committerAndrew Bartlett <abartlet@samba.org>2009-12-15 10:04:04 +1100
commitfb85977d7c62d623997160d0c90fcb0ae83953aa (patch)
tree5a8e0064698b2c4e6440e00377c7073daf4cf27f /source4/scripting/bin
parent335731962092033d90374a785294b2fd55515310 (diff)
downloadsamba-fb85977d7c62d623997160d0c90fcb0ae83953aa.tar.gz
samba-fb85977d7c62d623997160d0c90fcb0ae83953aa.tar.bz2
samba-fb85977d7c62d623997160d0c90fcb0ae83953aa.zip
s4: upgradeprovision rename also when there is a mismatch on the case of name attribute
Renaming not only helps when name attribute is not here it also helps when the case is not the good one. So in order to avoid problem and have as much as possible similar provision we should use the rename whenever a name difference appear.
Diffstat (limited to 'source4/scripting/bin')
-rwxr-xr-xsource4/scripting/bin/upgradeprovision9
1 files changed, 7 insertions, 2 deletions
diff --git a/source4/scripting/bin/upgradeprovision b/source4/scripting/bin/upgradeprovision
index ae84c9586b..e231d08477 100755
--- a/source4/scripting/bin/upgradeprovision
+++ b/source4/scripting/bin/upgradeprovision
@@ -140,6 +140,12 @@ if setup_dir is None:
session = system_session()
+# simple helper to allow back and forth rename
+def identic_rename(ldb,dn):
+ (before,sep,after)=str(dn).partition('=')
+ ldb.rename(dn,ldb.Dn(ldb,"%s=foo%s"%(before,after)))
+ ldb.rename(ldb.Dn(ldb,"%s=foo%s"%(before,after)),dn)
+
# Create an array of backlinked attributes
def populate_backlink(newpaths,creds,session,schemadn):
newsam_ldb = Ldb(newpaths.samdb, session_info=session, credentials=creds,lp=lp)
@@ -458,8 +464,7 @@ def update_secrets(newpaths,paths,creds,session):
if att == "name":
message(CHANGE,"Found attribute name on %s, must rename the DN "%(res2[0].dn))
- secrets_ldb.rename(res2[0].dn,ldb.Dn(secrets_ldb,"%sfoo"%str(res2[0].dn)))
- secrets_ldb.rename(ldb.Dn(secrets_ldb,"%sfoo"%str(res2[0].dn)),res2[0].dn)
+ identic_rename(secrets_ldb,res[0].dn)
else:
delta.remove(att)