From 9da41b9532125bd2fad9ccf80b627264f1928716 Mon Sep 17 00:00:00 2001 From: Mark Reynolds Date: Mon, 19 Dec 2016 12:26:59 -0500 Subject: [PATCH] Ticket 49071 - Import with duplicate DNs throws unexpected errors Bug Description: When an import fails there are unable to flush error messages. Fix Description: When an import fails close the database files before deleting them. Also fixed a small issue in DSUtil where we did not properly check if an entry was valid. https://fedorahosted.org/389/ticket/49071 Reviewed by: ? --- ldap/admin/src/scripts/DSUtil.pm.in | 2 +- ldap/servers/slapd/back-ldbm/import.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ldap/admin/src/scripts/DSUtil.pm.in b/ldap/admin/src/scripts/DSUtil.pm.in index eac59a3..c972805 100644 --- a/ldap/admin/src/scripts/DSUtil.pm.in +++ b/ldap/admin/src/scripts/DSUtil.pm.in @@ -1262,7 +1262,7 @@ sub get_info { last; } } - if($foundcfg eq "yes"){ + if($foundcfg eq "yes" && $entry){ $info{cacertfile} = $entry->getValues("CACertExtractFile"); if ($info{cacertfile}) { $ENV{LDAPTLS_CACERT}=$info{cacertfile}; diff --git a/ldap/servers/slapd/back-ldbm/import.c b/ldap/servers/slapd/back-ldbm/import.c index 0512194..d0cef1a 100644 --- a/ldap/servers/slapd/back-ldbm/import.c +++ b/ldap/servers/slapd/back-ldbm/import.c @@ -1485,12 +1485,12 @@ error: } } if (0 != ret) { + dblayer_instance_close(job->inst->inst_be); if (!(job->flags & (FLAG_DRYRUN|FLAG_UPGRADEDNFORMAT_V1))) { /* If not dryrun NOR upgradedn space */ /* if running in the dry run mode, don't touch the db */ dblayer_delete_instance_dir(be); } - dblayer_instance_close(job->inst->inst_be); } else { if (0 != (ret = dblayer_instance_close(job->inst->inst_be)) ) { import_log_notice(job, SLAPI_LOG_WARNING, "import_main_offline", "Failed to close database"); -- 2.7.4