Bug 448269

Summary: migrate_base.pl creates extra suffix which causes error
Product: [Fedora] Fedora Reporter: Kazutoshi Morioka <morioka>
Component: migrationtoolsAssignee: Jan Safranek <jsafrane>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: 9   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-05-28 13:32:41 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Kazutoshi Morioka 2008-05-25 08:24:28 UTC
Description of problem:
When domain has components greater than two, migrate_base.pl creates extra
suffix objects.
For example, "dc=example,dc=com" was created for domain "foobar.example.com".
Another example, "dc=example,dc=co,dc=jp" and "dc=co,dc=jp" were created for
domain "foobar.example.co.jp".
These extra suffixes are not needed by slapd and cause an error when ldapadd or
slapadd.

How reproducible:
always

Steps to Reproduce:
1.export LDAP_BASEDN=foobar.example.com
2./usr/share/migrationtools/migrate_base.pl > base.ldif
3.ldapadd -f base.ldif
  
Actual results:
This extra suffix object "dc=example,dc=com" is created:

Expected results:
No extra prefix is created and all objects are created under
"dc=foobar,dc=example,dc=com".

Additional info:
I think that extra suffixes are not needed for any domain. Let's remove it
completely.
 
# diff -u /usr/share/migrationtools/migrate_base.pl.orig 
/usr/share/migrationtools/migrate_base.pl
--- /usr/share/migrationtools/migrate_base.pl.orig	2008-05-25 16:54:19.000000000
+0900
+++ /usr/share/migrationtools/migrate_base.pl	2008-05-25 16:56:56.000000000 +0900
@@ -58,14 +58,8 @@
 sub gen_suffix
 {
 	@dn_components = split(/,/, $DEFAULT_BASE);
-	if ($#dn_components == 0) {
-		$dnloc = 0;
-		&base_ldif;
-	} else {
-		for ($dnloc = ($#dn_components-1); $dnloc >= 0; $dnloc--) {
-			&base_ldif;
-		}
-	}
+	$dnloc = 0;
+	&base_ldif;
 }
 
 sub base_ldif

Comment 1 Jan Safranek 2008-05-28 13:32:41 UTC
I've sent the patch upstream some time ago:
http://bugzilla.padl.com/show_bug.cgi?id=236

Unfortunately it did not get much attention. You can nag the upstream bugzilla,
maybe it will get accepted if more users confirm that it's working.