Blob Blame History Raw
Try adding the top-level object, which may be missing, but don't worry if
the add operation fails.
diff -up MigrationTools-47/migrate_all_online.sh.patch4 MigrationTools-47/migrate_all_online.sh
--- MigrationTools-47/migrate_all_online.sh.patch4	2008-08-29 09:09:19.000000000 +0200
+++ MigrationTools-47/migrate_all_online.sh	2008-08-29 09:09:19.000000000 +0200
@@ -192,6 +192,32 @@ $PERL -I${INSTDIR} ${INSTDIR}migrate_net
 echo "Migrating netgroups (by host)..."
 $PERL -I${INSTDIR} ${INSTDIR}migrate_netgroup_byhost.pl	$ETC_NETGROUP >> $DB
 
+# Try to add the top-level object, because it's frequently missing.
+NAMINGATTRNAME=`echo $LDAP_BASEDN | cut -f1 -d=`
+NAMINGATTRVALUE=`echo $LDAP_BASEDN | cut -f1 -d, | cut -f2 -d=`
+OBJECTCLASS=
+case "$NAMINGATTRNAME" in
+	dc)         OBJECTCLASS=domain;;
+	o)          OBJECTCLASS=organization;;
+	l)          OBJECTCLASS=locality;;
+	c)          OBJECTCLASS=country;;
+	nismapname) OBJECTCLASS=nisMap;;
+	cn)         OBJECTCLASS=container;;
+esac
+
+if test -n "$NAMINGATTRNAME" ; then
+if test -n "$NAMINGATTRVALUE" ; then
+if test -n "$OBJECTCLASS" ; then
+cat << EOF | $LDAPADD -h $LDAPHOST -D "$LDAP_BINDDN" -x -w "$LDAP_BINDCRED"
+dn: $LDAP_BASEDN
+$NAMINGATTRNAME: $NAMINGATTRVALUE
+objectClass: top
+objectClass: $OBJECTCLASS
+EOF
+fi
+fi
+fi
+
 echo "Importing into LDAP..."
 
 if [ `basename $LDAPADD` = "slapadd" ]; then