summaryrefslogtreecommitdiffstats
path: root/ldap/servers/slapd/fedse.c
diff options
context:
space:
mode:
authorNoriko Hosoi <nhosoi@redhat.com>2006-09-27 23:40:52 +0000
committerNoriko Hosoi <nhosoi@redhat.com>2006-09-27 23:40:52 +0000
commit1f2f6bf58dd9e6a5064960fb334e0f022baf4ff5 (patch)
tree393103031b7a818d6983446711d8986e112d08f1 /ldap/servers/slapd/fedse.c
parent7452be8870166cd045f7c32ac934b02aa850cb1a (diff)
downloadds-1f2f6bf58dd9e6a5064960fb334e0f022baf4ff5.tar.gz
ds-1f2f6bf58dd9e6a5064960fb334e0f022baf4ff5.tar.xz
ds-1f2f6bf58dd9e6a5064960fb334e0f022baf4ff5.zip
[207427] parameterizing the hardcoded paths (Comment #15)
phase 1. parameterizing config, schema and ldif directory
Diffstat (limited to 'ldap/servers/slapd/fedse.c')
-rw-r--r--ldap/servers/slapd/fedse.c84
1 files changed, 45 insertions, 39 deletions
diff --git a/ldap/servers/slapd/fedse.c b/ldap/servers/slapd/fedse.c
index ef3034d4..9e2ef358 100644
--- a/ldap/servers/slapd/fedse.c
+++ b/ldap/servers/slapd/fedse.c
@@ -38,9 +38,9 @@
/*
* fedse.c - Front End DSE (DSA-Specific Entry) persistent storage.
*
- * The DSE store is an LDIF file contained in the file
- * INSTANCEDIR/config/dse.ldif, where INSTANCEDIR is
- * the directory of the server instance.
+ * The DSE store is an LDIF file contained in the file dse.ldif.
+ * The file is located in the directory specified with '-D'
+ * when staring the server.
*
* In core, the DSEs are stored in an AVL tree, keyed on
* DN. Whenever a modification is made to a DSE, the
@@ -1866,48 +1866,54 @@ setup_internal_backends(char *configdir)
int fedse_create_startOK(char *filename, char *startokfilename, const char *configdir)
{
- const char *config_sub_dir = "config";
- char *id = config_get_instancedir();
char *realconfigdir = NULL;
- char *dse_filename = NULL;
- char *dse_filestartOK = NULL;
- int rc = -1;
+ char *dse_filename = NULL;
+ char *dse_filestartOK = NULL;
+ int rc = -1;
- if (configdir!=NULL) {
+ if (configdir!=NULL)
+ {
realconfigdir = slapi_ch_strdup(configdir);
- } else if (id!=NULL) {
- realconfigdir = slapi_ch_smprintf("%s/%s", id, config_sub_dir);
}
- slapi_ch_free_string(&id);
+ else
+ {
+ realconfigdir = config_get_configdir();
+ }
if(realconfigdir!=NULL)
{
- /* Set the full path name for the config DSE entry */
- if (!strstr(filename, realconfigdir))
- {
- dse_filename = slapi_ch_smprintf("%s/%s", realconfigdir, filename );
- }
- else
- dse_filename = slapi_ch_strdup(filename);
+ /* Set the full path name for the config DSE entry */
+ if (!strstr(filename, realconfigdir))
+ {
+ dse_filename = slapi_ch_smprintf("%s/%s", realconfigdir, filename);
+ }
+ else
+ {
+ dse_filename = slapi_ch_strdup(filename);
+ }
- if (!strstr(startokfilename, realconfigdir)) {
- dse_filestartOK = slapi_ch_smprintf("%s/%s", realconfigdir, startokfilename );
- }
- else
- dse_filestartOK = slapi_ch_strdup(startokfilename);
-
- rc = slapi_copy(dse_filename, dse_filestartOK);
- if ( rc != 0 )
- {
- slapi_log_error( SLAPI_LOG_FATAL, "dse", "Cannot copy"
- " DSE file \"%s\" to \"%s\" OS error %d (%s)\n",
- dse_filename, dse_filestartOK,
- rc, slapd_system_strerror(rc) );
- }
-
- slapi_ch_free_string(&dse_filename);
- slapi_ch_free_string(&dse_filestartOK);
- slapi_ch_free_string(&realconfigdir);
- }
+ if (!strstr(startokfilename, realconfigdir))
+ {
+ dse_filestartOK = slapi_ch_smprintf("%s/%s",
+ realconfigdir, startokfilename);
+ }
+ else
+ {
+ dse_filestartOK = slapi_ch_strdup(startokfilename);
+ }
- return rc;
+ rc = slapi_copy(dse_filename, dse_filestartOK);
+ if ( rc != 0 )
+ {
+ slapi_log_error( SLAPI_LOG_FATAL, "dse", "Cannot copy"
+ " DSE file \"%s\" to \"%s\" OS error %d (%s)\n",
+ dse_filename, dse_filestartOK,
+ rc, slapd_system_strerror(rc) );
+ }
+
+ slapi_ch_free_string(&dse_filename);
+ slapi_ch_free_string(&dse_filestartOK);
+ slapi_ch_free_string(&realconfigdir);
+ }
+
+ return rc;
}