From 30c7685d65ddf05c7956f292016eec628083f6f8 Mon Sep 17 00:00:00 2001
From: Ludwig Krispenz <lkrispen@redhat.com>
Date: Wed, 24 Aug 2016 17:34:11 +0200
Subject: [PATCH] handle cases when import file cannot be generated
---
ldap/servers/slapd/back-ldbm/dblayer.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c
index c84196a..f192517 100644
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
@@ -7062,9 +7062,13 @@ error_out:
static char *
dblayer_import_file_name(ldbm_instance *inst)
{
- char *fname = slapi_ch_smprintf("%s/.import_%s",
+ char *fname = NULL;
+
+ if (inst->inst_parent_dir_name && inst->inst_dir_name) {
+ fname = slapi_ch_smprintf("%s/.import_%s",
inst->inst_parent_dir_name,
inst->inst_dir_name);
+ }
return fname;
}
@@ -7097,6 +7101,8 @@ dblayer_import_file_init(ldbm_instance *inst)
int rc = -1;
PRFileDesc *prfd = NULL;
char *fname = dblayer_import_file_name(inst);
+ if (NULL == fname) return 0;
+
rc = dblayer_file_open(fname, PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE, inst->inst_li->li_mode, &prfd);
if (prfd) {
PR_Close(prfd);
@@ -7126,6 +7132,7 @@ dblayer_import_file_update(ldbm_instance *inst)
{
PRFileDesc *prfd;
char *fname = dblayer_import_file_name(inst);
+ if (NULL == fname) return;
dblayer_file_open(fname, PR_RDWR, inst->inst_li->li_mode, &prfd);
if (prfd) {
@@ -7177,6 +7184,8 @@ dblayer_import_file_check(ldbm_instance *inst)
{
int rc;
char *fname = dblayer_import_file_name(inst);
+ if (NULL == fname) return 0;
+
rc = dblayer_file_check(fname, inst->inst_li->li_mode);
slapi_ch_free_string(&fname);
return rc;
--
2.4.3
This is a heads up, Mark found that the commit of the patch for #48402
breaks new installs with setup-ds.pl.
I don't understand why, looks like the instance dir and name are not set
in ldif2db, so I need to investigate.
Either do not use latest master or try the attached temporary patch
Sorry,
Ludwig
--
Red Hat GmbH, http://www.de.redhat.com/, Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Michael Cunningham, Michael O'Neill, Eric Shander
No comments:
Post a Comment