summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--components.mk8
-rw-r--r--include/version.h4
-rw-r--r--ldap/admin/include/dsalib.h4
-rw-r--r--ldap/admin/lib/dsalib_conf.c10
-rw-r--r--ldap/admin/lib/dsalib_location.c102
-rw-r--r--ldap/admin/lib/dsalib_updown.c426
-rw-r--r--ldap/admin/src/cfg_sspt.c8
-rw-r--r--ldap/admin/src/create_instance.c1144
-rw-r--r--ldap/admin/src/create_instance.h73
-rw-r--r--ldap/admin/src/ds_newinst.c3
-rw-r--r--ldap/admin/src/ds_newinst.pl4
-rw-r--r--ldap/admin/src/makemccvlvindexes6
-rw-r--r--ldap/cm/Makefile4
-rwxr-xr-xldap/cm/newinst/setup25
-rw-r--r--ldap/cm/newinst/ux-dialog.cc6
-rw-r--r--ldap/cm/newinst/ux-dialog.h2
-rw-r--r--ldap/docs/README.txt2
-rw-r--r--ldap/servers/plugins/Makefile11
-rw-r--r--ldap/servers/plugins/chainingdb/cb_search.c7
-rw-r--r--ldap/servers/slapd/auth.c49
-rw-r--r--ldap/servers/slapd/back-ldbm/dblayer.c1
-rw-r--r--ldap/servers/slapd/back-ldbm/ldbm_search.c2
-rw-r--r--ldap/servers/slapd/back-ldif/search.c2
-rw-r--r--ldap/servers/slapd/config.c69
-rw-r--r--ldap/servers/slapd/dse.c21
-rw-r--r--ldap/servers/slapd/fedse.c84
-rw-r--r--ldap/servers/slapd/libglobs.c54
-rw-r--r--ldap/servers/slapd/main.c364
-rw-r--r--ldap/servers/slapd/modutil.c4
-rw-r--r--ldap/servers/slapd/pblock.c2
-rw-r--r--ldap/servers/slapd/proto-slap.h3
-rw-r--r--ldap/servers/slapd/schema.c6
-rw-r--r--ldap/servers/slapd/slap.h3
-rw-r--r--ldap/servers/slapd/test-plugins/testbind.c2
-rw-r--r--ldap/servers/slapd/test-plugins/testdatainterop.c2
-rw-r--r--ldap/servers/slapd/test-plugins/testentry.c2
-rw-r--r--ldap/servers/slapd/test-plugins/testextendedop.c2
-rw-r--r--ldap/servers/slapd/test-plugins/testgetip.c2
-rw-r--r--ldap/servers/slapd/test-plugins/testpostop.c2
-rw-r--r--ldap/servers/slapd/test-plugins/testpreop.c2
-rw-r--r--ldap/servers/slapd/test-plugins/testsaslbind.c2
-rw-r--r--ldap/servers/slapd/tools/pwenc.c10
-rw-r--r--ldap/systools/idsktune.c1
-rw-r--r--nsdefs.mk4
45 files changed, 1067 insertions, 1479 deletions
diff --git a/Makefile b/Makefile
index 55552774..ec9118fa 100644
--- a/Makefile
+++ b/Makefile
@@ -360,7 +360,7 @@ fedora-ds.spec: ldapserver.spec.tmpl
-e 's/@COMPANY-PRODUCT-NAME@/Fedora Directory Server/g' \
-e 's/@LCASE-COMPANY-NAME-NOSP@/fedora/g' \
-e 's/@GEN-VERSION@/1.0/g' \
- -e 's/@NOSP-VERSION@/1.0.3/g' \
+ -e 's/@NOSP-VERSION@/1.0.4/g' \
-e 's+@COMPANY-URL@+http://directory.fedora.redhat.com/+g' \
ldapserver.spec.tmpl > $@
mv $@ $(OBJDIR)
diff --git a/components.mk b/components.mk
index 860fa088..efe62f77 100644
--- a/components.mk
+++ b/components.mk
@@ -365,8 +365,11 @@ LIBLDAP = $(addprefix $(LDAP_LIBPATH)/, $(LDAPOBJNAME))
ifeq ($(ARCH), Linux)
ifeq ($(BUILD_ARCH), RHEL3)
SASL_LIBPATH = /usr/kerberos/lib
+ SASL_LINK = -L$(SASL_LIBPATH)
else
- SASL_LIBPATH = /usr/lib
+# just use default linker path
+ SASL_LIBPATH =
+ SASL_LINK =
endif
SASL_INCDIR = /usr/include/sasl
else
@@ -377,6 +380,7 @@ else
SASL_LIBPATH = $(SASL_BUILD_DIR)/lib
SASL_INCDIR = $(SASL_BUILD_DIR)/include/sasl
endif
+ SASL_LINK = -L$(SASL_LIBPATH)
endif
SASL_INCLUDE = $(SASL_INCDIR)
@@ -403,7 +407,7 @@ else
endif
endif
- SASL_LINK = -L$(SASL_LIBPATH) -l$(SASL_LIB_ROOT_NAME) $(GSSAPI_LIBS)
+ SASL_LINK += -l$(SASL_LIB_ROOT_NAME) $(GSSAPI_LIBS)
endif
###########################################################
diff --git a/include/version.h b/include/version.h
index 73ccc7a2..80237258 100644
--- a/include/version.h
+++ b/include/version.h
@@ -44,9 +44,9 @@
exist, the PRODUCT_VERSION define has _DEF appended.
*/
-#define DIRECTORY_VERSION_DEF "1.0.3"
+#define DIRECTORY_VERSION_DEF "1.0.4"
#define DIRECTORY_COMPATIBLE "3.0"
-#define DIRECTORY_VERSION_STRING "Fedora-DirServer/1.0.3"
+#define DIRECTORY_VERSION_STRING "Fedora-DirServer/1.0.4"
#define DS_VERSION_DEF DIRECTORY_VERSION_DEF
#define DS_VERSION_STRING DIRECTORY_VERSION_STRING
diff --git a/ldap/admin/include/dsalib.h b/ldap/admin/include/dsalib.h
index 6f137cf7..02ef156a 100644
--- a/ldap/admin/include/dsalib.h
+++ b/ldap/admin/include/dsalib.h
@@ -318,10 +318,6 @@ extern DS_EXPORT_SYMBOL int ds_get_monitor(int frontend, char *port);
extern DS_EXPORT_SYMBOL int ds_get_bemonitor(char *bemdn, char *port);
extern DS_EXPORT_SYMBOL int ds_client_access(char *port, char *dn);
extern DS_EXPORT_SYMBOL char **ds_get_config(int type);
-extern DS_EXPORT_SYMBOL char *ds_get_config_dir();
-extern DS_EXPORT_SYMBOL void ds_set_config_dir(char *config_dir);
-extern DS_EXPORT_SYMBOL char *ds_get_run_dir();
-extern DS_EXPORT_SYMBOL void ds_set_run_dir(char *run_dir);
extern DS_EXPORT_SYMBOL char *ds_get_pwenc(char *passwd_hash, char *password);
extern DS_EXPORT_SYMBOL int ds_check_config(int type);
extern DS_EXPORT_SYMBOL int ds_check_pw(char *pwhash, char *pwclear);
diff --git a/ldap/admin/lib/dsalib_conf.c b/ldap/admin/lib/dsalib_conf.c
index 08961da1..58a5eb5c 100644
--- a/ldap/admin/lib/dsalib_conf.c
+++ b/ldap/admin/lib/dsalib_conf.c
@@ -51,7 +51,7 @@
#include "nspr.h"
-#define CONF_FILE_NAME "dse.ldif"
+#define CONF_FILE_NAME "config/dse.ldif"
#define CONF_SUFFIX "cn=config"
DS_EXPORT_SYMBOL char *
@@ -69,7 +69,7 @@ DS_EXPORT_SYMBOL char **
ds_get_config(int type)
{
char conffile[PATH_MAX];
- char *configdir;
+ char *root;
FILE *sf = NULL;
char **conf_list = NULL;
@@ -78,12 +78,12 @@ ds_get_config(int type)
return(NULL);
}
- if ( (configdir = ds_get_config_dir()) == NULL ) {
- ds_send_error("Cannot find configuration directory.", 0);
+ if ( (root = ds_get_install_root()) == NULL ) {
+ ds_send_error("Cannot find server root directory.", 0);
return(NULL);
}
- PR_snprintf(conffile, PATH_MAX, "%s/%s", configdir, CONF_FILE_NAME);
+ PR_snprintf(conffile, PATH_MAX, "%s/%s", root, CONF_FILE_NAME);
if ( !(sf = fopen(conffile, "r")) ) {
ds_send_error("could not read config file.", 1);
diff --git a/ldap/admin/lib/dsalib_location.c b/ldap/admin/lib/dsalib_location.c
index 87081c2b..84996495 100644
--- a/ldap/admin/lib/dsalib_location.c
+++ b/ldap/admin/lib/dsalib_location.c
@@ -58,11 +58,11 @@ ds_get_server_root()
if ( (root = getenv("NETSITE_ROOT")) == NULL )
return(NULL);
- /* WIN32: Needed to take care of embedded space, */
- /* otherwise system() call fails */
- root = ds_makeshort( root );
+ /* WIN32: Needed to take care of embedded space, */
+ /* otherwise system() call fails */
+ root = ds_makeshort( root );
- return root;
+ return root;
}
/*
@@ -87,52 +87,6 @@ ds_get_install_root()
}
/*
- * Returns the config file location of the server. Info is
- * returned in a static area. The caller must copy it
- * for reuse if needed.
- */
-DS_EXPORT_SYMBOL char *
-ds_get_config_dir()
-{
- return getenv("DS_CONFIG_DIR");
-}
-
-/*
- * set config_dir to environment variable DS_CONFIG_DIR
- * to retrieve the value using ds_get_config_dir later.
- */
-DS_EXPORT_SYMBOL void
-ds_set_config_dir(char *config_dir)
-{
- static char env[PATH_MAX];
- PR_snprintf(env, sizeof(env), "DS_CONFIG_DIR=%s", config_dir);
- putenv(env);
-}
-
-/*
- * Returns the run dir of the server, where pid files are put.
- * Info is returned in a static area. The caller must copy it
- * for reuse if needed.
- */
-DS_EXPORT_SYMBOL char *
-ds_get_run_dir()
-{
- return getenv("DS_RUN_DIR");
-}
-
-/*
- * set run_dir to environment variable DS_RUN_DIR
- * to retrieve the value using ds_get_run_dir later.
- */
-DS_EXPORT_SYMBOL void
-ds_set_run_dir(char *run_dir)
-{
- static char env[PATH_MAX];
- PR_snprintf(env, sizeof(env), "DS_RUN_DIR=%s", run_dir);
- putenv(env);
-}
-
-/*
* Returns the install location of the server under the admserv
* directory.
*/
@@ -155,50 +109,50 @@ DS_EXPORT_SYMBOL char *
ds_get_server_name()
{
if( getenv("SERVER_NAMES") )
- return( getenv("SERVER_NAMES") );
- else {
- static char logfile[PATH_MAX];
- char *buf;
- char *out = logfile;
- buf = getenv("SCRIPT_NAME");
- if ( buf && (*buf == '/') )
- buf++;
- while ( *buf && (*buf != '/') ) {
- *out++ = *buf++;
- }
- *out = 0;
- return logfile;
- }
+ return( getenv("SERVER_NAMES") );
+ else {
+ static char logfile[PATH_MAX];
+ char *buf;
+ char *out = logfile;
+ buf = getenv("SCRIPT_NAME");
+ if ( buf && (*buf == '/') )
+ buf++;
+ while ( *buf && (*buf != '/') ) {
+ *out++ = *buf++;
+ }
+ *out = 0;
+ return logfile;
+ }
}
DS_EXPORT_SYMBOL char *
ds_get_logfile_name(int config_type)
{
char *filename;
- char **ds_config = NULL;
+ char **ds_config = NULL;
static char logfile[PATH_MAX+1];
if ( (ds_config = ds_get_config(DS_REAL_CONFIG)) == NULL ) {
- /* For DS 4.0, no error output if file doesn't exist - that's
- a normal situation */
- /* ds_send_error("ds_get_config(DS_REAL_CONFIG) == NULL", 0); */
+ /* For DS 4.0, no error output if file doesn't exist - that's
+ a normal situation */
+ /* ds_send_error("ds_get_config(DS_REAL_CONFIG) == NULL", 0); */
return(NULL);
}
filename = ds_get_value(ds_config, ds_get_var_name(config_type), 0, 1);
if ( filename == NULL ) {
- /* For DS 4.0, no error output if file doesn't exist - that's
- a normal situation */
- /* ds_send_error("ds_get_logfile_name: filename == NULL", 0); */
+ /* For DS 4.0, no error output if file doesn't exist - that's
+ a normal situation */
+ /* ds_send_error("ds_get_logfile_name: filename == NULL", 0); */
return(NULL);
}
if ( ((int) strlen(filename)) >= PATH_MAX ) {
- ds_send_error("ds_get_logfile_name: filename too long", 0);
- free(filename);
+ ds_send_error("ds_get_logfile_name: filename too long", 0);
+ free(filename);
return(NULL);
}
PL_strncpyz(logfile, filename, sizeof(logfile));
- free(filename);
+ free(filename);
return(logfile);
}
diff --git a/ldap/admin/lib/dsalib_updown.c b/ldap/admin/lib/dsalib_updown.c
index d769ec4f..6c74b54a 100644
--- a/ldap/admin/lib/dsalib_updown.c
+++ b/ldap/admin/lib/dsalib_updown.c
@@ -80,44 +80,44 @@ static pid_t server_pid;
DS_EXPORT_SYMBOL int
ds_get_updown_status()
{
- char pid_file_name[BIG_LINE];
- char *rundir;
- FILE *pidfile;
- int ipid = -1;
- int status = 0;
+ char pid_file_name[BIG_LINE];
+ char *root;
+ FILE *pidfile;
+ int ipid = -1;
+ int status = 0;
- if ( (rundir = ds_get_run_dir()) == NULL ) {
- fprintf(stderr, "ds_get_updown_status: could not get install root\n");
+ if ( (root = ds_get_install_root()) == NULL ) {
+ fprintf(stderr, "ds_get_updown_status: could not get install root\n");
return(DS_SERVER_UNKNOWN);
- }
- PR_snprintf(pid_file_name, BIG_LINE, "%s/pid", rundir);
+ }
+ PR_snprintf(pid_file_name, BIG_LINE, "%s/logs/pid", root);
pidfile = fopen(pid_file_name, "r");
if ( pidfile == NULL ) {
-/*
- fprintf(stderr,
- "ds_get_updown_status: could not open pid file=%s errno=%d\n",
- pid_file_name, errno);
+/*
+ fprintf(stderr,
+ "ds_get_updown_status: could not open pid file=%s errno=%d\n",
+ pid_file_name, errno);
*/
return(DS_SERVER_DOWN);
- }
- status = fscanf(pidfile, "%d\n", &ipid);
- fclose(pidfile);
+ }
+ status = fscanf(pidfile, "%d\n", &ipid);
+ fclose(pidfile);
if ( status == -1 ) {
- fprintf(stderr,
- "ds_get_updown_status: pidfile=%s server_pid=%d errno=%d\n",
- pid_file_name, ipid, errno);
+ fprintf(stderr,
+ "ds_get_updown_status: pidfile=%s server_pid=%d errno=%d\n",
+ pid_file_name, ipid, errno);
unlink(pid_file_name); /* junk in file? */
return(DS_SERVER_DOWN);
}
server_pid = (pid_t) ipid;
if ( (status = kill(server_pid, 0)) != 0 && errno != EPERM ) {
- /* we should get ESRCH if the server is down, anything else may be
- a real problem */
- if (errno != ESRCH) {
- fprintf(stderr,
- "ds_get_updown_status: pidfile=%s server_pid=%d status=%d errno=%d\n",
- pid_file_name, server_pid, status, errno);
- }
+ /* we should get ESRCH if the server is down, anything else may be
+ a real problem */
+ if (errno != ESRCH) {
+ fprintf(stderr,
+ "ds_get_updown_status: pidfile=%s server_pid=%d status=%d errno=%d\n",
+ pid_file_name, server_pid, status, errno);
+ }
unlink(pid_file_name); /* pid does not exist! */
return(DS_SERVER_DOWN);
}
@@ -127,12 +127,12 @@ ds_get_updown_status()
DS_EXPORT_SYMBOL int
ds_get_updown_status()
{
- char *ds_name = ds_get_server_name();
+ char *ds_name = ds_get_server_name();
HANDLE hServerDoneEvent = NULL;
/* watchdog.c creates a global event of this same name */
if((hServerDoneEvent = OpenEvent(EVENT_ALL_ACCESS, TRUE, ds_name)) != NULL)
- {
+ {
CloseHandle(hServerDoneEvent);
return(DS_SERVER_UP);
}
@@ -154,17 +154,17 @@ DS_EXPORT_SYMBOL int
ds_bring_up_server_install(int verbose, char *root, char *errorlog)
{
#if !defined( XP_WIN32 )
- char startup_line[BIG_LINE];
- char statfile[PATH_MAX];
- char *tmp_dir;
+ char startup_line[BIG_LINE];
+ char statfile[PATH_MAX];
+ char *tmp_dir;
#endif
int error = -1;
- int status = DS_SERVER_DOWN;
- int cur_size = 0;
- FILE *sf = NULL;
- char msgBuf[BIG_LINE] = {0};
- int secondsToWaitForServer = 600;
- char *serverStartupString = "slapd started.";
+ int status = DS_SERVER_DOWN;
+ int cur_size = 0;
+ FILE *sf = NULL;
+ char msgBuf[BIG_LINE] = {0};
+ int secondsToWaitForServer = 600;
+ char *serverStartupString = "slapd started.";
status = ds_get_updown_status();
if ( status == DS_SERVER_UP )
@@ -173,116 +173,116 @@ ds_bring_up_server_install(int verbose, char *root, char *errorlog)
return(DS_SERVER_UNKNOWN);
if (verbose) {
- ds_send_status("starting up server ...");
- cur_size = ds_get_file_size(errorlog);
- }
+ ds_send_status("starting up server ...");
+ cur_size = ds_get_file_size(errorlog);
+ }
#if !defined( XP_WIN32 )
tmp_dir = ds_get_tmp_dir();
PR_snprintf(statfile, PATH_MAX, "%s%cstartup.%d", tmp_dir, FILE_SEP, (int)getpid());
PR_snprintf(startup_line, BIG_LINE, "%s%c%s > %s 2>&1",
- root, FILE_SEP, START_SCRIPT, statfile);
+ root, FILE_SEP, START_SCRIPT, statfile);
alter_startup_line(startup_line);
error = system(startup_line);
if (error == -1)
- error = DS_SERVER_DOWN; /* could not start server */
+ error = DS_SERVER_DOWN; /* could not start server */
else
- error = DS_SERVER_UP; /* started server */
+ error = DS_SERVER_UP; /* started server */
#else
error = StartServer();
#endif
- if (error != DS_SERVER_UP)
- {
+ if (error != DS_SERVER_UP)
+ {
#if !defined( XP_WIN32 )
- FILE* fp = fopen(statfile, "r");
- if (fp)
- {
- while(fgets(msgBuf, BIG_LINE, fp))
- ds_send_status(msgBuf);
- fclose(fp);
- }
+ FILE* fp = fopen(statfile, "r");
+ if (fp)
+ {
+ while(fgets(msgBuf, BIG_LINE, fp))
+ ds_send_status(msgBuf);
+ fclose(fp);
+ }
#endif
- return DS_SERVER_COULD_NOT_START;
- }
+ return DS_SERVER_COULD_NOT_START;
+ }
if (verbose)
{
- /*
- * Stop in N secs or whenever the startup message comes up.
- * Do whichever happens first. msgBuf will contain the last
- * line read from the errorlog.
- */
- ds_display_tail(errorlog, secondsToWaitForServer, cur_size,
- serverStartupString, msgBuf);
+ /*
+ * Stop in N secs or whenever the startup message comes up.
+ * Do whichever happens first. msgBuf will contain the last
+ * line read from the errorlog.
+ */
+ ds_display_tail(errorlog, secondsToWaitForServer, cur_size,
+ serverStartupString, msgBuf);
}
if ( error != DS_SERVER_UP ) {
- int retval = DS_SERVER_UNKNOWN;
- if (strstr(msgBuf, "semget"))
- retval = DS_SERVER_MAX_SEMAPHORES;
- else if (strstr(msgBuf, "Back-End Initialization Failed"))
- retval = DS_SERVER_CORRUPTED_DB;
- else if (strstr(msgBuf, "not initialized... exiting"))
- retval = DS_SERVER_CORRUPTED_DB;
- else if (strstr(msgBuf, "address is in use"))
- retval = DS_SERVER_PORT_IN_USE;
+ int retval = DS_SERVER_UNKNOWN;
+ if (strstr(msgBuf, "semget"))
+ retval = DS_SERVER_MAX_SEMAPHORES;
+ else if (strstr(msgBuf, "Back-End Initialization Failed"))
+ retval = DS_SERVER_CORRUPTED_DB;
+ else if (strstr(msgBuf, "not initialized... exiting"))
+ retval = DS_SERVER_CORRUPTED_DB;
+ else if (strstr(msgBuf, "address is in use"))
+ retval = DS_SERVER_PORT_IN_USE;
#if defined( XP_WIN32 )
- /* on NT, if we run out of resources, there will not even be an error
- log
- */
- else if (msgBuf[0] == 0) {
- retval = DS_SERVER_NO_RESOURCES;
- }
+ /* on NT, if we run out of resources, there will not even be an error
+ log
+ */
+ else if (msgBuf[0] == 0) {
+ retval = DS_SERVER_NO_RESOURCES;
+ }
#endif
- if (verbose)
- ds_send_error("error in starting server.", 1);
- return(retval);
+ if (verbose)
+ ds_send_error("error in starting server.", 1);
+ return(retval);
}
if (verbose) {
#if !defined( XP_WIN32 )
- if( !(sf = fopen(statfile, "r")) ) {
- ds_send_error("could not read status file.", 1);
- return(DS_SERVER_UNKNOWN);
- }
-
- while ( fgets(startup_line, BIG_LINE, sf) )
- ds_send_error(startup_line, 0);
- fclose(sf);
- unlink(statfile);
+ if( !(sf = fopen(statfile, "r")) ) {
+ ds_send_error("could not read status file.", 1);
+ return(DS_SERVER_UNKNOWN);
+ }
+
+ while ( fgets(startup_line, BIG_LINE, sf) )
+ ds_send_error(startup_line, 0);
+ fclose(sf);
+ unlink(statfile);
#endif
- status = DS_SERVER_UNKNOWN;
- if (strstr(msgBuf, "semget"))
- status = DS_SERVER_MAX_SEMAPHORES;
- else if (strstr(msgBuf, "Back-End Initialization Failed"))
- status = DS_SERVER_CORRUPTED_DB;
- else if (strstr(msgBuf, "not initialized... exiting"))
- status = DS_SERVER_CORRUPTED_DB;
- else if (strstr(msgBuf, "address is in use"))
- status = DS_SERVER_PORT_IN_USE;
+ status = DS_SERVER_UNKNOWN;
+ if (strstr(msgBuf, "semget"))
+ status = DS_SERVER_MAX_SEMAPHORES;
+ else if (strstr(msgBuf, "Back-End Initialization Failed"))
+ status = DS_SERVER_CORRUPTED_DB;
+ else if (strstr(msgBuf, "not initialized... exiting"))
+ status = DS_SERVER_CORRUPTED_DB;
+ else if (strstr(msgBuf, "address is in use"))
+ status = DS_SERVER_PORT_IN_USE;
#if defined( XP_WIN32 )
- /* on NT, if we run out of resources, there will not even be an error
- log
- */
- else if (msgBuf[0] == 0) {
- status = DS_SERVER_NO_RESOURCES;
- }
+ /* on NT, if we run out of resources, there will not even be an error
+ log
+ */
+ else if (msgBuf[0] == 0) {
+ status = DS_SERVER_NO_RESOURCES;
+ }
#endif
} else {
- int tries;
- for (tries = 0; tries < secondsToWaitForServer; tries++) {
- if (ds_get_updown_status() == DS_SERVER_UP) break;
- PR_Sleep(PR_SecondsToInterval(1));
- }
- if (verbose) {
- char str[100];
- PR_snprintf(str, sizeof(str), "Had to retry %d times", tries);
- ds_send_status(str);
- }
+ int tries;
+ for (tries = 0; tries < secondsToWaitForServer; tries++) {
+ if (ds_get_updown_status() == DS_SERVER_UP) break;
+ PR_Sleep(PR_SecondsToInterval(1));
+ }
+ if (verbose) {
+ char str[100];
+ PR_snprintf(str, sizeof(str), "Had to retry %d times", tries);
+ ds_send_status(str);
+ }
}
if ( (status == DS_SERVER_DOWN) || (status == DS_SERVER_UNKNOWN) )
- status = ds_get_updown_status();
+ status = ds_get_updown_status();
return(status);
}
@@ -300,8 +300,8 @@ DS_EXPORT_SYMBOL int
ds_bring_up_server(int verbose)
{
char *root;
- int status;
- char *errorlog;
+ int status;
+ char *errorlog;
status = ds_get_updown_status();
if ( status == DS_SERVER_UP )
return(DS_SERVER_ALREADY_UP);
@@ -310,66 +310,66 @@ ds_bring_up_server(int verbose)
errorlog = ds_get_config_value(DS_ERRORLOG);
if ( errorlog == NULL ) {
- errorlog = ds_get_errors_name(); /* fallback */
+ errorlog = ds_get_errors_name(); /* fallback */
}
- return ds_bring_up_server_install(verbose, root, errorlog);
+ return ds_bring_up_server_install(verbose, root, errorlog);
}
DS_EXPORT_SYMBOL int
ds_bring_down_server()
{
char *root;
- int status;
- int cur_size;
+ int status;
+ int cur_size;
char *errorlog;
- status = ds_get_updown_status(); /* set server_pid too! */
+ status = ds_get_updown_status(); /* set server_pid too! */
if ( status != DS_SERVER_UP ) {
- ds_send_error("The server is not up.", 0);
+ ds_send_error("The server is not up.", 0);
return(DS_SERVER_ALREADY_DOWN);
}
if ( (root = ds_get_install_root()) == NULL ) {
- ds_send_error("Could not get the server root directory.", 0);
+ ds_send_error("Could not get the server root directory.", 0);
return(DS_SERVER_UNKNOWN);
}
ds_send_status("shutting down server ...");
if (!(errorlog = ds_get_errors_name())) {
- ds_send_error("Could not get the error log filename.", 0);
- return DS_SERVER_UNKNOWN;
+ ds_send_error("Could not get the error log filename.", 0);
+ return DS_SERVER_UNKNOWN;
}
cur_size = ds_get_file_size(errorlog);
#if !defined( XP_WIN32 )
if ( (kill(server_pid, SIGTERM)) != 0) {
- if (errno == EPERM) {
- ds_send_error("Not permitted to kill server.", 0);
- fprintf (stdout, "[%s]: kill (%li, SIGTERM) failed with errno = EPERM.<br>\n",
- ds_get_server_name(), (long)server_pid);
- } else {
- ds_send_error("error in killing server.", 1);
- }
+ if (errno == EPERM) {
+ ds_send_error("Not permitted to kill server.", 0);
+ fprintf (stdout, "[%s]: kill (%li, SIGTERM) failed with errno = EPERM.<br>\n",
+ ds_get_server_name(), (long)server_pid);
+ } else {
+ ds_send_error("error in killing server.", 1);
+ }
return(DS_SERVER_UNKNOWN);
}
#else
if( StopServer() == DS_SERVER_DOWN )
- {
- ds_send_status("shutdown: server shut down");
- }
- else
- {
+ {
+ ds_send_status("shutdown: server shut down");
+ }
+ else
+ {
ds_send_error("error in killing server.", 1);
return(DS_SERVER_UNKNOWN);
- }
+ }
#endif
/*
* Wait up to SERVER_STOP_TIMEOUT seconds for the stopped message to
- * appear in the error log.
+ * appear in the error log.
*/
ds_display_tail(errorlog, SERVER_STOP_TIMEOUT, cur_size, "slapd stopped.", NULL);
/* in some cases, the server will tell us it's down when it's really not,
so give the OS a chance to remove it from the process table */
- PR_Sleep(PR_SecondsToInterval(1));
+ PR_Sleep(PR_SecondsToInterval(1));
return(ds_get_updown_status());
}
@@ -379,32 +379,32 @@ static BOOLEAN
IsService()
{
#if 0
- CHAR ServerKey[512], *ValueString;
- HKEY hServerKey;
- DWORD dwType, ValueLength, Result;
-
- PR_snprintf(ServerKey,sizeof(ServerKey), "%s\\%s", COMPANY_KEY, PRODUCT_KEY);
-
- Result = RegOpenKey(HKEY_LOCAL_MACHINE, ServerKey, &hServerKey);
- if (Result != ERROR_SUCCESS) {
- return TRUE;
- }
- ValueLength = 512;
- ValueString = (PCHAR)malloc(ValueLength);
-
- Result = RegQueryValueEx(hServerKey, IS_SERVICE_KEY, NULL,
- &dwType, ValueString, &ValueLength);
- if (Result != ERROR_SUCCESS) {
- return TRUE;
- }
- if (strcmp(ValueString, "yes")) {
- return FALSE;
- }
- else {
- return TRUE;
- }
+ CHAR ServerKey[512], *ValueString;
+ HKEY hServerKey;
+ DWORD dwType, ValueLength, Result;
+
+ PR_snprintf(ServerKey,sizeof(ServerKey), "%s\\%s", COMPANY_KEY, PRODUCT_KEY);
+
+ Result = RegOpenKey(HKEY_LOCAL_MACHINE, ServerKey, &hServerKey);
+ if (Result != ERROR_SUCCESS) {
+ return TRUE;
+ }
+ ValueLength = 512;
+ ValueString = (PCHAR)malloc(ValueLength);
+
+ Result = RegQueryValueEx(hServerKey, IS_SERVICE_KEY, NULL,
+ &dwType, ValueString, &ValueLength);
+ if (Result != ERROR_SUCCESS) {
+ return TRUE;
+ }
+ if (strcmp(ValueString, "yes")) {
+ return FALSE;
+ }
+ else {
+ return TRUE;
+ }
#else
- return TRUE;
+ return TRUE;
#endif
}
@@ -412,29 +412,29 @@ IsService()
NSAPI_PUBLIC BOOLEAN
IsAdminService()
{
- CHAR AdminKey[512], *ValueString;
- HKEY hAdminKey;
- DWORD dwType, ValueLength, Result;
-
- PR_snprintf(AdminKey,sizeof(AdminKey), "%s\\%s", COMPANY_KEY, ADMIN_REGISTRY_ROOT_KEY);
-
- Result = RegOpenKey(HKEY_LOCAL_MACHINE, AdminKey, &hAdminKey);
- if (Result != ERROR_SUCCESS) {
- return TRUE;
- }
- ValueLength = 512;
- ValueString = (PCHAR)malloc(ValueLength);
-
- Result = RegQueryValueEx(hAdminKey, IS_SERVICE_KEY, NULL,
- &dwType, ValueString, &ValueLength);
- if (Result != ERROR_SUCCESS) {
- return TRUE;
- }
- if (strcmp(ValueString, "yes")) {
- return FALSE;
- } else {
- return TRUE;
- }
+ CHAR AdminKey[512], *ValueString;
+ HKEY hAdminKey;
+ DWORD dwType, ValueLength, Result;
+
+ PR_snprintf(AdminKey,sizeof(AdminKey), "%s\\%s", COMPANY_KEY, ADMIN_REGISTRY_ROOT_KEY);
+
+ Result = RegOpenKey(HKEY_LOCAL_MACHINE, AdminKey, &hAdminKey);
+ if (Result != ERROR_SUCCESS) {
+ return TRUE;
+ }
+ ValueLength = 512;
+ ValueString = (PCHAR)malloc(ValueLength);
+
+ Result = RegQueryValueEx(hAdminKey, IS_SERVICE_KEY, NULL,
+ &dwType, ValueString, &ValueLength);
+ if (Result != ERROR_SUCCESS) {
+ return TRUE;
+ }
+ if (strcmp(ValueString, "yes")) {
+ return FALSE;
+ } else {
+ return TRUE;
+ }
}
#endif
@@ -453,7 +453,7 @@ StartServer()
NULL, // database (NULL == default)
SC_MANAGER_ALL_ACCESS // access required
))) {
- PR_snprintf(ErrorString, sizeof(ErrorString),
+ PR_snprintf(ErrorString, sizeof(ErrorString),
"Error: Could not open the ServiceControlManager:%d "
"Please restart the server %s from the Services Program Item "
"in the Control Panel", ds_get_server_name(), GetLastError());
@@ -519,7 +519,7 @@ StopServer()
"Error: Could not open the ServiceControlManager:%d "
"Please restart the server %s from the Services Program Item "
"in the Control Panel", ds_get_server_name(), GetLastError());
- ds_send_error(ErrorString, 0);
+ ds_send_error(ErrorString, 0);
return(DS_SERVER_UNKNOWN);
}
return(StopNetscapeService());
@@ -534,9 +534,9 @@ StartNetscapeProgram()
char line[BIG_LINE], cmd[BIG_LINE];
char *tmp = ds_get_install_root();
- CHAR ErrorString[512];
- STARTUPINFO siStartInfo;
- PROCESS_INFORMATION piProcInfo;
+ CHAR ErrorString[512];
+ STARTUPINFO siStartInfo;
+ PROCESS_INFORMATION piProcInfo;
FILE *CmdFile;
ZeroMemory(line, sizeof(line));
@@ -545,7 +545,7 @@ StartNetscapeProgram()
CmdFile = fopen(line, "r");
if (!CmdFile)
- {
+ {
PR_snprintf(ErrorString, sizeof(ErrorString), "Error:Tried to start server %s "
": Could not open the startup script %s :Error %d. Please "
"run startsrv.bat from the server's root directory.",
@@ -556,7 +556,7 @@ StartNetscapeProgram()
ZeroMemory(cmd, sizeof(cmd));
if (!fread(cmd, 1, BIG_LINE, CmdFile))
- {
+ {
PR_snprintf(ErrorString, sizeof(ErrorString), "Error:Tried to start server %s "
": Could not read the startup script %s :Error %d. Please "
"run startsrv.bat from the server's root directory.",
@@ -565,25 +565,25 @@ StartNetscapeProgram()
return(DS_SERVER_DOWN);
}
- ZeroMemory(&siStartInfo, sizeof(STARTUPINFO));
- siStartInfo.cb = sizeof(STARTUPINFO);
- siStartInfo.lpReserved = siStartInfo.lpReserved2 = NULL;
- siStartInfo.cbReserved2 = 0;
- siStartInfo.lpDesktop = NULL;
-
- if (!CreateProcess(NULL, cmd, NULL, NULL, FALSE,
- 0, NULL, NULL, &siStartInfo, &piProcInfo))
- {
+ ZeroMemory(&siStartInfo, sizeof(STARTUPINFO));
+ siStartInfo.cb = sizeof(STARTUPINFO);
+ siStartInfo.lpReserved = siStartInfo.lpReserved2 = NULL;
+ siStartInfo.cbReserved2 = 0;
+ siStartInfo.lpDesktop = NULL;
+
+ if (!CreateProcess(NULL, cmd, NULL, NULL, FALSE,
+ 0, NULL, NULL, &siStartInfo, &piProcInfo))
+ {
PR_snprintf(ErrorString, sizeof(ErrorString), "Error:Tried to start server %s "
": Could not start up the startup script %s :Error %d. Please "
"run startsrv.bat from the server's root directory.",
ds_get_server_name(), line, GetLastError());
ds_send_error(ErrorString, 0);
return(DS_SERVER_DOWN);
- }
+ }
- CloseHandle(piProcInfo.hProcess);
- CloseHandle(piProcInfo.hThread);
+ CloseHandle(piProcInfo.hProcess);
+ CloseHandle(piProcInfo.hThread);
return(DS_SERVER_UP);
}
@@ -596,7 +596,7 @@ StopNetscapeProgram()
hEvent = CreateEvent(NULL, TRUE, FALSE, servid);
if(!SetEvent(hEvent))
- {
+ {
PR_snprintf(ErrorString, sizeof(ErrorString), "Tried to stop existing server %s"
": Could not signal it to stop :Error %d",
servid, GetLastError());
@@ -619,7 +619,7 @@ StopNetscapeService()
schService = OpenService(schSCManager, serviceName, SERVICE_ALL_ACCESS);
if (schService == NULL)
- {
+ {
PR_snprintf(ErrorString, sizeof(ErrorString), "Tried to open service"
" %s: Error %d (%s). Please"
" stop the server from the Services Item in the Control Panel",
@@ -644,7 +644,7 @@ StopNetscapeService()
return(DS_SERVER_DOWN);
}
else if (Error != ERROR_SERVICE_NOT_ACTIVE)
- {
+ {
PR_snprintf(ErrorString, sizeof(ErrorString), "Tried to stop service"
" %s: Error %d (%s)."
" Please stop the server from the Services Item in the"
@@ -668,7 +668,7 @@ StartNetscapeService()
serviceName, // name of service
SERVICE_ALL_ACCESS);
if (schService == NULL)
- {
+ {
CloseServiceHandle(schService);
PR_snprintf(ErrorString, sizeof(ErrorString),"Tried to start"
" the service %s: Error %d. Please"
@@ -679,7 +679,7 @@ StartNetscapeService()
}
if (!StartService(schService, 0, NULL))
- {
+ {
CloseServiceHandle(schService);
PR_snprintf(ErrorString, sizeof(ErrorString), "StartService:Could not start "
"the Directory service %s: Error %d. Please restart the server "
@@ -703,7 +703,7 @@ WaitForServertoStop()
RETRY:
- newServiceName = PR_smprintf("NS_%s", serviceName);
+ newServiceName = PR_smprintf("NS_%s", serviceName);
hServDoneSemaphore = CreateSemaphore(
NULL, // security attributes
diff --git a/ldap/admin/src/cfg_sspt.c b/ldap/admin/src/cfg_sspt.c
index 239da87d..c25c7b97 100644
--- a/ldap/admin/src/cfg_sspt.c
+++ b/ldap/admin/src/cfg_sspt.c
@@ -52,7 +52,7 @@
/*#define CGI_DEBUG 1*/
-#undef TEST_CONFIG /* for testing cn=config40 dummy entry instead of real one */
+#define TEST_CONFIG /* for testing cn=config40 dummy entry instead of real one */
char* const NULLSTR = 0;
@@ -1054,7 +1054,6 @@ create_NetscapeRoot(LDAP* ld, const char *DN)
return ret;
}
-#ifdef TEST_CONFIG
static int
create_configEntry(LDAP* ld)
{
@@ -1122,7 +1121,6 @@ create_configEntry(LDAP* ld)
return ret;
}
-#endif
int
create_group(LDAP* ld, char* base, char* group)
@@ -1390,7 +1388,6 @@ write_ldap_info(SLAPD_CONFIG* slapd, char* base, char* admnm)
return ret;
}
-#ifdef TEST_CONFIG
int
config_configEntry(LDAP* connection, QUERY_VARS* query)
{
@@ -1399,7 +1396,6 @@ config_configEntry(LDAP* connection, QUERY_VARS* query)
int ret = add_aci_v (connection, value_config40DN, ACI_self_allow, NULLSTR);
return ret;
}
-#endif
int
config_suitespot(SLAPD_CONFIG* slapd, QUERY_VARS* query)
@@ -1633,13 +1629,11 @@ config_suitespot(SLAPD_CONFIG* slapd, QUERY_VARS* query)
write_ldap_info(slapd, query->suffix, query->ssAdmID);
}
-#ifdef TEST_CONFIG
if (!status && query->testconfig)
status = create_configEntry(connection);
if (!status && query->testconfig)
status = config_configEntry(connection, query);
-#endif
if (connection)
ldap_unbind (connection);
diff --git a/ldap/admin/src/create_instance.c b/ldap/admin/src/create_instance.c
index 62d89ddd..e3823f8c 100644
--- a/ldap/admin/src/create_instance.c
+++ b/ldap/admin/src/create_instance.c
@@ -82,22 +82,18 @@
#include <regparms.h>
#include <nt/ntos.h>
#define SHLIB_EXT "dll"
-
-#else /* !XP_WIN32 */
-
+#else
#define NOT_ABSOLUTE_PATH(str) (str[0] != '/')
#include <errno.h>
#include <sys/types.h>
-#include <unistd.h>
-#include <pwd.h>
-#if !defined(HPUX)
+#if !defined(HPUX) && !defined(LINUX2_0)
#include <sys/select.h> /* FD_SETSIZE */
#else
#include <sys/types.h> /* FD_SETSIZE is in types.h on HPUX */
#endif
-#if !defined(AIX)
+#if !defined(_WIN32) && !defined(AIX)
#include <sys/resource.h> /* get/setrlimit stuff */
#endif
@@ -114,7 +110,7 @@
#define SHLIB_EXT "so"
#endif
-#endif /* !XP_WIN32 */
+#endif
/*
NT doesn't strictly need these, but the libadmin API which is emulated
@@ -128,12 +124,14 @@
#include <stdarg.h>
#ifdef XP_WIN32
+
OS_TYPE NS_WINAPI INFO_GetOperatingSystem ();
DWORD NS_WINAPI SERVICE_ReinstallNTService( LPCTSTR szServiceName,
LPCTSTR szServiceDisplayName,
LPCTSTR szServiceExe );
-#endif
+
+#endif
static void ds_gen_index(FILE* f, char* belowdn);
static char *ds_gen_orgchart_conf(char *sroot, char *cs_path, server_config_s *cf);
static char *ds_gen_gw_conf(char *sroot, char *cs_path, server_config_s *cf, int conf_type);
@@ -184,6 +182,15 @@ static int needToStartServer(server_config_s *cf)
return 0;
}
+static char *
+myStrdup(const char *s)
+{
+ if (s == NULL)
+ return (char *)s;
+
+ return strdup(s);
+}
+
static int getSuiteSpotUserGroup(server_config_s* cf)
{
#ifdef XP_UNIX
@@ -241,7 +248,7 @@ void set_defaults(char *sroot, char *hn, server_config_s *conf)
{
if( (t = strchr(hn, '.')) )
*t = '\0';
- id = PR_smprintf("%s", hn);
+ id = PR_smprintf("%s", hn);
if(t)
*t = '.';
}
@@ -307,31 +314,20 @@ void set_defaults(char *sroot, char *hn, server_config_s *conf)
conf->consumerdn = NULL;
conf->disable_schema_checking = NULL;
conf->install_ldif_file = NULL;
-
- conf->sysconfdir = NULL;
- conf->datadir = NULL;
- conf->docdir = NULL;
- conf->inst_dir = NULL;
- conf->config_dir = NULL;
- conf->schema_dir = NULL;
- conf->lock_dir = NULL;
- conf->log_dir = NULL;
- conf->run_dir = NULL;
- conf->db_dir = NULL;
- conf->bak_dir = NULL;
- conf->ldif_dir = NULL;
}
+
/* ----------------- Sanity check a server configuration ------------------ */
+
char *create_instance_checkport(char *, char *);
char *create_instance_checkuser(char *);
int create_instance_numbers(char *);
-int create_instance_exists(char *fn, int type);
+int create_instance_exists(char *fn);
char *create_instance_copy(char *, char *, int);
char *create_instance_concatenate(char *, char *, int);
int create_instance_mkdir(char *, int);
-char *create_instance_mkdir_p(char *, char *, int, struct passwd *);
+char *create_instance_mkdir_p(char *, int);
#if defined( SOLARIS )
/*
@@ -423,11 +419,8 @@ contains8BitChars(const char *s)
static char *sanity_check(server_config_s *cf, char *param_name)
{
- char *t;
+ char *t, fn[PATH_SIZE];
register int x;
-#if 0
- char fn[PATH_SIZE];
-#endif
if (!param_name)
return "Parameter param_name is null";
@@ -468,7 +461,6 @@ static char *sanity_check(server_config_s *cf, char *param_name)
cf->servid[x]);
}
}
-#if 0
/* has that identifier already been used? */
PR_snprintf(fn, sizeof(fn), "%s%c%s-%s", cf->sroot, FILE_PATHSEP,
PRODUCT_NAME, cf->servid);
@@ -483,7 +475,6 @@ static char *sanity_check(server_config_s *cf, char *param_name)
}
}
*/
-#endif
#ifdef XP_UNIX
if( (t = create_instance_checkuser(cf->servuser)) )
@@ -623,7 +614,10 @@ static char *sanity_check(server_config_s *cf, char *param_name)
#ifdef XP_UNIX
-static char*
+#include <unistd.h>
+#include <pwd.h>
+
+char*
chownfile (struct passwd* pw, char* fn)
{
if (pw != NULL && chown (fn, pw->pw_uid, pw->pw_gid) == -1) {
@@ -638,14 +632,30 @@ chownfile (struct passwd* pw, char* fn)
return NULL;
}
-static char *
-chowndir(char *dir, char *user)
+char *chownlogs(char *sroot, char *user)
+{
+ struct passwd *pw;
+ char fn[PATH_SIZE];
+ if(user && *user && !geteuid()) {
+ if(!(pw = getpwnam(user)))
+ return make_error("Could not find UID and GID of user '%s'.",
+ user);
+ PR_snprintf(fn, sizeof(fn), "%s%clogs", sroot, FILE_PATHSEP);
+ return chownfile (pw, fn);
+ }
+ return NULL;
+}
+
+char *chownconfig(char *sroot, char *user)
{
struct passwd *pw;
- if (dir && *dir && user && *user && !geteuid()) {
+ char fn[PATH_SIZE];
+ if(user && *user && !geteuid()) {
if(!(pw = getpwnam(user)))
- return make_error("Could not find UID and GID of user '%s'.", user);
- return chownfile (pw, dir);
+ return make_error("Could not find UID and GID of user '%s'.",
+ user);
+ PR_snprintf(fn, sizeof(fn), "%s%cconfig", sroot, FILE_PATHSEP);
+ return chownfile (pw, fn);
}
return NULL;
}
@@ -653,7 +663,8 @@ chowndir(char *dir, char *user)
#else
#define chownfile(a, b)
-#define chowndir(a, b)
+#define chownlogs(a, b)
+#define chownconfig(a, b)
#define chownsearch(a, b)
#endif
@@ -729,10 +740,10 @@ char *gen_perl_script(char *s_root, char *cs_path, char *name, char *fmt, ...)
FILE *f;
va_list args;
- if (PR_FAILURE == PR_Access(cs_path, PR_ACCESS_EXISTS)) {
- printf("Notice: %s does not exist, skipping %s . . .\n", cs_path, name);
- return NULL;
- }
+ if (PR_FAILURE == PR_Access(cs_path, PR_ACCESS_EXISTS)) {
+ printf("Notice: %s does not exist, skipping %s . . .\n", cs_path, name);
+ return NULL;
+ }
PR_snprintf(fn, sizeof(fn), "%s%c%s", cs_path, FILE_PATHSEP, name);
PR_snprintf(myperl, sizeof(myperl), "%s%cbin%cslapd%cadmin%cbin%cperl",
@@ -764,10 +775,10 @@ char *gen_perl_script_auto(char *s_root, char *cs_path, char *name,
char fn[PATH_SIZE], ofn[PATH_SIZE];
const char *table[10][2];
- if (PR_FAILURE == PR_Access(cs_path, PR_ACCESS_EXISTS)) {
- printf("Notice: %s does not exist, skipping %s . . .\n", cs_path, name);
- return NULL;
- }
+ if (PR_FAILURE == PR_Access(cs_path, PR_ACCESS_EXISTS)) {
+ printf("Notice: %s does not exist, skipping %s . . .\n", cs_path, name);
+ return NULL;
+ }
PR_snprintf(ofn, sizeof(ofn), "%s%cbin%cslapd%cadmin%cscripts%ctemplate-%s", s_root,
FILE_PATHSEP, FILE_PATHSEP, FILE_PATHSEP, FILE_PATHSEP,
@@ -778,7 +789,7 @@ char *gen_perl_script_auto(char *s_root, char *cs_path, char *name,
s_root, FILE_PATHSEP, FILE_PATHSEP,
FILE_PATHSEP, FILE_PATHSEP, FILE_PATHSEP);
#else
- strcpy(myperl, "!/usr/bin/env perl");
+ strcpy(myperl, "!/usr/bin/env perl");
#endif
table[0][0] = "DS-ROOT";
@@ -829,7 +840,7 @@ char *gen_perl_script_auto_for_migration(char *s_root, char *cs_path, char *name
s_root, FILE_PATHSEP, FILE_PATHSEP,
FILE_PATHSEP, FILE_PATHSEP, FILE_PATHSEP);
#else
- strcpy(myperl, "!/usr/bin/env perl");
+ strcpy(myperl, "!/usr/bin/env perl");
#endif
table[0][0] = "DS-ROOT";
@@ -1072,8 +1083,8 @@ create_scripts(server_config_s *cf, char *param_name)
char subdir[PATH_SIZE];
/* Create slapd-nickname directory */
- PR_snprintf(subdir, sizeof(subdir), "%s%c"PRODUCT_NAME"-%s",
- sroot, FILE_PATHSEP, cf->servid);
+ PR_snprintf(subdir, sizeof(subdir), "%s%c"PRODUCT_NAME"-%s", sroot, FILE_PATHSEP,
+ cf->servid);
#ifdef XP_UNIX
/* Start/stop/rotate/restart scripts */
if (getenv("USE_DEBUGGER"))
@@ -1081,17 +1092,17 @@ create_scripts(server_config_s *cf, char *param_name)
char *debugger = getenv("DSINST_DEBUGGER");
char *debugger_command = getenv("DSINST_DEBUGGER_CMD");
if (! debugger) {
- debugger = "gdb";
+ debugger = "/tools/ns/workshop/bin/dbx";
}
if (! debugger_command) {
debugger_command = "echo"; /* e.g. do nothing */
}
#ifdef OSF1
- printf("-D %s -i %s/pid -d %s -z\n", cf->config_dir, cf->run_dir,
+ printf("-D %s -i %s/logs/pid -d %s -z\n", subdir, subdir,
cf->loglevel ? cf->loglevel : "0");
- t = gen_script(cf->inst_dir, START_SCRIPT,
+ t = gen_script(subdir, START_SCRIPT,
"\n"
- "# Script that starts the %s.\n"
+ "# Script that starts the ns-slapd server.\n"
"# Exit status can be:\n"
"# 0: Server started successfully\n"
"# 1: Server could not be started\n"
@@ -1099,19 +1110,17 @@ create_scripts(server_config_s *cf, char *param_name)
"\n"
"NETSITE_ROOT=%s\n"
"export NETSITE_ROOT\n"
- "%s=%s\n"
- "export %s\n"
- "PIDFILE=%s/pid\n"
+ "PIDFILE=%s/logs/pid\n"
"if test -f $PIDFILE ; then\n"
" PID=`cat $PIDFILE`\n"
" if kill -0 $PID > /dev/null 2>&1 ; then\n"
- " echo There is an %s process already running: $PID\n"
+ " echo There is an ns-slapd process already running: $PID\n"
" exit 2;\n"
" else\n"
" rm -f $PIDFILE\n"
" fi\n"
"fi\n"
- "cd %s; ./%s -D %s -i %s/pid -d %s -z \"$@\" &\n"
+ "cd %s/bin/%s/server; ./%s -D %s -i %s/logs/pid -d %s -z \"$@\" &\n"
"loop_counter=1\n"
"max_count=120\n"
"while test $loop_counter -le $max_count; do\n"
@@ -1120,21 +1129,19 @@ create_scripts(server_config_s *cf, char *param_name)
" sleep 1;\n"
" else\n"
" PID=`cat $PIDFILE`\n"
- /* rbyrne: setuputil takes any message here as an error:
- " echo Server has been started. ns-slapd process started: $PID\n"*/
+ /* rbyrne: setuputil takes any message here as an error:
+ " echo Server has been started. ns-slapd process started: $PID\n"*/
" exit 0;\n"
" fi\n"
"done\n"
"echo Server not running!! Failed to start ns-slapd process.\n"
"exit 1\n",
- PRODUCT_BIN,
- sroot, DS_CONFIG_DIR, cf->config_dir, DS_CONFIG_DIR, cf->run_dir,
- PRODUCT_BIN,
- sroot, PRODUCT_BIN, cf->config_dir, cf->run_dir,
- cf->loglevel ? cf->loglevel : "0"
+ sroot, subdir, sroot, PRODUCT_NAME, PRODUCT_BIN, subdir,
+ subdir,
+ cf->loglevel ? cf->loglevel : "0"
);
#else
- t = gen_script(cf->inst_dir, START_SCRIPT,
+ t = gen_script(subdir, START_SCRIPT,
"\n"
"# Script that starts the ns-slapd server.\n"
"# Exit status can be:\n"
@@ -1144,9 +1151,7 @@ create_scripts(server_config_s *cf, char *param_name)
"\n"
"NETSITE_ROOT=%s\n"
"export NETSITE_ROOT\n"
- "%s=%s\n"
- "export %s\n"
- "PIDFILE=%s/pid\n"
+ "PIDFILE=%s/logs/pid\n"
"if test -f $PIDFILE ; then\n"
" PID=`cat $PIDFILE`\n"
" if kill -0 $PID > /dev/null 2>&1 ; then\n"
@@ -1156,12 +1161,12 @@ create_scripts(server_config_s *cf, char *param_name)
" rm -f $PIDFILE\n"
" fi\n"
"fi\n"
- "if [ -x /usr/bin/xterm ]; then\n"
- " xterm=/usr/bin/xterm\n"
+ "if [ -x /usr/local/bin/xterm ]; then\n"
+ " xterm=/usr/local/bin/xterm\n"
"else\n"
" xterm=/usr/openwin/bin/xterm\n"
"fi\n"
- "cd %s; $xterm -title debugger -e %s -c \"dbxenv follow_fork_mode child ; break main ; %s ; run -D %s -i %s/pid -d %s -z $*\" %s &\n"
+ "cd %s/bin/%s/server; $xterm -title debugger -e %s -c \"dbxenv follow_fork_mode child ; stop in main ; %s ; run -D %s -i %s/logs/pid -d %s -z $*\" %s &\n"
"loop_counter=1\n"
"max_count=120\n"
"while test $loop_counter -le $max_count; do\n"
@@ -1177,15 +1182,15 @@ create_scripts(server_config_s *cf, char *param_name)
"done\n"
"echo Server not running!! Failed to start ns-slapd process.\n"
"exit 1\n",
- sroot, DS_CONFIG_DIR, cf->config_dir, DS_CONFIG_DIR, cf->run_dir,
- sroot, debugger, debugger_command, cf->config_dir, cf->run_dir,
- cf->loglevel ? cf->loglevel : "0", PRODUCT_BIN
+ sroot, subdir, sroot, PRODUCT_NAME, debugger, debugger_command,
+ subdir,
+ subdir, cf->loglevel ? cf->loglevel : "0", PRODUCT_BIN
);
#endif
}
else
{
- t = gen_script(cf->inst_dir, START_SCRIPT,
+ t = gen_script(subdir, START_SCRIPT,
"\n"
"# Script that starts the ns-slapd server.\n"
"# Exit status can be:\n"
@@ -1195,14 +1200,12 @@ create_scripts(server_config_s *cf, char *param_name)
"\n"
"NETSITE_ROOT=%s\n"
"export NETSITE_ROOT\n"
- "%s=%s\n"
- "export %s\n"
- "PIDFILE=%s/pid\n"
- "STARTPIDFILE=%s/startpid\n"
+ "PIDFILE=%s/logs/pid\n"
+ "STARTPIDFILE=%s/logs/startpid\n"
"if test -f $STARTPIDFILE ; then\n"
" PID=`cat $STARTPIDFILE`\n"
" if kill -0 $PID > /dev/null 2>&1 ; then\n"
- " echo There is an %s process already running: $PID\n"
+ " echo There is an ns-slapd process already running: $PID\n"
" exit 2;\n"
" else\n"
" rm -f $STARTPIDFILE\n"
@@ -1211,17 +1214,13 @@ create_scripts(server_config_s *cf, char *param_name)
"if test -f $PIDFILE ; then\n"
" PID=`cat $PIDFILE`\n"
" if kill -0 $PID > /dev/null 2>&1 ; then\n"
- " echo There is an %s running: $PID\n"
+ " echo There is an ns-slapd process already running: $PID\n"
" exit 2;\n"
" else\n"
" rm -f $PIDFILE\n"
" fi\n"
"fi\n"
-#if 0
- "cd %s; ./%s -D %s -i %s/pid -w $STARTPIDFILE \"$@\"\n"
-#else /* will go away */
- "cd %s/bin/slapd/server; ./%s -D %s -i %s/pid -w $STARTPIDFILE \"$@\"\n"
-#endif
+ "cd %s/bin/%s/server; ./%s -D %s -i %s/logs/pid -w $STARTPIDFILE \"$@\"\n"
"if [ $? -ne 0 ]; then\n"
" exit 1\n"
"fi\n"
@@ -1262,14 +1261,13 @@ create_scripts(server_config_s *cf, char *param_name)
"done\n"
"echo Server not running!! Failed to start ns-slapd process. Please check the errors log for problems.\n"
"exit 1\n",
- sroot, DS_CONFIG_DIR, cf->config_dir, DS_CONFIG_DIR, cf->run_dir,
- cf->run_dir, PRODUCT_BIN, PRODUCT_BIN,
- sroot, PRODUCT_BIN, cf->config_dir, cf->run_dir
+ sroot, subdir, subdir, sroot, PRODUCT_NAME, PRODUCT_BIN, subdir,
+ subdir
);
}
if(t) return t;
- t = gen_script(cf->inst_dir, STOP_SCRIPT,
+ t = gen_script(subdir, STOP_SCRIPT,
"\n"
"# Script that stops the ns-slapd server.\n"
"# Exit status can be:\n"
@@ -1277,7 +1275,7 @@ create_scripts(server_config_s *cf, char *param_name)
"# 1: Server could not be stopped\n"
"# 2: Server was not running\n"
"\n"
- "PIDFILE=%s/pid\n"
+ "PIDFILE=%s/logs/pid\n"
"if test ! -f $PIDFILE ; then\n"
" echo No ns-slapd PID file found. Server is probably not running\n"
" exit 2\n"
@@ -1304,8 +1302,8 @@ create_scripts(server_config_s *cf, char *param_name)
" if test -f $PIDFILE ; then\n"
" rm -f $PIDFILE\n"
" fi\n"
- /* rbyrne: setuputil takes any message here as an error:
- " echo Server has been stopped. ns-slapd process stopped: $PID\n"*/
+ /* rbyrne: setuputil takes any message here as an error:
+ " echo Server has been stopped. ns-slapd process stopped: $PID\n"*/
" exit 0\n"
" fi\n"
"done\n"
@@ -1313,10 +1311,10 @@ create_scripts(server_config_s *cf, char *param_name)
" echo Server still running!! Failed to stop the ns-slapd process: $PID. Please check the errors log for problems.\n"
"fi\n"
"exit 1\n",
- cf->run_dir);
+ subdir);
if(t) return t;
- t = gen_script(cf->inst_dir, RESTART_SCRIPT,
+ t = gen_script(subdir, RESTART_SCRIPT,
"\n"
"# Script that restarts the ns-slapd server.\n"
"# Exit status can be:\n"
@@ -1341,9 +1339,17 @@ create_scripts(server_config_s *cf, char *param_name)
" exit 2;\n"
"fi\n"
"exit $status\n",
- cf->inst_dir, cf->inst_dir );
+ subdir, subdir );
if(t) return t;
+ /* logs subdir owned by server user */
+ if( (t = chownlogs(subdir, cf->servuser)) )
+ return t;
+
+ /* config subdir owned by server user */
+ if( (t = chownconfig(subdir, cf->servuser)) )
+ return t;
+
#else /* XP_WIN32 */
/* Windows platforms have some extra setup */
if( (t = setup_ntserver(cf)) )
@@ -1370,7 +1376,7 @@ create_scripts(server_config_s *cf, char *param_name)
int update_server(server_config_s *cf)
{
char *t;
- char error_param[BIG_LINE] = {0};
+ char error_param[BIG_LINE] = {0};
#if defined( SOLARIS )
/*
@@ -1403,35 +1409,31 @@ int update_server(server_config_s *cf)
out:
if(t)
- {
- char *msg;
- if (error_param[0])
- {
- msg = PR_smprintf("%s.error:could not update server %s - %s",
- error_param, cf->servid, t);
- }
- else
- {
- msg = PR_smprintf("error:could not update server %s - %s",
- cf->servid, t);
- }
- ds_show_message(msg);
- PR_smprintf_free(msg);
- return 1;
- }
- else
- return 0;
+ {
+ char *msg;
+ if (error_param[0])
+ {
+ msg = PR_smprintf("%s.error:could not update server %s - %s",
+ error_param, cf->servid, t);
+ }
+ else
+ {
+ msg = PR_smprintf("error:could not update server %s - %s",
+ cf->servid, t);
+ }
+ ds_show_message(msg);
+ PR_smprintf_free(msg);
+ return 1;
+ }
+ else
+ return 0;
}
/* ---------------------- Create configuration files ---------------------- */
char *create_server(server_config_s *cf, char *param_name)
{
-#if 0
- char line[PATH_SIZE]
+ char line[PATH_SIZE], *t, *sroot = cf->sroot;
char subdir[PATH_SIZE];
-#endif
- char *t, *sroot = cf->sroot;
- struct passwd *pw = getpwnam(cf->servuser);
#if defined( SOLARIS )
/*
@@ -1460,49 +1462,39 @@ char *create_server(server_config_s *cf, char *param_name)
if( (t = sanity_check(cf, param_name)) )
return t;
- /* Create slapd-nickname directory (instance directory) */
- if( (create_instance_mkdir_p("inst dir", cf->inst_dir, NEWDIR_MODE, pw)) )
- return make_error("make inst dir %s failed (%s)",
- cf->inst_dir, ds_system_errmsg());
+ /* Create slapd-nickname directory */
+ PR_snprintf(subdir, sizeof(subdir), "%s%c"PRODUCT_NAME"-%s", sroot, FILE_PATHSEP,
+ cf->servid);
+ if( (create_instance_mkdir(subdir, NEWDIR_MODE)) )
+ return make_error("mkdir %s failed (%s)", subdir, ds_system_errmsg());
- /* Create config directory */
- if( (create_instance_mkdir_p("config dir", cf->config_dir, NEWDIR_MODE, pw)) )
- return make_error("make config dir %s failed (%s)",
- cf->config_dir, ds_system_errmsg());
+ /* Create slapd-nickname/config directory */
+ PR_snprintf(line, sizeof(line), "%s%cconfig", subdir, FILE_PATHSEP);
+ if( (create_instance_mkdir(line, NEWDIR_MODE)) )
+ return make_error("mkdir %s failed (%s)", line, ds_system_errmsg());
- /* Create config_dir/schema directory */
- if( (create_instance_mkdir_p("schema dir", cf->schema_dir, NEWDIR_MODE, pw)) )
- return make_error("make schema dir %s failed (%s)",
- cf->schema_dir, ds_system_errmsg());
+ /* Create slapd-nickname/config/schema directory */
+ PR_snprintf(line, sizeof(line), "%s%cconfig%cschema", subdir, FILE_PATHSEP, FILE_PATHSEP);
+ if( (create_instance_mkdir(line, NEWDIR_MODE)) )
+ return make_error("mkdir %s failed (%s)", line, ds_system_errmsg());
#if defined (BUILD_PRESENCE)
- /* Create config_dir/presence directory */
- PR_snprintf(line, sizeof(line), "%s%cpresence",
- cf->config_dir, FILE_PATHSEP);
+ /* Create slapd-nickname/config/presence directory */
+ PR_snprintf(line, sizeof(line), "%s%cconfig%cpresence", subdir, FILE_PATHSEP, FILE_PATHSEP);
if( (create_instance_mkdir(line, NEWDIR_MODE)) )
return make_error("mkdir %s failed (%s)", line, ds_system_errmsg());
#endif
- /* Create log directory */
- if( (create_instance_mkdir_p("log dir", cf->log_dir, NEWSECDIR_MODE, pw)) )
- return make_error("make log dir %s failed (%s)",
- cf->log_dir, ds_system_errmsg());
-
- /* Create lock directory */
- if( (create_instance_mkdir_p("lock dir", cf->lock_dir, NEWSECDIR_MODE, pw)) )
- return make_error("make lock dir %s failed (%s)",
- cf->lock_dir, ds_system_errmsg());
-
- /* Create run directory */
- if( (create_instance_mkdir_p("run dir", cf->run_dir, NEWSECDIR_MODE, pw)) )
- return make_error("make run dir %s failed (%s)",
- cf->run_dir, ds_system_errmsg());
-# if 0
+ /* Create slapd-nickname/logs directory */
+ PR_snprintf(line, sizeof(line), "%s%clogs", subdir, FILE_PATHSEP);
+ if( (create_instance_mkdir(line, NEWSECDIR_MODE)) )
+ return make_error("mkdir %s failed (%s)", line, ds_system_errmsg());
+
/* Create httpacl directory */
PR_snprintf(line, sizeof(line), "%s%chttpacl", cf->sroot, FILE_PATHSEP);
if( (create_instance_mkdir(line, NEWDIR_MODE)) )
return make_error("mkdir %s failed (%s)", line, ds_system_errmsg());
-#endif
+
t = create_scripts(cf, param_name);
if(t) return t;
@@ -1522,8 +1514,12 @@ char *create_server(server_config_s *cf, char *param_name)
return NULL;
}
+
+
+
/* ------------------------- Copied from libadmin ------------------------- */
+
/*
These replace the versions in libadmin to allow error returns.
@@ -1532,53 +1528,20 @@ char *create_server(server_config_s *cf, char *param_name)
*/
-/*
- * input:
- * fn: file/dir name
- * type:
- * if you don't care of the file type, 0
- * if file, PR_FILE_FILE
- * if directory, PR_FILE_DIRECTORY
- * else, PR_FILE_OTHER
- *
- * return value:
- * 0: does not exist
- * 1: exists
- * -1: exists, but unexpected type
- */
-int
-create_instance_exists(char *fn, int type)
+int create_instance_exists(char *fn)
{
- PRFileInfo finfo;
-
- if(PR_GetFileInfo(fn, &finfo) == PR_FAILURE)
- return 0; /* does not exist */
- else {
- if (type > 0) {
- if (type == finfo.type) {
- return 1;
- } else {
- return -1;
- }
- } else {
- return 1;
- }
- }
+ struct stat finfo;
+
+ if(stat(fn, &finfo) < 0)
+ return 0;
+ else
+ return 1;
}
-int
-create_instance_mkdir(char *dir, int mode)
+int create_instance_mkdir(char *dir, int mode)
{
- int rv = 0;
- if (NULL == dir)
- return -1;
- rv = create_instance_exists(dir, PR_FILE_DIRECTORY);
- if (rv < 0) { /* not a directory */
- PR_Delete(dir);
- rv = 0;
- }
- if(0 == rv) { /* dir does not exist */
+ if(!create_instance_exists(dir)) {
#ifdef XP_UNIX
if(mkdir(dir, mode) == -1)
#else /* XP_WIN32 */
@@ -1590,18 +1553,12 @@ create_instance_mkdir(char *dir, int mode)
}
-char *create_instance_mkdir_p(char *str, char *dir, int mode, struct passwd *pw)
+char *create_instance_mkdir_p(char *dir, int mode)
{
static char errmsg[ERR_SIZE];
struct stat fi;
char *t;
- if (NULL == dir) {
- PR_snprintf(errmsg, sizeof(errmsg), "NULL is passed to make \"%s\"",
- str?str:"unknown");
- return errmsg;
- }
-
#ifdef XP_UNIX
t = dir + 1;
#else /* XP_WIN32 */
@@ -1614,11 +1571,9 @@ char *create_instance_mkdir_p(char *str, char *dir, int mode, struct passwd *pw)
if(t) *t = '\0';
if(stat(dir, &fi) == -1) {
if(create_instance_mkdir(dir, mode) == -1) {
- PR_snprintf(errmsg, sizeof(errmsg), "mkdir %s for \"%s\" failed (%s)", dir, str, ds_system_errmsg());
+ PR_snprintf(errmsg, sizeof(errmsg), "mkdir %s failed (%s)", dir, ds_system_errmsg());
return errmsg;
}
- if (pw)
- chownfile(pw, dir);
}
if(t)
{
@@ -1937,7 +1892,7 @@ ds_copy_group_files_using_mode(char *src_dir, char *dest_dir,
if(is_a_dir(src_dir, d->name)) {
char *sub_src_dir = strdup(src_file);
char *sub_dest_dir = strdup(dest_file);
- if( (t = create_instance_mkdir_p(sub_dest_dir, sub_dest_dir, NEWDIR_MODE, NULL)) )
+ if( (t = create_instance_mkdir_p(sub_dest_dir, NEWDIR_MODE)) )
return(t);
if( (t = ds_copy_group_files_using_mode(sub_src_dir, sub_dest_dir, filter, use_mode)) )
return t;
@@ -1994,49 +1949,54 @@ void fputs_escaped(char *s, FILE *fp)
/* ------------- Create config files for Directory Server -------------- */
-static char *
-ds_cre_subdirs(server_config_s *cf, struct passwd* pw)
+char *ds_cre_subdirs(char *sroot, server_config_s *cf, char *cs_path,
+ struct passwd* pw)
{
char subdir[PATH_SIZE], *t = NULL;
- /* create db dir */
- if( (t = create_instance_mkdir_p("db dir", cf->db_dir, NEWDIR_MODE, pw)) )
+ /* create subdir <a_server>/db */
+ PR_snprintf(subdir, sizeof(subdir), "%s%cdb", cs_path, FILE_PATHSEP);
+ if( (t = create_instance_mkdir_p(subdir, NEWDIR_MODE)) )
return(t);
+ chownfile (pw, subdir);
- /* create ldif dir */
- if( (t = create_instance_mkdir_p("ldif dir", cf->ldif_dir, NEWDIR_MODE, pw)) )
+ /* create subdir <a_server>/ldif */
+ PR_snprintf(subdir, sizeof(subdir), "%s%cldif", cs_path, FILE_PATHSEP);
+ if( (t = create_instance_mkdir_p(subdir, NEWDIR_MODE)) )
return(t);
+ chownfile (pw, subdir);
-#ifdef DSML
/* create subdir <a_server>/dsml */
PR_snprintf(subdir, sizeof(subdir), "%s%cdsml", cs_path, FILE_PATHSEP);
- if( (t = create_instance_mkdir_p("dsml dir", subdir, NEWDIR_MODE, pw)) )
+ if( (t = create_instance_mkdir_p(subdir, NEWDIR_MODE)) )
return(t);
-#endif
- /* create bak dir */
- if( (t = create_instance_mkdir_p("backup dir", cf->bak_dir, NEWDIR_MODE, pw)) )
+ chownfile (pw, subdir);
+
+ /* create subdir <a_server>/bak */
+ PR_snprintf(subdir, sizeof(subdir), "%s%cbak", cs_path, FILE_PATHSEP);
+ if( (t = create_instance_mkdir_p(subdir, NEWDIR_MODE)) )
return(t);
+ chownfile (pw, subdir);
/* Create slapd-nickname/confbak directory */
- PR_snprintf(subdir, sizeof(subdir), "%s%cconfbak", cf->config_dir, FILE_PATHSEP);
- if( (t=create_instance_mkdir_p("config bak dir", subdir, NEWDIR_MODE, pw)) )
+ PR_snprintf(subdir, sizeof(subdir), "%s%cconfbak", cs_path, FILE_PATHSEP);
+ if( (t=create_instance_mkdir_p(subdir, NEWDIR_MODE)) )
return(t);
+ chownfile (pw, subdir);
-#ifdef DSGW
/* create subdir <server_root>/dsgw/context */
PR_snprintf(subdir, sizeof(subdir), "%s%cclients", sroot, FILE_PATHSEP);
if (is_a_dir(subdir, "dsgw")) { /* only create dsgw stuff if we are installing it */
PR_snprintf(subdir, sizeof(subdir), "%s%cclients%cdsgw%ccontext", sroot, FILE_PATHSEP,FILE_PATHSEP,FILE_PATHSEP);
- if( (t = create_instance_mkdir_p("dsgw context dir", subdir, NEWDIR_MODE, pw)) )
+ if( (t = create_instance_mkdir_p(subdir, NEWDIR_MODE)) )
return(t);
}
/* create subdir <server_root>/bin/slapd/authck */
- /* dsgw cookie dir */
PR_snprintf(subdir, sizeof(subdir), "%s%cbin%cslapd%cauthck", sroot, FILE_PATHSEP, FILE_PATHSEP, FILE_PATHSEP);
- if( (t = create_instance_mkdir_p("authck dir", subdir, NEWDIR_MODE, pw)) )
+ if( (t = create_instance_mkdir_p(subdir, NEWDIR_MODE)) )
return(t);
-#endif
+ chownfile (pw, subdir);
return (t);
}
@@ -2059,9 +2019,8 @@ ds_cre_subdirs(server_config_s *cf, struct passwd* pw)
#define CREATE_VERIFYDB() \
gen_perl_script_auto(mysroot, mycs_path, "verify-db.pl", cf)
-/* tentatively moved to mycs_path */
#define CREATE_REPL_MONITOR_CGI() \
- gen_perl_script_auto(mysroot, mycs_path, "repl-monitor-cgi.pl", cf)
+ gen_perl_script_auto(mysroot, cgics_path, "repl-monitor-cgi.pl", cf)
#define CREATE_ACCOUNT_INACT(_commandName) \
gen_perl_script_auto(mysroot, cs_path, _commandName, cf)
@@ -2106,15 +2065,7 @@ ds_cre_subdirs(server_config_s *cf, struct passwd* pw)
char *ds_gen_scripts(char *sroot, server_config_s *cf, char *cs_path)
{
char *t = NULL;
-#if 0
- char *server = sroot;
- char *admin = sroot;
- char *tools = cf->bindir;
-#else
- char server[PATH_SIZE];
- char admin[PATH_SIZE];
- char tools[PATH_SIZE];
-#endif
+ char server[PATH_SIZE], admin[PATH_SIZE], tools[PATH_SIZE];
char cgics_path[PATH_SIZE];
char *cl_scripts[7] = {"dsstop", "dsstart", "dsrestart", "dsrestore", "dsbackup", "dsimport", "dsexport"};
char *cl_javafiles[7] = {"DSStop", "DSStart", "DSRestart", "DSRestore", "DSBackup", "DSImport", "DSExport"};
@@ -2131,16 +2082,12 @@ char *ds_gen_scripts(char *sroot, server_config_s *cf, char *cs_path)
mysroot = sroot;
mycs_path = cs_path;
-#if 0
- /* nothing to do for server, admin, tools */
+ PR_snprintf(server, sizeof(server), "%s/bin/"PRODUCT_NAME"/server", sroot);
+ PR_snprintf(admin, sizeof(admin), "%s/bin/"PRODUCT_NAME"/admin/bin", sroot);
+ PR_snprintf(tools, sizeof(tools), "%s/shared/bin", sroot);
PR_snprintf(cgics_path, sizeof(cgics_path), "%s%cbin%cadmin%cadmin%cbin", sroot,
FILE_PATHSEP, FILE_PATHSEP, FILE_PATHSEP, FILE_PATHSEP);
-#else /* will go away */
- PR_snprintf(server, sizeof(server), "%s/bin/"PRODUCT_NAME"/server", sroot);
- PR_snprintf(admin, sizeof(admin), "%s/bin/"PRODUCT_NAME"/admin/bin", sroot);
- PR_snprintf(tools, sizeof(tools), "%s/shared/bin", sroot);
-#endif
t = gen_script(cs_path, "monitor",
"if [ \"x$1\" != \"x\" ];\nthen MDN=\"$1\";\nelse MDN=\"cn=monitor\";\n fi\n"
@@ -2153,14 +2100,14 @@ char *ds_gen_scripts(char *sroot, server_config_s *cf, char *cs_path)
"cd %s\n"
"echo saving configuration ...\n"
"conf_ldif=%s/confbak/`date +%%Y_%%m_%%d_%%H%%M%%S`.ldif\n"
- "./%s db2ldif -N -D %s "
+ "./ns-slapd db2ldif -N -D %s "
"-s \"%s\" -a $conf_ldif -n NetscapeRoot 2>&1\n"
"if [ \"$?\" -ge 1 ] \nthen\n"
" echo Error occurred while saving configuration\n"
" exit 1\n"
"fi\n"
"exit 0\n",
- server, cf->config_dir, PRODUCT_BIN, cf->config_dir, cf->netscaperoot);
+ server, cs_path, cs_path, cf->netscaperoot);
if(t) return t;
t = gen_script(cs_path, "restoreconfig",
@@ -2171,10 +2118,10 @@ char *ds_gen_scripts(char *sroot, server_config_s *cf, char *cs_path)
" echo No configuration to restore in %s/confbak ; exit 1\n"
"fi\n"
"echo Restoring $conf_ldif\n"
- "./%s ldif2db -D %s"
+ "./ns-slapd ldif2db -D %s"
" -i $conf_ldif -n NetscapeRoot 2>&1\n"
"exit $?\n",
- server, cf->config_dir, cf->config_dir, PRODUCT_BIN, cf->config_dir);
+ server, cs_path, cs_path, cs_path);
if(t) return t;
t = gen_script(cs_path, "ldif2db",
@@ -2186,9 +2133,9 @@ char *ds_gen_scripts(char *sroot, server_config_s *cf, char *cs_path)
"\texit 1\n"
"fi\n\n"
"echo importing data ...\n"
- "./%s ldif2db -D %s \"$@\" 2>&1\n"
+ "./ns-slapd ldif2db -D %s \"$@\" 2>&1\n"
"exit $?\n",
- server, PRODUCT_BIN, cf->config_dir);
+ server, cs_path);
if(t) return t;
#if defined(UPGRADEDB)
@@ -2196,15 +2143,14 @@ char *ds_gen_scripts(char *sroot, server_config_s *cf, char *cs_path)
"cd %s\n"
"if [ \"$#\" -eq 1 ]\nthen\n"
"\tbak_dir=$1\nelse\n"
- "\tbak_dir=%s/upgradedb_`date +%%Y_%%m_%%d_%%H_%%M_%%S`\nfi\n\n"
+ "\tbak_dir=%s/bak/upgradedb_`date +%%Y_%%m_%%d_%%H_%%M_%%S`\nfi\n\n"
"echo upgrade index files ...\n"
- "./%s upgradedb -D %s -a $bak_dir\n",
- server, cf->bak_dir, PRODUCT_BIN, cf->config_dir);
+ "./ns-slapd upgradedb -D %s -a $bak_dir\n",
+ server, cs_path, cs_path);
if(t) return t;
#endif
/* new code for dsml import */
- /* OBSOLETE??? */
t = gen_script(cs_path, "dsml2db",
"cd %s\n"
"if [ $# -lt 4 ]\nthen\n"
@@ -2304,7 +2250,7 @@ char *ds_gen_scripts(char *sroot, server_config_s *cf, char *cs_path)
"\texit 1\n"
"fi\n\n"
"pwdhash -D %s -H -s \"$@\"\n",
- server, cf->config_dir, cs_path);
+ server, server, cs_path);
if(t) return t;
t = gen_script(cs_path, "db2ldif",
@@ -2329,11 +2275,9 @@ char *ds_gen_scripts(char *sroot, server_config_s *cf, char *cs_path)
"if [ $ldif_file = \"mydummy\" ]\nthen\n"
"\tldif_file=%s/ldif/`date +%%Y_%%m_%%d_%%H%%M%%S`.ldif\nfi\n"
"if [ $set_ldif -eq 2 ]\nthen\n"
- "./%s db2ldif -D %s \"$@\"\nelse\n"
- "./%s db2ldif -D %s -a $ldif_file \"$@\"\nfi\n",
- server, cf->ldif_dir,
- PRODUCT_BIN, cf->config_dir,
- PRODUCT_BIN, cf->config_dir);
+ "./ns-slapd db2ldif -D %s \"$@\"\nelse\n"
+ "./ns-slapd db2ldif -D %s -a $ldif_file \"$@\"\nfi\n",
+ server, cs_path, cs_path, cs_path);
if(t) return t;
/* new code for dsml export */
@@ -2380,17 +2324,15 @@ char *ds_gen_scripts(char *sroot, server_config_s *cf, char *cs_path)
"if [ $# -eq 0 ]\n"
"then\n"
"\tbak_dir=%s/bak/reindex_`date +%%Y_%%m_%%d_%%H_%%M_%%S`\n"
- "\t./%s upgradedb -D %s -f -a \"$bak_dir\"\n"
+ "\t./ns-slapd upgradedb -D %s -f -a \"$bak_dir\"\n"
"elif [ $# -lt 4 ]\n"
"then\n"
"\techo \"Usage: db2index [-n backend_instance | {-s includesuffix}* -t attribute[:indextypes[:matchingrules]] -T vlvattribute]\"\n"
"\texit 1\n"
"else\n"
- "\t./%s db2index -D %s \"$@\"\n"
+ "\t./ns-slapd db2index -D %s \"$@\"\n"
"fi\n\n",
- server, cf->ldif_dir,
- PRODUCT_BIN, cf->config_dir,
- PRODUCT_BIN, cf->config_dir);
+ server, cs_path, cs_path, cs_path);
if(t) return t;
#endif
@@ -2402,17 +2344,17 @@ char *ds_gen_scripts(char *sroot, server_config_s *cf, char *cs_path)
"\techo Note: either \\\"-n backend_instance\\\" or \\\"-s includesuffix\\\" are required.\n"
"\texit 1\n"
"fi\n\n"
- "./%s db2index -D %s \"$@\"\n",
- server, PRODUCT_BIN, cf->config_dir);
+ "./ns-slapd db2index -D %s \"$@\"\n",
+ server, cs_path);
if(t) return t;
t = gen_script(cs_path, "db2bak",
"cd %s\n"
"if [ \"$#\" -eq 1 ]\nthen\n"
"\tbak_dir=$1\nelse\n"
- "\tbak_dir=%s/`date +%%Y_%%m_%%d_%%H_%%M_%%S`\nfi\n\n"
- "./%s db2archive -D %s -a $bak_dir\n",
- server, cf->bak_dir, PRODUCT_BIN, cf->config_dir);
+ "\tbak_dir=%s/bak/`date +%%Y_%%m_%%d_%%H_%%M_%%S`\nfi\n\n"
+ "./ns-slapd db2archive -D %s -a $bak_dir\n",
+ server, cs_path, cs_path);
if(t) return t;
t = CREATE_DB2BAK();
@@ -2423,14 +2365,14 @@ char *ds_gen_scripts(char *sroot, server_config_s *cf, char *cs_path)
" echo \"Usage: bak2db archivedir [-n backendname]\"\n"
" exit 1\n"
"else\n"
- " archivedir=$1\n"
- " shift\n"
+ " archivedir=$1\n"
+ " shift\n"
"fi\n"
"while getopts \"n:\" flag\ndo\n"
- " case $flag in\n"
- " n) bename=$OPTARG;;\n"
- " *) echo \"Usage: bak2db archivedir [-n backendname]\"; exit 2;;\n"
- " esac\n"
+ " case $flag in\n"
+ " n) bename=$OPTARG;;\n"
+ " *) echo \"Usage: bak2db archivedir [-n backendname]\"; exit 2;;\n"
+ " esac\n"
"done\n\n"
"if [ 1 = `expr $archivedir : \"\\/\"` ]\nthen\n"
" archivedir=$archivedir\n"
@@ -2439,11 +2381,11 @@ char *ds_gen_scripts(char *sroot, server_config_s *cf, char *cs_path)
" archivedir=`pwd`/$archivedir\nfi\n\n"
"cd %s\n"
"if [ \"$#\" -eq 2 ]\nthen\n"
- " ./%s archive2db -D %s -a $archivedir -n $bename\n"
+ " ./ns-slapd archive2db -D %s -a $archivedir -n $bename\n"
"else\n"
- " ./%s archive2db -D %s -a $archivedir\n"
+ " ./ns-slapd archive2db -D %s -a $archivedir\n"
"fi\n",
- server, PRODUCT_BIN, cf->config_dir, PRODUCT_BIN, cf->config_dir);
+ server, cs_path, cs_path);
if(t) return t;
t = CREATE_BAK2DB();
@@ -2477,8 +2419,8 @@ char *ds_gen_scripts(char *sroot, server_config_s *cf, char *cs_path)
"\techo Usage: suffix2instance {-s includesuffix}*\n"
"\texit 1\n"
"fi\n\n"
- "./%s suffix2instance -D %s \"$@\" 2>&1\n",
- server, PRODUCT_BIN, cf->config_dir);
+ "./ns-slapd suffix2instance -D %s \"$@\" 2>&1\n",
+ server, cs_path);
if(t) return t;
/*Generate the java commandline tools in bin/slapd/server*/
@@ -2508,10 +2450,11 @@ char *ds_gen_scripts(char *sroot, server_config_s *cf, char *cs_path)
if(t) return t;
}
+
+
return (t);
}
#else
-/* Windows; haven't updated */
char *ds_gen_scripts(char *sroot, server_config_s *cf, char *cs_path)
{
char *t = NULL;
@@ -3203,7 +3146,7 @@ suffix_gen_conf(FILE* f, char * suffix, char *be_name)
belowdn = PR_smprintf("cn=index,cn=%s,cn=ldbm database,cn=plugins,cn=config", be_name);
ds_gen_index(f, belowdn);
- PR_smprintf_free(belowdn);
+ PR_smprintf_free(belowdn);
/* done with ldbm entries */
}
@@ -3221,7 +3164,8 @@ suffix_gen_conf(FILE* f, char * suffix, char *be_name)
fprintf(f, "\n"); \
} while (0)
-char *ds_gen_confs(char *sroot, server_config_s *cf, char *cs_path)
+char *ds_gen_confs(char *sroot, server_config_s *cf,
+ char *cs_path)
{
char* t = NULL;
char src[PATH_SIZE], dest[PATH_SIZE];
@@ -3229,13 +3173,10 @@ char *ds_gen_confs(char *sroot, server_config_s *cf, char *cs_path)
FILE *f = 0, *srcf = 0;
int rootdse = 0;
char *shared_lib;
- struct passwd *pw = getpwnam(cf->servuser);
- PR_snprintf(fn, sizeof(fn), "%s%c%s",
- cf->config_dir, FILE_PATHSEP, DS_CONFIG_FILE);
+ PR_snprintf(fn, sizeof(fn), "%s%cconfig%cdse.ldif", cs_path, FILE_PATHSEP, FILE_PATHSEP);
if(!(f = fopen(fn, "w")))
- return make_error("Can't write to %s (%s)",
- cf->config_dir, ds_system_errmsg());
+ return make_error("Can't write to %s (%s)", fn, ds_system_errmsg());
#if defined( XP_WIN32 )
shared_lib = ".dll";
@@ -3264,9 +3205,6 @@ char *ds_gen_confs(char *sroot, server_config_s *cf, char *cs_path)
fprintf(f, "objectclass:top\n");
fprintf(f, "objectclass:extensibleObject\n");
fprintf(f, "objectclass:nsslapdConfig\n");
- fprintf(f, "nsslapd-instancedir: %s\n", cf->inst_dir);
- fprintf(f, "nsslapd-schemadir: %s\n", cf->schema_dir);
- fprintf(f, "nsslapd-ldifdir: %s\n", cf->ldif_dir);
fprintf(f, "nsslapd-accesslog-logging-enabled: on\n");
fprintf(f, "nsslapd-accesslog-maxlogsperdir: 10\n");
fprintf(f, "nsslapd-accesslog-mode: 600\n");
@@ -3276,11 +3214,7 @@ char *ds_gen_confs(char *sroot, server_config_s *cf, char *cs_path)
fprintf(f, "nsslapd-accesslog-logrotationsync-enabled: off\n");
fprintf(f, "nsslapd-accesslog-logrotationsynchour: 0\n");
fprintf(f, "nsslapd-accesslog-logrotationsyncmin: 0\n");
-#if 0
- fprintf(f, "nsslapd-accesslog: %s/access\n", cf->log_dir);
-#else /* will go away */
fprintf(f, "nsslapd-accesslog: %s/logs/access\n", cs_path);
-#endif
fprintf(f, "nsslapd-enquote-sup-oc: off\n");
fprintf(f, "nsslapd-localhost: %s\n", cf->servname);
fprintf(f, "nsslapd-schemacheck: %s\n",
@@ -3303,18 +3237,10 @@ char *ds_gen_confs(char *sroot, server_config_s *cf, char *cs_path)
fprintf(f, "nsslapd-errorlog-logrotationsync-enabled: off\n");
fprintf(f, "nsslapd-errorlog-logrotationsynchour: 0\n");
fprintf(f, "nsslapd-errorlog-logrotationsyncmin: 0\n");
-#if 0
- fprintf(f, "nsslapd-errorlog: %s/errors\n", cf->log_dir);
-#else /* will go away */
fprintf(f, "nsslapd-errorlog: %s/logs/errors\n", cs_path);
-#endif
if (cf->loglevel)
fprintf(f, "nsslapd-errorlog-level: %s\n", cf->loglevel);
-#if 0
- fprintf(f, "nsslapd-auditlog: %s/audit\n", cf->log_dir);
-#else /* will go away */
fprintf(f, "nsslapd-auditlog: %s/logs/audit\n", cs_path);
-#endif
fprintf(f, "nsslapd-auditlog-mode: 600\n");
fprintf(f, "nsslapd-auditlog-maxlogsize: 100\n");
fprintf(f, "nsslapd-auditlog-logrotationtime: 1\n");
@@ -3434,15 +3360,15 @@ char *ds_gen_confs(char *sroot, server_config_s *cf, char *cs_path)
fprintf(f, "\n");
#endif
- fprintf(f, "dn: cn=MD5,cn=Password Storage Schemes,cn=plugins,cn=config\n");
- fprintf(f, "objectclass: top\n");
- fprintf(f, "objectclass: nsSlapdPlugin\n");
- fprintf(f, "cn: MD5\n");
- fprintf(f, "nsslapd-pluginpath: %s/lib/pwdstorage-plugin%s\n", sroot, shared_lib);
- fprintf(f, "nsslapd-plugininitfunc: md5_pwd_storage_scheme_init\n");
- fprintf(f, "nsslapd-plugintype: pwdstoragescheme\n");
- fprintf(f, "nsslapd-pluginenabled: on\n");
- fprintf(f, "\n");
+ fprintf(f, "dn: cn=MD5,cn=Password Storage Schemes,cn=plugins,cn=config\n");
+ fprintf(f, "objectclass: top\n");
+ fprintf(f, "objectclass: nsSlapdPlugin\n");
+ fprintf(f, "cn: MD5\n");
+ fprintf(f, "nsslapd-pluginpath: %s/lib/pwdstorage-plugin%s\n", sroot, shared_lib);
+ fprintf(f, "nsslapd-plugininitfunc: md5_pwd_storage_scheme_init\n");
+ fprintf(f, "nsslapd-plugintype: pwdstoragescheme\n");
+ fprintf(f, "nsslapd-pluginenabled: on\n");
+ fprintf(f, "\n");
fprintf(f, "dn: cn=CLEAR,cn=Password Storage Schemes,cn=plugins,cn=config\n");
fprintf(f, "objectclass: top\n");
@@ -3709,7 +3635,7 @@ char *ds_gen_confs(char *sroot, server_config_s *cf, char *cs_path)
fprintf(f, "nsslapd-plugininitfunc: orderingRule_init\n");
fprintf(f, "nsslapd-plugintype: matchingRule\n");
fprintf(f, "nsslapd-pluginenabled: on\n");
- fprintf(f, "nsslapd-pluginarg0: %s/slapd-collations.conf\n", cf->config_dir);
+ fprintf(f, "nsslapd-pluginarg0: %s/config/slapd-collations.conf\n", cs_path);
fprintf(f, "\n");
/* The HTTP client plugin */
@@ -3841,29 +3767,29 @@ char *ds_gen_confs(char *sroot, server_config_s *cf, char *cs_path)
#ifdef BUILD_PAM_PASSTHRU
#if !defined( XP_WIN32 )
- /* PAM Pass Through Auth plugin - off by default */
- fprintf(f, "dn: cn=PAM Pass Through Auth,cn=plugins,cn=config\n");
- fprintf(f, "objectclass: top\n");
- fprintf(f, "objectclass: nsSlapdPlugin\n");
- fprintf(f, "objectclass: extensibleObject\n");
- fprintf(f, "objectclass: pamConfig\n");
- fprintf(f, "cn: PAM Pass Through Auth\n");
- fprintf(f, "nsslapd-pluginpath: %s/lib/pam-passthru-plugin%s\n", sroot, shared_lib);
- fprintf(f, "nsslapd-plugininitfunc: pam_passthruauth_init\n");
- fprintf(f, "nsslapd-plugintype: preoperation\n");
- fprintf(f, "nsslapd-pluginenabled: off\n");
- fprintf(f, "nsslapd-pluginLoadGlobal: true\n");
- fprintf(f, "nsslapd-plugin-depends-on-type: database\n");
- fprintf(f, "pamMissingSuffix: ALLOW\n");
- if (cf->netscaperoot) {
- fprintf(f, "pamExcludeSuffix: %s\n", cf->netscaperoot);
- }
- fprintf(f, "pamExcludeSuffix: cn=config\n");
- fprintf(f, "pamMapMethod: RDN\n");
- fprintf(f, "pamFallback: FALSE\n");
- fprintf(f, "pamSecure: TRUE\n");
- fprintf(f, "pamService: ldapserver\n");
- fprintf(f, "\n");
+ /* PAM Pass Through Auth plugin - off by default */
+ fprintf(f, "dn: cn=PAM Pass Through Auth,cn=plugins,cn=config\n");
+ fprintf(f, "objectclass: top\n");
+ fprintf(f, "objectclass: nsSlapdPlugin\n");
+ fprintf(f, "objectclass: extensibleObject\n");
+ fprintf(f, "objectclass: pamConfig\n");
+ fprintf(f, "cn: PAM Pass Through Auth\n");
+ fprintf(f, "nsslapd-pluginpath: %s/lib/pam-passthru-plugin%s\n", sroot, shared_lib);
+ fprintf(f, "nsslapd-plugininitfunc: pam_passthruauth_init\n");
+ fprintf(f, "nsslapd-plugintype: preoperation\n");
+ fprintf(f, "nsslapd-pluginenabled: off\n");
+ fprintf(f, "nsslapd-pluginLoadGlobal: true\n");
+ fprintf(f, "nsslapd-plugin-depends-on-type: database\n");
+ fprintf(f, "pamMissingSuffix: ALLOW\n");
+ if (cf->netscaperoot) {
+ fprintf(f, "pamExcludeSuffix: %s\n", cf->netscaperoot);
+ }
+ fprintf(f, "pamExcludeSuffix: cn=config\n");
+ fprintf(f, "pamMapMethod: RDN\n");
+ fprintf(f, "pamFallback: FALSE\n");
+ fprintf(f, "pamSecure: TRUE\n");
+ fprintf(f, "pamService: ldapserver\n");
+ fprintf(f, "\n");
#endif /* NO PAM FOR WINDOWS */
#endif /* BUILD_PAM_PASSTHRU */
@@ -4054,28 +3980,24 @@ char *ds_gen_confs(char *sroot, server_config_s *cf, char *cs_path)
fprintf(f, "\n");
/* create the changelog directory */
- if( (t = create_instance_mkdir_p("changelog dir", cf->changelogdir, NEWDIR_MODE, pw)) )
+ if( (t = create_instance_mkdir_p(cf->changelogdir, NEWDIR_MODE)) )
return(t);
}
fclose (f);
- PR_snprintf(src, sizeof(src), "%s%cdse.ldif", cf->config_dir, FILE_PATHSEP);
- PR_snprintf(dest, sizeof(dest), "%s%cdse_original.ldif", cf->config_dir, FILE_PATHSEP);
- create_instance_copy(src, dest, 0600);
-
- /* install certmap.conf at <sysconfig>/BRAND_DS */
- PR_snprintf(src, sizeof(src), "%s/bin/slapd/install/config/certmap.conf",
- cf->sroot);
- PR_snprintf(dest, sizeof(dest), "%s/certmap.conf", cf->config_dir);
- create_instance_copy(src, dest, 0600);
-
- /* generate <sysconfdir>/BRAND_DS/slapd-collations.conf */
- PR_snprintf(src, sizeof(src),
- "%s/bin/slapd/install/config/%s-collations.conf",
- cf->sroot, PRODUCT_NAME);
- PR_snprintf(dest, sizeof(dest), "%s%c%s-collations.conf",
- cf->config_dir, FILE_PATHSEP, PRODUCT_NAME);
+ PR_snprintf(src, sizeof(src), "%s%cconfig%cdse.ldif", cs_path, FILE_PATHSEP, FILE_PATHSEP);
+ PR_snprintf(fn, sizeof(fn), "%s%cconfig%cdse_original.ldif", cs_path, FILE_PATHSEP, FILE_PATHSEP);
+ create_instance_copy(src, fn, 0600);
+
+ /*
+ * generate slapd-collations.conf
+ */
+ PR_snprintf(src, sizeof(src), "%s%cbin%c"PRODUCT_NAME"%cinstall%cconfig%c%s-collations.conf",
+ sroot, FILE_PATHSEP, FILE_PATHSEP, FILE_PATHSEP, FILE_PATHSEP,
+ FILE_PATHSEP, PRODUCT_NAME);
+ PR_snprintf(dest, sizeof(dest), "%s%cconfig%c%s-collations.conf", cs_path, FILE_PATHSEP,
+ FILE_PATHSEP, PRODUCT_NAME);
if (!(srcf = fopen(src, "r"))) {
return make_error("Can't read from %s (%s)", src, ds_system_errmsg());
}
@@ -4094,16 +4016,9 @@ char *ds_gen_confs(char *sroot, server_config_s *cf, char *cs_path)
fclose(srcf);
fclose(f);
- /*
- * <sysconfdir>/BRAND_DS/schema to schema_dir
- */
-#if 0 /* going to be 1 !! */
- PR_snprintf(src, sizeof(src), "%s%c%s%cschema",
- cf->sysconfdir, FILE_PATHSEP, BRAND_DS, FILE_PATHSEP);
-#else
PR_snprintf(src, sizeof(src), "%s/bin/slapd/install/schema", sroot);
-#endif
- if (NULL != (t = ds_copy_group_files(src, cf->schema_dir, 0)))
+ PR_snprintf(dest, sizeof(dest), "%s/config/schema", cs_path);
+ if (NULL != (t = ds_copy_group_files(src, dest, 0)))
return t;
#if defined (BUILD_PRESENCE)
@@ -4113,7 +4028,6 @@ char *ds_gen_confs(char *sroot, server_config_s *cf, char *cs_path)
return t;
#endif
-#if defined (ORGCHART)
/* Generate the orgchart configuration */
PR_snprintf(src, sizeof(src), "%s/clients", sroot);
if (is_a_dir(src, "orgchart")) {
@@ -4121,9 +4035,7 @@ char *ds_gen_confs(char *sroot, server_config_s *cf, char *cs_path)
return t;
}
}
-#endif
-#if defined (DSGW)
/* Generate dsgw.conf */
PR_snprintf(src, sizeof(src), "%s/clients", sroot);
if (is_a_dir(src, "dsgw")) {
@@ -4136,7 +4048,6 @@ char *ds_gen_confs(char *sroot, server_config_s *cf, char *cs_path)
return t;
}
}
-#endif
return NULL; /* Everything worked fine */
}
@@ -4177,8 +4088,9 @@ ds_gen_gw_conf(char *sroot, char *cs_path, server_config_s *cf, int conf_type)
PR_snprintf(dest, sizeof(dest), "%s%cclients%cdsgw%ccontext%c%s.conf", sroot, FILE_PATHSEP,FILE_PATHSEP,
FILE_PATHSEP, FILE_PATHSEP, ctxt);
+
/* If the config file already exists, just return success */
- if (create_instance_exists(dest, PR_FILE_FILE)) {
+ if (create_instance_exists(dest)) {
return(NULL);
}
@@ -4293,7 +4205,7 @@ ds_gen_orgchart_conf(char *sroot, char *cs_path, server_config_s *cf)
FILE_PATHSEP, FILE_PATHSEP);
/* If the config file already exists, just return success */
- if (create_instance_exists(dest, PR_FILE_FILE)) {
+ if (create_instance_exists(dest)) {
return(NULL);
}
@@ -4470,13 +4382,13 @@ static void
ds_gen_index(FILE* f, char* belowdn)
{
#define MKINDEX(_name, _inst, _sys, _type1, _type2, _type3) do { \
- char *_type2str = (_type2), *_type3str = (_type3); \
+ char *_type2str = (_type2), *_type3str = (_type3); \
fprintf(f, "dn: cn=%s,%s\n", (_name), (_inst)); \
fprintf(f, "objectclass: top\n"); \
fprintf(f, "objectclass: nsIndex\n"); \
fprintf(f, "cn: %s\n", (_name)); \
fprintf(f, "nssystemindex: %s\n", (_sys) ? "true" : "false"); \
- if (_type1) \
+ if (_type1) \
fprintf(f, "nsindextype: %s\n", (_type1)); \
if (_type2str) \
fprintf(f, "nsindextype: %s\n", _type2str); \
@@ -4543,7 +4455,7 @@ static char *install_ds(char *sroot, server_config_s *cf, char *param_name)
PR_snprintf(cs_path, sizeof(cs_path), "%s%c"PRODUCT_NAME"-%s", sroot, FILE_PATHSEP, cf->servid);
/* create all <a_server>/<subdirs> */
- if ( (t = ds_cre_subdirs(cf, pw)) )
+ if ( (t = ds_cre_subdirs(sroot, cf, cs_path, pw)) )
return(t);
/* Generate all scripts */
@@ -4561,29 +4473,28 @@ static char *install_ds(char *sroot, server_config_s *cf, char *param_name)
PR_snprintf(src, sizeof(src), "%s%cbin%c"PRODUCT_NAME"%cinstall%cldif%cExample.ldif", sroot, FILE_PATHSEP, FILE_PATHSEP, FILE_PATHSEP, FILE_PATHSEP,
FILE_PATHSEP);
- PR_snprintf(dest, sizeof(dest), "%s%cExample.ldif", cf->ldif_dir, FILE_PATHSEP);
+ PR_snprintf(dest, sizeof(dest), "%s%cldif%cExample.ldif", cs_path, FILE_PATHSEP, FILE_PATHSEP);
create_instance_copy(src, dest, NEWFILE_MODE);
chownfile (pw, dest);
PR_snprintf(src, sizeof(src), "%s%cbin%c"PRODUCT_NAME"%cinstall%cldif%cExample-roles.ldif", sroot, FILE_PATHSEP, FILE_PATHSEP, FILE_PATHSEP, FILE_PATHSEP,
FILE_PATHSEP);
- PR_snprintf(dest, sizeof(dest), "%s%cExample-roles.ldif", cf->ldif_dir, FILE_PATHSEP);
+ PR_snprintf(dest, sizeof(dest), "%s%cldif%cExample-roles.ldif", cs_path, FILE_PATHSEP, FILE_PATHSEP);
create_instance_copy(src, dest, NEWFILE_MODE);
chownfile (pw, dest);
PR_snprintf(src, sizeof(src), "%s%cbin%c"PRODUCT_NAME"%cinstall%cldif%cExample-views.ldif", sroot, FILE_PATHSEP, FILE_PATHSEP, FILE_PATHSEP, FILE_PATHSEP,
FILE_PATHSEP);
- PR_snprintf(dest, sizeof(dest), "%s%cExample-views.ldif", cf->ldif_dir, FILE_PATHSEP);
+ PR_snprintf(dest, sizeof(dest), "%s%cldif%cExample-views.ldif", cs_path, FILE_PATHSEP, FILE_PATHSEP);
create_instance_copy(src, dest, NEWFILE_MODE);
chownfile (pw, dest);
PR_snprintf(src, sizeof(src), "%s%cbin%c"PRODUCT_NAME"%cinstall%cldif%cEuropean.ldif", sroot, FILE_PATHSEP, FILE_PATHSEP, FILE_PATHSEP, FILE_PATHSEP,
FILE_PATHSEP);
- PR_snprintf(dest, sizeof(dest), "%s%cEuropean.ldif", cf->ldif_dir, FILE_PATHSEP);
+ PR_snprintf(dest, sizeof(dest), "%s%cldif%cEuropean.ldif", cs_path, FILE_PATHSEP, FILE_PATHSEP);
create_instance_copy(src, dest, NEWFILE_MODE);
chownfile (pw, dest);
-#ifdef DSML
/* new code for dsml sample files */
PR_snprintf(src, sizeof(src), "%s%cbin%c"PRODUCT_NAME"%cinstall%cdsml%cExample.dsml", sroot, FILE_PATHSEP, FILE_PATHSEP, FILE_PATHSEP, FILE_PATHSEP,
FILE_PATHSEP);
@@ -4602,7 +4513,6 @@ static char *install_ds(char *sroot, server_config_s *cf, char *param_name)
PR_snprintf(dest, sizeof(dest), "%s%cdsml%cEuropean.dsml", cs_path, FILE_PATHSEP, FILE_PATHSEP);
create_instance_copy(src, dest, NEWFILE_MODE);
chownfile (pw, dest);
-#endif
/*
If the user has specified an LDIF file to use to initialize the database,
@@ -4642,17 +4552,17 @@ static char *install_ds(char *sroot, server_config_s *cf, char *param_name)
{
int start_status = 0;
int verbose = 1;
- char errorlog[PATH_SIZE];
+ char instance_dir[PATH_SIZE], errorlog[PATH_SIZE];
if (getenv("USE_DEBUGGER"))
verbose = 0;
+ /* slapd-nickname directory */
+ PR_snprintf(instance_dir, sizeof(instance_dir), "%s%c"PRODUCT_NAME"-%s", sroot, FILE_PATHSEP,
+ cf->servid);
/* error log file */
-#if 0
- PR_snprintf(errorlog, sizeof(errorlog), "%s%cerrors", cf->log_dir, FILE_PATHSEP,
-#else /* will go away */
- PR_snprintf(errorlog, sizeof(errorlog), "%s%clogs%cerrors", cf->inst_dir, FILE_PATHSEP, FILE_PATHSEP);
-#endif
- start_status = ds_bring_up_server_install(verbose, cf->inst_dir, errorlog);
+ PR_snprintf(errorlog, sizeof(errorlog), "%s%clogs%cerrors", instance_dir, FILE_PATHSEP,
+ FILE_PATHSEP);
+ start_status = ds_bring_up_server_install(verbose, instance_dir, errorlog);
if (start_status != DS_SERVER_UP)
{
@@ -4718,23 +4628,27 @@ static char *install_ds(char *sroot, server_config_s *cf, char *param_name)
memset( &query_vars, 0, sizeof(query_vars) );
if (!cf->use_existing_user_ds)
- query_vars.suffix = PL_strdup( cf->suffix );
- query_vars.ssAdmID = PL_strdup( cf->cfg_sspt_uid );
- query_vars.ssAdmPW1 = PL_strdup( cf->cfg_sspt_uidpw );
- query_vars.ssAdmPW2 = PL_strdup( cf->cfg_sspt_uidpw );
- query_vars.rootDN = PL_strdup( cf->rootdn );
- query_vars.rootPW = PL_strdup( cf->rootpw );
- query_vars.admin_domain = PL_strdup( cf->admin_domain );
- query_vars.netscaperoot = PL_strdup( cf->netscaperoot );
- query_vars.testconfig = PL_strdup( cf->testconfig );
- query_vars.consumerDN = PL_strdup(cf->consumerdn);
- query_vars.consumerPW = PL_strdup(cf->consumerhashedpw);
+ query_vars.suffix = myStrdup( cf->suffix );
+ query_vars.ssAdmID = myStrdup( cf->cfg_sspt_uid );
+ query_vars.ssAdmPW1 = myStrdup( cf->cfg_sspt_uidpw );
+ query_vars.ssAdmPW2 = myStrdup( cf->cfg_sspt_uidpw );
+ query_vars.rootDN = myStrdup( cf->rootdn );
+ query_vars.rootPW = myStrdup( cf->rootpw );
+ query_vars.admin_domain =
+ myStrdup( cf->admin_domain );
+ query_vars.netscaperoot = myStrdup( cf->netscaperoot );
+ query_vars.testconfig = myStrdup( cf->testconfig );
+ query_vars.consumerDN = myStrdup(cf->consumerdn);
+ query_vars.consumerPW = myStrdup(cf->consumerhashedpw);
if (cf->cfg_sspt && !strcmp(cf->cfg_sspt, "1"))
query_vars.cfg_sspt = 1;
else
query_vars.cfg_sspt = 0;
- query_vars.config_admin_uid = PL_strdup(cf->cfg_sspt_uid);
+ if (cf->suitespot3x_uid)
+ query_vars.config_admin_uid = myStrdup(cf->suitespot3x_uid);
+ else
+ query_vars.config_admin_uid = myStrdup(cf->cfg_sspt_uid);
memset(&slapd_conf, 0, sizeof(SLAPD_CONFIG));
if (sroot)
@@ -4820,30 +4734,30 @@ write_ldap_info( char *slapd_server_root, server_config_s *cf)
int create_config(server_config_s *cf)
{
char *t = NULL;
- char error_param[BIG_LINE] = {0};
+ char error_param[BIG_LINE] = {0};
t = create_server(cf, error_param);
if(t)
- {
- char *msg;
- if (error_param[0])
- {
- msg = PR_smprintf("%s.error:could not create server %s - %s",
- error_param, cf->servid, t);
- }
- else
- {
- msg = PR_smprintf("error:could not create server %s - %s",
- cf->servid, t);
- }
- ds_show_message(msg);
- PR_smprintf_free(msg);
- }
- else
- {
- ds_show_message("Created new Directory Server");
- return 0;
- }
+ {
+ char *msg;
+ if (error_param[0])
+ {
+ msg = PR_smprintf("%s.error:could not create server %s - %s",
+ error_param, cf->servid, t);
+ }
+ else
+ {
+ msg = PR_smprintf("error:could not create server %s - %s",
+ cf->servid, t);
+ }
+ ds_show_message(msg);
+ PR_smprintf_free(msg);
+ }
+ else
+ {
+ ds_show_message("Created new Directory Server");
+ return 0;
+ }
return 1;
}
@@ -4853,59 +4767,23 @@ int create_config(server_config_s *cf)
static int check_passwords(char *pw1, char *pw2)
{
if (strcmp (pw1, pw2) != 0) {
- ds_report_error (DS_INCORRECT_USAGE, " different passwords",
- "Enter the password again."
- " The two passwords you entered are different.");
- return 1;
- }
-
+ ds_report_error (DS_INCORRECT_USAGE, " different passwords",
+ "Enter the password again."
+ " The two passwords you entered are different.");
+ return 1;
+ }
+
if ( ((int) strlen(pw1)) < 8 ) {
- ds_report_error (DS_INCORRECT_USAGE, " password too short",
- "The password must be at least 8 characters long.");
- return 1;
- }
-
- return 0;
-}
+ ds_report_error (DS_INCORRECT_USAGE, " password too short",
+ "The password must be at least 8 characters long.");
+ return 1;
+ }
-static char *
-set_path_attribute(char *attr, char *defaultval, char *prefix)
-{
- char *temp = ds_a_get_cgi_var(attr, NULL, NULL);
- char *rstr = NULL;
- if (prefix) {
- if (NULL == temp || '\0' == *temp) {
- rstr = PR_smprintf("%s%c%s", prefix, FILE_PATHSEP, defaultval);
- } else {
- rstr = PR_smprintf("%s%c%s", prefix, FILE_PATHSEP, temp);
- }
- } else {
- if (NULL == temp || '\0' == *temp) {
- rstr = defaultval;
- } else {
- rstr = PL_strdup(temp);
- }
- }
- return rstr;
+ return 0;
}
/* ------ Parse the results of a form and create a server from them ------- */
-/*
- * FHS description
- * cf->prefix: %{_prefix}
- * cf->sroot: %{_libdir}/BRAND_DS
- * cf->localstatedir: %{_localstatedir}
- * cf->sysconfdir: %{_sysconfdir}
- * cf->bindir: %{_bindir}
- * cf->datadir: %{_datadir}
- * cf->docdir: %{_docdir}
- * cf->inst_dir: <sroot>/slapd-<servid>
- * cf->config_dir: <localstatedir>/lib/slapd-<servid>
- * cf->schema_dir: <localstatedir>/lib/slapd-<servid>/schema
- * cf->lock_dir: <localstatedir>/lock/slapd-<servid>
- * cf->log_dir: <localstatedir>/log/slapd-<servid>
- * cf->run_dir: <localstatedir>/run/slapd-<servid>
- */
+
int parse_form(server_config_s *cf)
{
@@ -4915,103 +4793,94 @@ int parse_form(server_config_s *cf)
char* cfg_sspt_uid_pw2;
LDAPURLDesc *desc = 0;
char *temp = 0;
- char *prefix = NULL;
-
- cf->brand_ds = BRAND_DS;
- temp = getenv("NETSITE_ROOT");
- if (NULL == temp) {
- ds_report_error (DS_INCORRECT_USAGE,
- " NETSITE_ROOT environment variable not set.",
- "The environment variable NETSITE_ROOT must be set to the server root directory.");
- return 1;
- }
- cf->sroot = PL_strdup(temp);
+
+ if (!(cf->sroot = getenv("NETSITE_ROOT"))) {
+ ds_report_error (DS_INCORRECT_USAGE, " NETSITE_ROOT environment variable not set.",
+ "The environment variable NETSITE_ROOT must be set to the server root directory.");
+ return 1;
+ }
if (rm && qs && !strcmp(rm, "GET"))
- {
- ds_get_begin(qs);
- }
+ {
+ ds_get_begin(qs);
+ }
else if (ds_post_begin(stdin))
- {
- return 1;
- }
+ {
+ return 1;
+ }
if (rm)
- {
- printf("Content-type: text/plain\n\n");
- }
+ {
+ printf("Content-type: text/plain\n\n");
+ }
/* else we are being called from server installation; no output */
- temp = ds_a_get_cgi_var("prefix", NULL, NULL);
- if (NULL != temp) {
- prefix = cf->prefix = PL_strdup(temp);
- }
-
if (!(cf->servname = ds_a_get_cgi_var("servname", "Server Name",
- "Please give a hostname for your server.")))
- {
- return 1;
- }
+ "Please give a hostname for your server.")))
+ {
+ return 1;
+ }
- cf->bindaddr = ds_a_get_cgi_var("bindaddr", NULL, NULL);
+ cf->bindaddr = ds_a_get_cgi_var("bindaddr", NULL, NULL);
if (!(cf->servport = ds_a_get_cgi_var("servport", "Server Port",
- "Please specify the TCP port number for this server.")))
- {
- return 1;
- }
+ "Please specify the TCP port number for this server.")))
+ {
+ return 1;
+ }
+ cf->suitespot3x_uid = ds_a_get_cgi_var("suitespot3x_uid", NULL, NULL);
cf->cfg_sspt = ds_a_get_cgi_var("cfg_sspt", NULL, NULL);
cf->cfg_sspt_uid = ds_a_get_cgi_var("cfg_sspt_uid", NULL, NULL);
if (cf->cfg_sspt_uid && *(cf->cfg_sspt_uid) &&
- !(cf->cfg_sspt_uidpw = ds_a_get_cgi_var("cfg_sspt_uid_pw", NULL, NULL)))
- {
-
- if (!(cfg_sspt_uid_pw1 = ds_a_get_cgi_var("cfg_sspt_uid_pw1", "Password",
- "Enter the password for the Mission Control Administrator's account.")))
- {
- return 1;
- }
-
- if (!(cfg_sspt_uid_pw2 = ds_a_get_cgi_var("cfg_sspt_uid_pw2", "Password",
- "Enter the password for the Mission Control Administrator account, "
- "twice.")))
- {
- return 1;
- }
-
- if (strcmp (cfg_sspt_uid_pw1, cfg_sspt_uid_pw2) != 0)
- {
- ds_report_error (DS_INCORRECT_USAGE, " different passwords",
- "Enter the Mission Control Administrator account password again."
- " The two Mission Control Administrator account passwords "
- "you entered are different.");
- return 1;
- }
- if ( ((int) strlen(cfg_sspt_uid_pw1)) < 1 ) {
- ds_report_error (DS_INCORRECT_USAGE, " password too short",
- "The password must be at least 1 character long.");
- return 1;
- }
- cf->cfg_sspt_uidpw = cfg_sspt_uid_pw1;
- }
+ !(cf->cfg_sspt_uidpw = ds_a_get_cgi_var("cfg_sspt_uid_pw", NULL, NULL)))
+ {
+
+ if (!(cfg_sspt_uid_pw1 = ds_a_get_cgi_var("cfg_sspt_uid_pw1", "Password",
+ "Enter the password for the Mission Control Administrator's account.")))
+ {
+ return 1;
+ }
+
+ if (!(cfg_sspt_uid_pw2 = ds_a_get_cgi_var("cfg_sspt_uid_pw2", "Password",
+ "Enter the password for the Mission Control Administrator account, "
+ "twice.")))
+ {
+ return 1;
+ }
+
+ if (strcmp (cfg_sspt_uid_pw1, cfg_sspt_uid_pw2) != 0)
+ {
+ ds_report_error (DS_INCORRECT_USAGE, " different passwords",
+ "Enter the Mission Control Administrator account password again."
+ " The two Mission Control Administrator account passwords "
+ "you entered are different.");
+ return 1;
+ }
+ if ( ((int) strlen(cfg_sspt_uid_pw1)) < 1 ) {
+ ds_report_error (DS_INCORRECT_USAGE, " password too short",
+ "The password must be at least 1 character long.");
+ return 1;
+ }
+ cf->cfg_sspt_uidpw = cfg_sspt_uid_pw1;
+ }
if (cf->cfg_sspt && *cf->cfg_sspt && !strcmp(cf->cfg_sspt, "1") &&
- !cf->cfg_sspt_uid)
- {
- ds_report_error (DS_INCORRECT_USAGE,
- " Userid not specified",
- "A Userid for Mission Control Administrator must be specified.");
- return 1;
- }
+ !cf->cfg_sspt_uid)
+ {
+ ds_report_error (DS_INCORRECT_USAGE,
+ " Userid not specified",
+ "A Userid for Mission Control Administrator must be specified.");
+ return 1;
+ }
cf->start_server = ds_a_get_cgi_var("start_server", NULL, NULL);
cf->secserv = ds_a_get_cgi_var("secserv", NULL, NULL);
if (cf->secserv && strcmp(cf->secserv, "off"))
- cf->secservport = ds_a_get_cgi_var("secservport", NULL, NULL);
+ cf->secservport = ds_a_get_cgi_var("secservport", NULL, NULL);
if (!(cf->servid = ds_a_get_cgi_var("servid", "Server Identifier",
- "Please give your server a short identifier.")))
- {
- return 1;
- }
+ "Please give your server a short identifier.")))
+ {
+ return 1;
+ }
#ifdef XP_UNIX
cf->servuser = ds_a_get_cgi_var("servuser", NULL, NULL);
@@ -5020,177 +4889,82 @@ int parse_form(server_config_s *cf)
cf->suffix = dn_normalize_convert(ds_a_get_cgi_var("suffix", NULL, NULL));
if (cf->suffix == NULL) {
- cf->suffix = "";
+ cf->suffix = "";
}
cf->rootdn = dn_normalize_convert(ds_a_get_cgi_var("rootdn", NULL, NULL));
if (cf->rootdn && *(cf->rootdn)) {
- if (!(cf->rootpw = ds_a_get_cgi_var("rootpw", NULL, NULL)))
- {
- char* pw1 = ds_a_get_cgi_var("rootpw1", "Password",
- "Enter the password for the unrestricted user.");
- char* pw2 = ds_a_get_cgi_var("rootpw2", "Password",
- "Enter the password for the unrestricted user, twice.");
+ if (!(cf->rootpw = ds_a_get_cgi_var("rootpw", NULL, NULL)))
+ {
+ char* pw1 = ds_a_get_cgi_var("rootpw1", "Password",
+ "Enter the password for the unrestricted user.");
+ char* pw2 = ds_a_get_cgi_var("rootpw2", "Password",
+ "Enter the password for the unrestricted user, twice.");
- if (!pw1 || !pw2 || check_passwords(pw1, pw2))
- {
- return 1;
- }
+ if (!pw1 || !pw2 || check_passwords(pw1, pw2))
+ {
+ return 1;
+ }
- cf->rootpw = pw1;
- }
- /* Encode the password in SSHA by default */
- cf->roothashedpw = (char *)ds_salted_sha1_pw_enc (cf->rootpw);
+ cf->rootpw = pw1;
+ }
+ /* Encode the password in SSHA by default */
+ cf->roothashedpw = (char *)ds_salted_sha1_pw_enc (cf->rootpw);
}
cf->admin_domain = ds_a_get_cgi_var("admin_domain", NULL, NULL);
- if ((temp = ds_a_get_cgi_var("use_existing_config_ds", NULL, NULL))) {
- cf->use_existing_config_ds = atoi(temp);
- } else {
- cf->use_existing_config_ds = 1; /* there must already be one */
- }
+ if ((temp = ds_a_get_cgi_var("use_existing_config_ds", NULL, NULL))) {
+ cf->use_existing_config_ds = atoi(temp);
+ } else {
+ cf->use_existing_config_ds = 1; /* there must already be one */
+ }
- if ((temp = ds_a_get_cgi_var("use_existing_user_ds", NULL, NULL))) {
- cf->use_existing_config_ds = atoi(temp);
- } else {
- cf->use_existing_user_ds = 0; /* we are creating it */
- }
+ if ((temp = ds_a_get_cgi_var("use_existing_user_ds", NULL, NULL))) {
+ cf->use_existing_config_ds = atoi(temp);
+ } else {
+ cf->use_existing_user_ds = 0; /* we are creating it */
+ }
temp = ds_a_get_cgi_var("ldap_url", NULL, NULL);
if (temp && !ldap_url_parse(temp, &desc) && desc)
- {
- char *suffix;
- int isSSL;
-
- if (desc->lud_dn && *desc->lud_dn) { /* use given DN for netscaperoot suffix */
- cf->netscaperoot = strdup(desc->lud_dn);
- suffix = cf->netscaperoot;
- } else { /* use the default */
- suffix = dn_normalize_convert(strdup(cf->netscaperoot));
- }
- /* the config ds connection may require SSL */
- isSSL = !strncmp(temp, "ldaps:", strlen("ldaps:"));
- cf->config_ldap_url = PR_smprintf("ldap%s://%s:%d/%s",
- (isSSL ? "s" : ""), desc->lud_host,
- desc->lud_port, suffix);
- ldap_free_urldesc(desc);
- }
+ {
+ char *suffix;
+ int isSSL;
+
+ if (desc->lud_dn && *desc->lud_dn) { /* use given DN for netscaperoot suffix */
+ cf->netscaperoot = strdup(desc->lud_dn);
+ suffix = cf->netscaperoot;
+ } else { /* use the default */
+ suffix = dn_normalize_convert(strdup(cf->netscaperoot));
+ }
+ /* the config ds connection may require SSL */
+ isSSL = !strncmp(temp, "ldaps:", strlen("ldaps:"));
+ cf->config_ldap_url = PR_smprintf("ldap%s://%s:%d/%s",
+ (isSSL ? "s" : ""), desc->lud_host,
+ desc->lud_port, suffix);
+ ldap_free_urldesc(desc);
+ }
/* if being called as a CGI, the user_ldap_url will be the directory
we're creating */
/* this is the directory we're creating, and we cannot create an ssl
directory, so we don't have to worry about ldap vs ldaps here */
- if ((temp = ds_a_get_cgi_var("user_ldap_url", NULL, NULL))) {
- cf->user_ldap_url = strdup(temp);
- } else {
- cf->user_ldap_url = PR_smprintf("ldap://%s:%s/%s", cf->servname,
- cf->servport, cf->suffix);
- }
+ if ((temp = ds_a_get_cgi_var("user_ldap_url", NULL, NULL))) {
+ cf->user_ldap_url = strdup(temp);
+ } else {
+ cf->user_ldap_url = PR_smprintf("ldap://%s:%s/%s", cf->servname,
+ cf->servport, cf->suffix);
+ }
cf->samplesuffix = NULL;
cf->disable_schema_checking = ds_a_get_cgi_var("disable_schema_checking",
- NULL, NULL);
+ NULL, NULL);
cf->adminport = ds_a_get_cgi_var("adminport", NULL, NULL);
cf->install_ldif_file = ds_a_get_cgi_var("install_ldif_file", NULL, NULL);
- cf->localstatedir = set_path_attribute("localstatedir", LOCALSTATEDIR, prefix);
- cf->sysconfdir = set_path_attribute("sysconfdir", SYSCONFDIR, prefix);
- cf->bindir = set_path_attribute("bindir", BINDIR, prefix);
- cf->datadir = set_path_attribute("datadir", DATADIR, prefix);
- cf->docdir = set_path_attribute("docdir", DOCDIR, prefix);
-
- temp = ds_a_get_cgi_var("inst_dir", NULL, NULL);
- if (NULL == temp) {
- cf->inst_dir = PR_smprintf("%s%c%s-%s",
- cf->sroot, FILE_PATHSEP, PRODUCT_NAME, cf->servid);
- } else {
- cf->inst_dir = PL_strdup(temp);
- }
-
- temp = ds_a_get_cgi_var("config_dir", NULL, NULL);
- if (NULL == temp) {
- cf->config_dir = PR_smprintf("%s%clib%c%s-%s",
- cf->localstatedir, FILE_PATHSEP, FILE_PATHSEP,
- PRODUCT_NAME, cf->servid);
- } else {
- cf->config_dir = PL_strdup(temp);
- }
- /* set config dir to the environment variable DS_CONFIG_DIR */
- ds_set_config_dir(cf->config_dir);
-
- cf->schema_dir = ds_a_get_cgi_var("schema_dir", NULL, NULL);
- temp = ds_a_get_cgi_var("schema_dir", NULL, NULL);
- if (NULL == temp) {
- cf->schema_dir = PR_smprintf("%s%clib%c%s-%s%cschema",
- cf->localstatedir, FILE_PATHSEP, FILE_PATHSEP,
- PRODUCT_NAME, cf->servid, FILE_PATHSEP);
- } else {
- cf->schema_dir = PL_strdup(temp);
- }
-
- temp = ds_a_get_cgi_var("lock_dir", NULL, NULL);
- if (NULL == temp) {
- cf->lock_dir = PR_smprintf("%s%clock%c%s-%s",
- cf->localstatedir, FILE_PATHSEP, FILE_PATHSEP,
- PRODUCT_NAME, cf->servid);
- } else {
- cf->lock_dir = PL_strdup(temp);
- }
-
- temp = ds_a_get_cgi_var("log_dir", NULL, NULL);
- if (NULL == temp) {
-#if 0
- cf->log_dir = PR_smprintf("%s%clog%c%s-%s",
- cf->localstatedir, FILE_PATHSEP, FILE_PATHSEP,
- PRODUCT_NAME, cf->servid);
-#else /* will go away */
- cf->log_dir = PR_smprintf("%s%clogs",
- cf->inst_dir, FILE_PATHSEP);
-#endif
- } else {
- cf->log_dir = PL_strdup(temp);
- }
-
- temp = ds_a_get_cgi_var("run_dir", NULL, NULL);
- if (NULL == temp) {
- cf->run_dir = PR_smprintf("%s%crun%c%s-%s",
- cf->localstatedir, FILE_PATHSEP, FILE_PATHSEP,
- PRODUCT_NAME, cf->servid);
- } else {
- cf->run_dir = PL_strdup(temp);
- }
- /* set run dir to the environment variable DS_RUN_DIR */
- ds_set_run_dir(cf->run_dir);
-
- temp = ds_a_get_cgi_var("db_dir", NULL, NULL);
- if (NULL == temp) {
- cf->db_dir = PR_smprintf("%s%clib%c%s-%s%cdb",
- cf->localstatedir, FILE_PATHSEP, FILE_PATHSEP,
- PRODUCT_NAME, cf->servid, FILE_PATHSEP);
- } else {
- cf->db_dir = PL_strdup(temp);
- }
-
- temp = ds_a_get_cgi_var("bak_dir", NULL, NULL);
- if (NULL == temp) {
- cf->bak_dir = PR_smprintf("%s%clib%c%s-%s%cbak",
- cf->localstatedir, FILE_PATHSEP, FILE_PATHSEP,
- PRODUCT_NAME, cf->servid, FILE_PATHSEP);
- } else {
- cf->bak_dir = PL_strdup(temp);
- }
-
- temp = ds_a_get_cgi_var("ldif_dir", NULL, NULL);
- if (NULL == temp) {
- cf->ldif_dir = PR_smprintf("%s%c%s%cldif",
- cf->datadir, FILE_PATHSEP, BRAND_DS, FILE_PATHSEP);
- } else {
- cf->ldif_dir = PL_strdup(temp);
- }
-
return 0;
}
diff --git a/ldap/admin/src/create_instance.h b/ldap/admin/src/create_instance.h
index 89500cf6..2102cbe7 100644
--- a/ldap/admin/src/create_instance.h
+++ b/ldap/admin/src/create_instance.h
@@ -49,46 +49,31 @@
extern "C" { /* Assume C declarations for C++ */
#endif /* __cplusplus */
-#define BRAND_DS "fedora-ds"
-#define DS_CONFIG_DIR "DS_CONFIG_DIR"
-#define DS_CONFIG_FILE "dse.ldif"
#ifdef XP_UNIX
-#define PRODUCT_NAME "slapd"
-#define PRODUCT_BIN "ns-slapd"
-#endif
+#define PRODUCT_NAME "slapd"
-#define LOCALSTATEDIR "/var"
-#define SYSCONFDIR "/etc"
-#define BINDIR "/bin"
-#define DATADIR "/share"
-#define DOCDIR "/usr/doc"
+#define PRODUCT_BIN "ns-slapd"
-typedef struct {
- char *sroot; /* _libdir */
- char *localstatedir;
- char *sysconfdir;
- char *bindir;
- char *datadir;
- char *docdir;
+#endif
- char *brand_ds;
- char *lang;
+typedef struct {
+ char *sroot;
char *servname;
char *bindaddr;
char *servport;
- char *suitespot3x_uid;
- char *cfg_sspt;
- char *cfg_sspt_uid;
- char *cfg_sspt_uidpw;
+ char *suitespot3x_uid;
+ char *cfg_sspt;
+ char *cfg_sspt_uid;
+ char *cfg_sspt_uidpw;
char *secserv;
char *secservport;
char *ntsynch;
char *ntsynchssl;
char *ntsynchport;
char *rootdn;
- char *rootpw;
+ char *rootpw;
char *roothashedpw;
char *replicationdn;
char *replicationpw;
@@ -99,10 +84,10 @@ typedef struct {
char *changelogdir;
char *changelogsuffix;
char *suffix;
- char *loglevel;
- char *netscaperoot;
- char *samplesuffix;
- char *testconfig;
+ char *loglevel;
+ char *netscaperoot;
+ char *samplesuffix;
+ char *testconfig;
char *servid;
#ifdef XP_UNIX
char *servuser;
@@ -112,26 +97,16 @@ typedef struct {
char *maxthreads;
int upgradingServer;
- char * start_server;
-
- char * admin_domain;
- char * config_ldap_url;
- char * user_ldap_url;
- int use_existing_user_ds;
- int use_existing_config_ds;
- char * disable_schema_checking;
- char * install_ldif_file;
- char *adminport;
- char *inst_dir;
- char *config_dir;
- char *schema_dir;
- char *lock_dir;
- char *log_dir;
- char *run_dir;
- char *db_dir;
- char *bak_dir;
- char *ldif_dir;
- char *prefix;
+ char * start_server;
+
+ char * admin_domain;
+ char * config_ldap_url;
+ char * user_ldap_url;
+ int use_existing_user_ds;
+ int use_existing_config_ds;
+ char * disable_schema_checking;
+ char * install_ldif_file;
+ char *adminport;
} server_config_s;
diff --git a/ldap/admin/src/ds_newinst.c b/ldap/admin/src/ds_newinst.c
index 79ee7fa9..6f686cf3 100644
--- a/ldap/admin/src/ds_newinst.c
+++ b/ldap/admin/src/ds_newinst.c
@@ -145,7 +145,6 @@ int main(int argc, char *argv[], char *envp[])
#if defined( hpux )
_exit(status);
-#else
- exit(status);
#endif
+ return status;
}
diff --git a/ldap/admin/src/ds_newinst.pl b/ldap/admin/src/ds_newinst.pl
index b138f184..ca2dd9c6 100644
--- a/ldap/admin/src/ds_newinst.pl
+++ b/ldap/admin/src/ds_newinst.pl
@@ -213,10 +213,6 @@ if ($table{General}->{UserDirectoryLdapURL}) {
$cgiargs{user_ldap_url} = $cgiargs{ldap_url};
}
-if ($table{General}->{prefix}) {
- $cgiargs{prefix} = $table{General}->{prefix};
-}
-
# populate the DS with this file - the suffix in this file must
# be the suffix specified in the suffix argument above
# the filename should use the full absolute path
diff --git a/ldap/admin/src/makemccvlvindexes b/ldap/admin/src/makemccvlvindexes
index dd2c6b36..03717b00 100644
--- a/ldap/admin/src/makemccvlvindexes
+++ b/ldap/admin/src/makemccvlvindexes
@@ -235,9 +235,9 @@ if($really_do_it eq "1" && $#vlvnames > 0)
print "\n";
print "$#vlvnames VLV indices have been declared. Execute the following commands to build the index files.\n";
print "\n";
- print "<config-dir>\\stop\n";
- print "slapd db2index -f <config-dir> -V @vlvnames\n";
- print "<config-dir>\\start\n";
+ print "<instance-dir>\\stop\n";
+ print "slapd db2index -f <instance-dir>\\config\\slapd.conf -V @vlvnames\n";
+ print "<instance-dir>\\start\n";
}
diff --git a/ldap/cm/Makefile b/ldap/cm/Makefile
index 0a73354d..4d1cdc9d 100644
--- a/ldap/cm/Makefile
+++ b/ldap/cm/Makefile
@@ -418,7 +418,9 @@ ifeq ($(USE_DSGW), 1)
then $(INSTALL) -m 755 $$file $(RELDIR)/clients/lib ; \
fi ; \
done
-endif
+# the httpd library
+ $(INSTALL) -m 755 $(OBJDIR)/$(NSHTTPD_DLL)$(DLL_PRESUF).$(DLL_SUFFIX)* $(RELDIR)/clients/lib
+endif # USE_DSGW
ifeq ($(PACKAGE_LIB32), 1)
# these are files to copy to the shared32/lib directory - nspr, nss, ldapsdk lib
for file in $(LIBS_TO_PKG_SHARED_32); \
diff --git a/ldap/cm/newinst/setup b/ldap/cm/newinst/setup
index ac2d39e2..cc38ce88 100755
--- a/ldap/cm/newinst/setup
+++ b/ldap/cm/newinst/setup
@@ -157,6 +157,10 @@ inffile=
tmpinffile=
nextisinffile=
keepinffile=
+# set by user or from existing files during upgrade
+user=
+# set by user or from existing files during upgrade
+group=
for arg in "$@" ; do
if [ "$arg" = "-s" ]; then
silent=1
@@ -227,6 +231,7 @@ adminSSLOff() {
echo $conffile=$security >> $tmpfile
cat $conffile | sed -e "s/^\($security\) .*/\1 off/g" > $conffile.01
mv $conffile.01 $conffile
+ chown $user:$group $conffile
echo "$conffile: SSL off ..."
fi
fi
@@ -248,6 +253,7 @@ adminXmlSSLOff() {
echo $conffile=$confparam >> $tmpfile
cat $conffile | sed -e "s/\([Ss][Ee][Cc][Uu][Rr][Ii][Tt][Yy]=\)\"[A-Za-z]*\"/\1\"off\"/g" > $conffile.0
mv $conffile.0 $conffile
+ chown $user:$group $conffile
echo "$conffile: SSL off ..."
fi
sslparams0=`grep -i "<.*SSLPARAMS " $conffile`
@@ -263,6 +269,7 @@ echo adminXmlSSLOff: SSLPARAMS off
sslparams=`echo $sslparams1 | sed -e 's/\"/\\\\\"/g'`
cat $conffile | sed -e "s/\($sslparams\)/\<\!-- \1 --\>/g" > $conffile.1
mv $conffile.1 $conffile
+ chown $user:$group $conffile
fi
fi
}
@@ -282,6 +289,7 @@ SSLOff() {
$dir/stop-slapd
cat $dir/config/dse.ldif | sed -e "s/\($security\) .*/\1 off/g" > $dir/config/dse.ldif.0
mv $dir/config/dse.ldif.0 $dir/config/dse.ldif
+ chown $user:$group $dir/config/dse.ldif
echo "$dir/config/dse.ldif: SSL off ..."
fi
fi
@@ -308,6 +316,7 @@ adminSSLOn() {
if [ -f $conffile ]; then
cat $conffile | sed -e "s/^\($confparam\) .*/\1 on/g" > $conffile.00
mv $conffile.00 $conffile
+ chown $user:$group $conffile
echo "$conffile $confparam: SSL on ..."
fi
}
@@ -317,6 +326,7 @@ adminXmlSSLOn() {
if [ -f $conffile ]; then
cat $conffile | sed -e "s/\([Ss][Ee][Cc][Uu][Rr][Ii][Tt][Yy]=\)\"[A-Za-z]*\"/\1\"on\"/g" > $conffile.2
mv $conffile.2 $conffile
+ chown $user:$group $conffile
fi
grep -i "<.*SSLPARAMS " $conffile > /dev/null 2>&1
rval=$?
@@ -324,6 +334,7 @@ adminXmlSSLOn() {
then
cat $conffile | sed -e "s/<\!-- *$sslparams *-->/$sslparams/g" > $conffile.3
mv $conffile.3 $conffile
+ chown $user:$group $conffile
fi
echo "$conffile: SSL on ..."
}
@@ -336,6 +347,7 @@ SSLOn() {
$dir/stop-slapd
cat $dir/config/dse.ldif | sed -e "s/\($security\) .*/\1 on/g" > $dir/config/dse.ldif.0
mv $dir/config/dse.ldif.0 $dir/config/dse.ldif
+ chown $user:$group $dir/config/dse.ldif
echo "$dir/config/dse.ldif: SSL on ..."
echo "Restarting Directory Server: $dir/start-slapd"
$dir/start-slapd
@@ -370,9 +382,14 @@ SSLOn() {
# check whether it is an in-place installation
if [ -f $sroot/admin-serv/config/adm.conf ]; then
+ dsinst=`getValFromAdminConf "ldapStart:" "adm.conf" | awk -F/ '{print $1}'`
+ if [ -f $sroot/$dsinst/config/dse.ldif ]; then
+ user=`ls -l $sroot/$dsinst/config/dse.ldif | awk '{print $3}'`
+ group=`ls -l $sroot/$dsinst/config/dse.ldif | awk '{print $4}'`
+ fi
+
SSLOff
- dsinst=`getValFromAdminConf "ldapStart:" "adm.conf" | awk -F/ '{print $1}'`
if [ -f $sroot/$dsinst/config/dse.ldif ]; then
# it is an in=place installation
ldaphost=`getValFromAdminConf "ldapHost:" "adm.conf"`
@@ -380,8 +397,6 @@ if [ -f $sroot/admin-serv/config/adm.conf ]; then
adminport=`getValFromAdminConf "\<port:" "adm.conf"`
adminid=`getValFromAdmpw "admpw"`
sysuser=`getValFromAdminConf "nsSuiteSpotUser:" "local.conf"`
- suitespotuser=`ls -l $sroot/$dsinst/config/dse.ldif | awk '{print $3}'`
- suitespotgroup=`ls -l $sroot/$dsinst/config/dse.ldif | awk '{print $4}'`
admindomain=`echo $ldaphost | awk -F. '{print $5 ? $2 "." $3 "." $4 "." $5: $4 ? $2 "." $3 "." $4 : $3 ? $2 "." $3 : $2 ? $2 : ""}'`
if [ "$admindomain" = "" ]; then
admindomain=`domainname`
@@ -405,8 +420,8 @@ if [ -f $sroot/admin-serv/config/adm.conf ]; then
inffile=$sroot/setup/myinstall.inf
echo "[General]" > $inffile
echo "FullMachineName= $ldaphost" >> $inffile
- echo "SuiteSpotUserID= $suitespotuser" >> $inffile
- echo "SuitespotGroup= $suitespotgroup" >> $inffile
+ echo "SuiteSpotUserID= $user" >> $inffile
+ echo "SuitespotGroup= $group" >> $inffile
echo "ServerRoot= $sroot" >> $inffile
echo "ConfigDirectoryLdapURL= ldap://$ldaphost:$ldapport/o=NetscapeRoot" >> $inffile
echo "ConfigDirectoryAdminID= $adminid" >> $inffile
diff --git a/ldap/cm/newinst/ux-dialog.cc b/ldap/cm/newinst/ux-dialog.cc
index 4f4c010d..7de31488 100644
--- a/ldap/cm/newinst/ux-dialog.cc
+++ b/ldap/cm/newinst/ux-dialog.cc
@@ -1034,7 +1034,7 @@ askSampleNext(Dialog *me)
return DIALOG_NEXT;
}
-DialogYesNo askPopulate(
+DialogInput askPopulate(
"You may wish to populate your new directory instance with some data.\n"
"You may already have a file in LDIF format to use or some suggested\n"
"entries can be added. If you want to import entries from an LDIF\n"
@@ -1074,7 +1074,9 @@ askPopulateSetup(Dialog *me)
}
dialogSetup(me, SLAPD_KEY_INSTALL_LDIF_FILE, "none");
- me->setInputLen(1024); // it seems to get reset somewhere . . .
+ // max input buffer size is sizeof(Dialog::_buf)-1
+ // Dialog::_buf is defined as char[MED_BUF]
+ me->setInputLen(MED_BUF-1); // it seems to get reset somewhere . . .
long setupval = 0;
if (me->getUserData(SETUP_DEFAULTS, setupval) == SETUP_ONLY ||
diff --git a/ldap/cm/newinst/ux-dialog.h b/ldap/cm/newinst/ux-dialog.h
index 26ef8302..5b892480 100644
--- a/ldap/cm/newinst/ux-dialog.h
+++ b/ldap/cm/newinst/ux-dialog.h
@@ -54,7 +54,7 @@ extern DialogInput askSlapdSuffix;
extern DialogInput askSlapdRootDN;
extern DialogYesNo askReplication;
extern DialogYesNo askSample;
-extern DialogYesNo askPopulate;
+extern DialogInput askPopulate;
extern DialogInput askOrgSize;
extern DialogYesNo askCIR;
extern DialogInput askCIRHost;
diff --git a/ldap/docs/README.txt b/ldap/docs/README.txt
index ceffd251..f5c2bda2 100644
--- a/ldap/docs/README.txt
+++ b/ldap/docs/README.txt
@@ -1,5 +1,5 @@
=======================================================================
- Fedora Directory Server 1.0.3
+ Fedora Directory Server 1.0.4
=======================================================================
The Fedora Directory Server is subject to the terms detailed in the
diff --git a/ldap/servers/plugins/Makefile b/ldap/servers/plugins/Makefile
index 48e3c925..64854009 100644
--- a/ldap/servers/plugins/Makefile
+++ b/ldap/servers/plugins/Makefile
@@ -51,13 +51,14 @@ NSPR20=true # probably should be defined somewhere else (not sure where)
include $(BUILD_ROOT)/nsconfig.mk
include $(LDAP_SRC)/nsldap.mk
+PLUGINS = _referint _collation _syntaxes _passthru _utils _uiduniq _roles _acl _replication _cos _pwdstorage _rever _chainingdb _distrib _retrocl _statechange _http _views
ifneq ($(ARCH), WINNT)
-all: _referint _collation _syntaxes _passthru _utils _uiduniq _roles _acl _replication _cos _pwdstorage _rever _chainingdb _distrib _retrocl _statechange _http _views
-# richm 20050303 - do not build pam pass thru for DS 7.1
-#all: _referint _collation _syntaxes _passthru _utils _uiduniq _roles _acl _replication _cos _pwdstorage _rever _chainingdb _distrib _retrocl _statechange _http _views _pam_passthru
-else
-all: _referint _collation _syntaxes _passthru _utils _uiduniq _roles _acl _replication _cos _pwdstorage _rever _chainingdb _distrib _retrocl _statechange _http _views
+ifneq ($(BRAND), redhat)
+PLUGINS += _pam_passthru
endif
+endif
+
+all: $(PLUGINS)
_utils:
cd shared; $(MAKE) $(MFLAGS) all
diff --git a/ldap/servers/plugins/chainingdb/cb_search.c b/ldap/servers/plugins/chainingdb/cb_search.c
index 5facadc2..0d898a39 100644
--- a/ldap/servers/plugins/chainingdb/cb_search.c
+++ b/ldap/servers/plugins/chainingdb/cb_search.c
@@ -179,7 +179,7 @@ chainingdb_build_candidate_list ( Slapi_PBlock *pb )
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_ENTRY, NULL );
return 1;
}
- timeout.tv_sec=(time_t)timelimit-(now-optime);
+ timeout.tv_sec=timelimit-(now-optime);
timeout.tv_usec=0;
}
@@ -414,10 +414,7 @@ chainingdb_next_search_entry ( Slapi_PBlock *pb )
{
char *target;
- int sizelimit, timelimit;
- int rc, parse_rc, retcode;
- int i, attrsonly;
- time_t optime;
+ int sizelimit,timelimit, rc, parse_rc, optime,i,retcode, attrsonly;
LDAPMessage *res=NULL;
char *matched_msg,*error_msg;
cb_searchContext *ctx=NULL;
diff --git a/ldap/servers/slapd/auth.c b/ldap/servers/slapd/auth.c
index f7bf89db..56fa517e 100644
--- a/ldap/servers/slapd/auth.c
+++ b/ldap/servers/slapd/auth.c
@@ -272,27 +272,41 @@ void
client_auth_init ()
{
char *instancedir;
+ int len = 0;
+ char *val = NULL;
+ char* filename;
+ char netsite_root[MAXPATHLEN];
int err;
if (client_auth_config_file == NULL) {
- char *confdir = config_get_configdir();
- if (NULL == confdir) {
- LDAPDebug (LDAP_DEBUG_ANY,
- "client_auth_init: failed to get configdir\n",
- 0, 0, 0);
- return;
- }
- client_auth_config_file = PR_smprintf("%s/certmap.conf", confdir);
- if (NULL == client_auth_config_file) {
- LDAPDebug (LDAP_DEBUG_ANY,
- "client_auth_init: failed to duplicate \"%s/certmap\"\n",
- confdir, 0, 0);
- return;
- }
+ client_auth_config_file = "shared/config/certmap.conf";
}
- err = ldaputil_init (client_auth_config_file, "", NULL, "slapd", NULL);
+
+ /* calculate the server_root from instance dir */
+ instancedir = config_get_instancedir();
+ /* make sure path does not end in the path separator character */
+ len = strlen(instancedir);
+ if (instancedir[len-1] == '/' || instancedir[len-1] == '\\') {
+ instancedir[len-1] = '\0';
+ }
+
+ /* get the server root from the path */
+ val = strrchr(instancedir, '/');
+ if (!val) {
+ val = strrchr(instancedir, '\\');
+ }
+ if (val) {
+ val++;
+ *val = '\0';
+ }
+
+ PL_strncpyz(netsite_root, instancedir, MAXPATHLEN);
+ slapi_ch_free_string(&instancedir);
+ filename = PR_smprintf("%s%s", netsite_root, client_auth_config_file);
+
+ err = ldaputil_init (filename, "", netsite_root, "slapd", NULL);
if (err != LDAPU_SUCCESS) {
LDAPDebug (LDAP_DEBUG_TRACE, "ldaputil_init(%s,...) %i\n",
- client_auth_config_file, err, 0);
+ filename, err, 0);
} else {
LDAPUVTable_t vtable = {
NULL /* ssl_init */,
@@ -315,6 +329,9 @@ client_auth_init ()
slapu_value_free_len};
ldapu_VTable_set (&vtable);
}
+ PR_smprintf_free (filename);
+ /* why do we define these strings if we never use them? */
+ if (ldapu_strings != NULL);
/* Generate a component id for cert-based authentication */
generate_id();
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c
index 2168e514..d117d1d9 100644
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
@@ -683,7 +683,6 @@ static void dblayer_init_dbenv(DB_ENV *pEnv, dblayer_private *priv)
#endif
#ifdef LINUX
#include <linux/kernel.h>
-#include <linux/sys.h>
#include <sys/sysinfo.h> /* undocumented (?) */
#include <sys/resource.h>
#endif
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_search.c b/ldap/servers/slapd/back-ldbm/ldbm_search.c
index b02c90c4..34a7aada 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_search.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_search.c
@@ -422,7 +422,7 @@ ldbm_back_search( Slapi_PBlock *pb )
if (sort && (NULL != candidates))
{
time_t optime = 0;
- time_t tlimit = 0;
+ int tlimit = 0;
slapi_pblock_get( pb, SLAPI_SEARCH_TIMELIMIT, &tlimit );
slapi_pblock_get( pb, SLAPI_OPINITIATED_TIME, &optime );
diff --git a/ldap/servers/slapd/back-ldif/search.c b/ldap/servers/slapd/back-ldif/search.c
index f66b4c97..e93cd85c 100644
--- a/ldap/servers/slapd/back-ldif/search.c
+++ b/ldap/servers/slapd/back-ldif/search.c
@@ -143,7 +143,7 @@ ldif_back_search( Slapi_PBlock *pb )
/*Make sure we're not exceeding our time limit...*/
currtime = time(&dummy);
- if ((tlimit > 0) && ((currtime - optime) > (time_t)tlimit)){
+ if ((tlimit > 0) && ((currtime - optime) > tlimit)){
slapi_send_ldap_result( pb, LDAP_TIMELIMIT_EXCEEDED, NULL, NULL, nentries, NULL);
/*We "hit" the cache*/
diff --git a/ldap/servers/slapd/config.c b/ldap/servers/slapd/config.c
index 9cfdd8d4..ed012c2a 100644
--- a/ldap/servers/slapd/config.c
+++ b/ldap/servers/slapd/config.c
@@ -160,40 +160,30 @@ slapd_bootstrap_config(const char *configdir)
char *buf = 0;
char *lastp = 0;
char *entrystr = 0;
- char *instancedir = NULL;
- if (NULL == configdir) {
- slapi_log_error(SLAPI_LOG_FATAL,
- "startup", "Passed null config directory\n");
- return rc; /* Fail */
- }
PR_snprintf(configfile, sizeof(configfile), "%s/%s", configdir,
- CONFIG_FILENAME);
+ CONFIG_FILENAME);
if ( (rc = PR_GetFileInfo( configfile, &prfinfo )) != PR_SUCCESS )
{
/* the "real" file does not exist; see if there is a tmpfile */
char tmpfile[MAXPATHLEN+1];
- slapi_log_error(SLAPI_LOG_FATAL, "config",
- "The configuration file %s does not exist\n", configfile);
PR_snprintf(tmpfile, sizeof(tmpfile), "%s/%s.tmp", configdir,
- CONFIG_FILENAME);
+ CONFIG_FILENAME);
if ( PR_GetFileInfo( tmpfile, &prfinfo ) == PR_SUCCESS ) {
rc = PR_Rename(tmpfile, configfile);
if (rc == PR_SUCCESS) {
slapi_log_error(SLAPI_LOG_FATAL, "config",
"The configuration file %s was restored from backup %s\n",
configfile, tmpfile);
+ rc = 1;
} else {
slapi_log_error(SLAPI_LOG_FATAL, "config",
"The configuration file %s was not restored from backup %s, error %d\n",
configfile, tmpfile, rc);
- return rc; /* Fail */
+ rc = 0;
}
} else {
- slapi_log_error(SLAPI_LOG_FATAL, "config",
- "The backup configuration file %s does not exist, either.\n",
- tmpfile);
- return rc; /* Fail */
+ rc = 0; /* fail */
}
}
if ( (rc = PR_GetFileInfo( configfile, &prfinfo )) != PR_SUCCESS )
@@ -201,7 +191,7 @@ slapd_bootstrap_config(const char *configdir)
PRErrorCode prerr = PR_GetError();
slapi_log_error(SLAPI_LOG_FATAL, "config", "The given config file %s could not be accessed, " SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
configfile, prerr, slapd_pr_strerror(prerr));
- return rc;
+ rc = 0; /* Fail */
}
else if (( prfd = PR_Open( configfile, PR_RDONLY,
SLAPD_DEFAULT_FILE_MODE )) == NULL )
@@ -209,7 +199,7 @@ slapd_bootstrap_config(const char *configdir)
PRErrorCode prerr = PR_GetError();
slapi_log_error(SLAPI_LOG_FATAL, "config", "The given config file %s could not be opened for reading, " SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
configfile, prerr, slapd_pr_strerror(prerr));
- return rc; /* Fail */
+ rc = 0; /* Fail */
}
else
{
@@ -228,7 +218,7 @@ slapd_bootstrap_config(const char *configdir)
if(!done)
{
- char workpath[MAXPATHLEN+1];
+ char errorlog[MAXPATHLEN+1];
char loglevel[BUFSIZ];
char maxdescriptors[BUFSIZ];
char val[BUFSIZ];
@@ -237,7 +227,7 @@ slapd_bootstrap_config(const char *configdir)
char schemacheck[BUFSIZ];
Slapi_DN plug_dn;
- workpath[0] = loglevel[0] = maxdescriptors[0] = '\0';
+ errorlog[0] = loglevel[0] = maxdescriptors[0] = '\0';
val[0] = logenabled[0] = schemacheck[0] = '\0';
_localuser[0] = '\0';
@@ -262,28 +252,6 @@ slapd_bootstrap_config(const char *configdir)
continue;
}
- /* if instancedir is not set, set it first */
- {
- instancedir = config_get_instancedir();
- if (NULL == instancedir) {
- workpath[0] = '\0';
- if (entry_has_attr_and_value(e,
- CONFIG_INSTANCEDIR_ATTRIBUTE,
- workpath, sizeof(workpath))) {
- if (config_set_instancedir(
- CONFIG_INSTANCEDIR_ATTRIBUTE,
- workpath, errorbuf, CONFIG_APPLY)
- != LDAP_SUCCESS) {
- LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s\n",
- configfile, CONFIG_INSTANCEDIR_ATTRIBUTE,
- errorbuf);
- }
- }
- } else {
- slapi_ch_free((void **)&instancedir);
- }
- }
-
/* increase file descriptors */
#if !defined(_WIN32) && !defined(AIX)
if (!maxdescriptors[0] &&
@@ -333,13 +301,12 @@ slapd_bootstrap_config(const char *configdir)
#endif
/* set the log file name */
- workpath[0] = '\0';
- if (!workpath[0] &&
+ if (!errorlog[0] &&
entry_has_attr_and_value(e, CONFIG_ERRORLOG_ATTRIBUTE,
- workpath, sizeof(workpath)))
+ errorlog, sizeof(errorlog)))
{
if (config_set_errorlog(CONFIG_ERRORLOG_ATTRIBUTE,
- workpath, errorbuf, CONFIG_APPLY) != LDAP_SUCCESS)
+ errorlog, errorbuf, CONFIG_APPLY) != LDAP_SUCCESS)
{
LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s. \n", configfile,
CONFIG_ERRORLOG_ATTRIBUTE, errorbuf);
@@ -518,18 +485,6 @@ slapd_bootstrap_config(const char *configdir)
slapi_entry_free(e);
}
- /*
- * check if the instance dir is set.
- */
- if ( NULL == ( instancedir = config_get_instancedir() )) {
- slapi_log_error(SLAPI_LOG_FATAL, "startup",
- "Instance directory is not specifiled in the file %s. It is mandatory.\n",
- configfile);
- exit (1);
- } else {
- slapi_ch_free((void **)&instancedir);
- }
-
/* kexcoff: initialize rootpwstoragescheme and pw_storagescheme
* if not explicilty set in the config file
*/
diff --git a/ldap/servers/slapd/dse.c b/ldap/servers/slapd/dse.c
index 2cf78577..c26f9fc1 100644
--- a/ldap/servers/slapd/dse.c
+++ b/ldap/servers/slapd/dse.c
@@ -38,9 +38,10 @@
/*
* dse.c - DSE (DSA-Specific Entry) persistent storage.
*
- * 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.
+ * The DSE store is an LDIF file contained in the file
+ * INSTANCEDIR/config/XXX.ldif, where INSTANCEDIR is
+ * the directory of the server instance, and XXX is
+ * dfined by the caller of dse_new.
*
* In core, the DSEs are stored in an AVL tree, keyed on
* DN. Whenever a modification is made to a DSE, the
@@ -353,15 +354,14 @@ struct dse *
dse_new( char *filename, char *tmpfilename, char *backfilename, char *startokfilename, const char *configdir)
{
struct dse *pdse= NULL;
+ const char *config_sub_dir = "config";
+ char *id = config_get_instancedir();
char *realconfigdir = NULL;
- if (configdir!=NULL)
- {
- realconfigdir = slapi_ch_strdup(configdir);
- }
- else
- {
- realconfigdir = config_get_configdir();
+ if (configdir!=NULL) {
+ realconfigdir = slapi_ch_strdup(configdir);
+ } else if (id!=NULL) {
+ realconfigdir = slapi_ch_smprintf("%s/%s", id, config_sub_dir);
}
if(realconfigdir!=NULL)
{
@@ -412,6 +412,7 @@ dse_new( char *filename, char *tmpfilename, char *backfilename, char *startokfil
}
slapi_ch_free( (void **) &realconfigdir );
}
+ slapi_ch_free( (void **) &id );
return pdse;
}
diff --git a/ldap/servers/slapd/fedse.c b/ldap/servers/slapd/fedse.c
index 9e2ef358..ef3034d4 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 dse.ldif.
- * The file is located in the directory specified with '-D'
- * when staring the server.
+ * The DSE store is an LDIF file contained in the file
+ * INSTANCEDIR/config/dse.ldif, where INSTANCEDIR is
+ * the directory of the server instance.
*
* In core, the DSEs are stored in an AVL tree, keyed on
* DN. Whenever a modification is made to a DSE, the
@@ -1866,54 +1866,48 @@ 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);
}
- else
- {
- realconfigdir = config_get_configdir();
- }
+ slapi_ch_free_string(&id);
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);
- }
-
- if (!strstr(startokfilename, realconfigdir))
- {
- dse_filestartOK = slapi_ch_smprintf("%s/%s",
- realconfigdir, startokfilename);
- }
- else
- {
- dse_filestartOK = slapi_ch_strdup(startokfilename);
- }
+ /* 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);
- 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);
+
+ 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;
+ return rc;
}
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index 7cb039b4..0ddb5fcf 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -513,16 +513,9 @@ static struct config_get_and_set {
CONFIG_CONSTANT_STRING, NULL},
{CONFIG_HASH_FILTERS_ATTRIBUTE, config_set_hash_filters,
NULL, 0, NULL, CONFIG_ON_OFF, (ConfigGetFunc)config_get_hash_filters},
- {CONFIG_INSTANCEDIR_ATTRIBUTE, config_set_instancedir,
+ {CONFIG_INSTANCEDIR_ATTRIBUTE, NULL /* read only */,
NULL, 0,
(void**)&global_slapdFrontendConfig.instancedir, CONFIG_STRING, NULL},
- /* parameterizing schema dir */
- {CONFIG_SCHEMADIR_ATTRIBUTE, config_set_schemadir,
- NULL, 0,
- (void**)&global_slapdFrontendConfig.schemadir, CONFIG_STRING, NULL},
- /* parameterizing ldif dir */
- {CONFIG_LDIFDIR_ATTRIBUTE, config_set_ldifdir,
- NULL, 0, NULL, CONFIG_STRING, NULL},
{CONFIG_REWRITE_RFC1274_ATTRIBUTE, config_set_rewrite_rfc1274,
NULL, 0,
(void**)&global_slapdFrontendConfig.rewrite_rfc1274, CONFIG_ON_OFF, NULL},
@@ -2351,7 +2344,7 @@ config_set_instancedir( const char *attrname, char *value, char *errorbuf, int a
/* Set the slapd type also */
config_set_slapd_type ();
- /* Set the configdir if not set (it must be set since 7.2) */
+ /* Set the configdir if not set */
if (!slapdFrontendConfig->configdir)
{
char newdir[MAXPATHLEN+1];
@@ -4227,49 +4220,6 @@ config_set_configdir(const char *attrname, char *value, char *errorbuf, int appl
return retVal;
}
-char *
-config_get_schemadir()
-{
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char *retVal;
-
- CFG_LOCK_READ(slapdFrontendConfig);
- retVal = config_copy_strval(slapdFrontendConfig->schemadir);
- CFG_UNLOCK_READ(slapdFrontendConfig);
-
- return retVal;
-}
-
-int
-config_set_schemadir(const char *attrname, char *value, char *errorbuf, int apply)
-{
- int retVal = LDAP_SUCCESS;
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
- if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
- return LDAP_OPERATIONS_ERROR;
- }
-
- if (!apply) {
- return retVal;
- }
-
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapi_ch_free((void **)&slapdFrontendConfig->schemadir);
-
- slapdFrontendConfig->schemadir = slapi_ch_strdup(value);
-
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
- return retVal;
-}
-
-int
-config_set_ldifdir(const char *attrname, char *value, char *errorbuf, int apply)
-{
- /* noop */
- return LDAP_SUCCESS;
-}
-
char **
config_get_errorlog_list()
{
diff --git a/ldap/servers/slapd/main.c b/ldap/servers/slapd/main.c
index 514ce88d..e09f8862 100644
--- a/ldap/servers/slapd/main.c
+++ b/ldap/servers/slapd/main.c
@@ -255,7 +255,7 @@ chown_dir_files(char *name, struct passwd *pw, PRBool strip_fn)
}
/* Changes the owner of the files in the logs and
- * config directory to the user that the server runs as.
+ * config directorys to the user that the server runs as.
*/
static void
@@ -276,26 +276,13 @@ fix_ownership()
}
/* The instance directory needs to be owned by the local user */
- if (slapdFrontendConfig->instancedir) {
- slapd_chown_if_not_owner(slapdFrontendConfig->instancedir,
- pw->pw_uid, -1);
- }
- /* config directory */
- if (slapdFrontendConfig->configdir) {
- chown_dir_files(slapdFrontendConfig->configdir, pw, PR_FALSE);
- }
- /* do access log file, if any */
- if (slapdFrontendConfig->accesslog) {
- chown_dir_files(slapdFrontendConfig->accesslog, pw, PR_TRUE);
- }
- /* do audit log file, if any */
- if (slapdFrontendConfig->auditlog) {
- chown_dir_files(slapdFrontendConfig->auditlog, pw, PR_TRUE);
- }
- /* do error log file, if any */
- if (slapdFrontendConfig->errorlog) {
- chown_dir_files(slapdFrontendConfig->errorlog, pw, PR_TRUE);
- }
+ slapd_chown_if_not_owner( slapdFrontendConfig->instancedir, pw->pw_uid, -1 );
+ PR_snprintf(dirname,sizeof(dirname),"%s/config",slapdFrontendConfig->instancedir);
+ chown_dir_files(dirname, pw, PR_FALSE); /* config directory */
+ chown_dir_files(slapdFrontendConfig->accesslog, pw, PR_TRUE); /* do access log directory */
+ chown_dir_files(slapdFrontendConfig->auditlog, pw, PR_TRUE); /* do audit log directory */
+ chown_dir_files(slapdFrontendConfig->errorlog, pw, PR_TRUE); /* do error log directory */
+
}
#endif
@@ -378,7 +365,7 @@ name2exemode( char *progname, char *s, int exit_if_unknown )
}
#endif
else if ( exit_if_unknown ) {
- fprintf( stderr, "usage: %s -D configdir "
+ fprintf( stderr, "usage: %s -D instancedir "
"[ldif2db | db2ldif | archive2db "
"| db2archive | db2index | refer | suffix2instance"
#if defined(UPGRADEDB)
@@ -410,46 +397,46 @@ usage( char *name, char *extraname )
switch( slapd_exemode ) {
case SLAPD_EXEMODE_DB2LDIF:
- usagestr = "usage: %s %s%s-D configdir [-n backend-instance-name] [-d debuglevel] "
+ usagestr = "usage: %s %s%s-D instancedir [-n backend-instance-name] [-d debuglevel] "
"[-N] [-a outputfile] [-r] [-C] [{-s includesuffix}*] "
"[{-x excludesuffix}*] [-u] [-U] [-m] [-M] [-E]\n"
"Note: either \"-n backend_instance_name\" or \"-s includesuffix\" is required.\n";
break;
case SLAPD_EXEMODE_LDIF2DB:
- usagestr = "usage: %s %s%s-D configdir [-d debuglevel] "
+ usagestr = "usage: %s %s%s-D instancedir [-d debuglevel] "
"[-n backend_instance_name] [-O] [-g uniqueid_type] [--namespaceid uniqueID]"
"[{-s includesuffix}*] [{-x excludesuffix}*] [-E] {-i ldif-file}*\n"
"Note: either \"-n backend_instance_name\" or \"-s includesuffix\" is required.\n";
break;
case SLAPD_EXEMODE_DB2ARCHIVE:
- usagestr = "usage: %s %s%s-D configdir [-d debuglevel] -a archivedir\n";
+ usagestr = "usage: %s %s%s-D instancedir [-d debuglevel] -a archivedir\n";
break;
case SLAPD_EXEMODE_ARCHIVE2DB:
- usagestr = "usage: %s %s%s-D configdir [-d debuglevel] -a archivedir\n";
+ usagestr = "usage: %s %s%s-D instancedir [-d debuglevel] -a archivedir\n";
break;
case SLAPD_EXEMODE_DB2INDEX:
- usagestr = "usage: %s %s%s-D configdir -n backend-instance-name "
+ usagestr = "usage: %s %s%s-D instancedir -n backend-instance-name "
"[-d debuglevel] {-t attributetype}* {-T VLV Search Name}*\n";
/* JCM should say 'Address Book' or something instead of VLV */
break;
case SLAPD_EXEMODE_REFERRAL:
- usagestr = "usage: %s %s%s-D configdir -r referral-url [-p port]\n";
+ usagestr = "usage: %s %s%s-D instancedir -r referral-url [-p port]\n";
break;
case SLAPD_EXEMODE_DBTEST:
- usagestr = "usage: %s %s%s-D configdir -n backend-instance-name "
+ usagestr = "usage: %s %s%s-D instancedir -n backend-instance-name "
"[-d debuglevel] [-S] [-v]\n";
break;
case SLAPD_EXEMODE_SUFFIX2INSTANCE:
- usagestr = "usage: %s %s%s -D configdir {-s suffix}*\n";
+ usagestr = "usage: %s %s%s -D instancedir {-s suffix}*\n";
break;
#if defined(UPGRADEDB)
case SLAPD_EXEMODE_UPGRADEDB:
- usagestr = "usage: %s %s%s-D configdir [-d debuglevel] [-f] -a archivedir\n";
+ usagestr = "usage: %s %s%s-D instancedir [-d debuglevel] [-f] -a archivedir\n";
break;
#endif
default: /* SLAPD_EXEMODE_SLAPD */
- usagestr = "usage: %s %s%s-D configdir [-d debuglevel] "
+ usagestr = "usage: %s %s%s-D instancedir [-d debuglevel] "
"[-i pidlogfile] [-v] [-V]\n";
}
@@ -696,9 +683,9 @@ main( int argc, char **argv)
}
#endif
- process_command_line(argc,argv,myname,&extraname);
+ process_command_line(argc,argv,myname,&extraname);
- if (!slapdFrontendConfig->instancedir &&
+ if (!slapdFrontendConfig->instancedir ||
!slapdFrontendConfig->configdir) {
usage( myname, extraname );
exit( 1 );
@@ -711,7 +698,7 @@ main( int argc, char **argv)
}
#ifndef LDAP_DONT_USE_SMARTHEAP
- MemRegisterTask();
+ MemRegisterTask();
#endif
slapd_init();
@@ -719,52 +706,39 @@ main( int argc, char **argv)
vattr_init();
if (slapd_exemode == SLAPD_EXEMODE_REFERRAL) {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- /* make up the config stuff */
- referral_set_defaults();
- /*
- * Process the config files.
- */
- if (0 == slapd_bootstrap_config(slapdFrontendConfig->configdir)) {
- slapi_log_error(SLAPI_LOG_FATAL, "startup",
- "The configuration files in directory %s could not be read or were not found. Please refer to the error log or output for more information.\n",
- slapdFrontendConfig->configdir);
- exit(1);
- }
-
- n_port = config_get_port();
- s_port = config_get_secureport();
+ /* make up the config stuff */
+ referral_set_defaults();
+ n_port = config_get_port();
+ s_port = config_get_secureport();
register_objects();
} else {
- slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- /* The 2 calls below have been moved to this place to make sure that
- * they are called before setup_internal_backends to avoid bug 524439 */
- /*
- * The 2 calls below where being sometimes called AFTER
- * ldapi_register_extended_op (such fact was being stated and
- * reproducible for some optimized installations at startup (bug
- * 524439)... Such bad call was happening in the context of
- * setup_internal_backends -> dse_read_file -> load_plugin_entry ->
- * plugin_setup -> replication_multimaster_plugin_init ->
- * slapi_register_plugin -> plugin_setup ->
- * multimaster_start_extop_init -> * slapi_pblock_set ->
- * ldapi_register_extended_op... Unfortunately, the server
- * design is such that it is assumed that ldapi_init_extended_ops is
- * always called first.
- * THE FIX: Move the two calls below before a call to
- * setup_internal_backends (down in this same function)
- */
- init_saslmechanisms();
- ldapi_init_extended_ops();
+ slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
+ /* The 2 calls below have been moved to this place to make sure that they
+ * are called before setup_internal_backends to avoid bug 524439 */
+ /*
+ * The 2 calls below where being sometimes called AFTER ldapi_register_extended_op
+ * (such fact was being stated and reproducible for some optimized installations
+ * at startup (bug 524439)... Such bad call was happening in the context of
+ * setup_internal_backends -> dse_read_file -> load_plugin_entry ->
+ * plugin_setup -> replication_multimaster_plugin_init ->
+ * slapi_register_plugin -> plugin_setup -> multimaster_start_extop_init ->
+ * slapi_pblock_set -> ldapi_register_extended_op... Unfortunately, the server
+ * design is such that it is assumed that ldapi_init_extended_ops is always
+ * called first.
+ * THE FIX: Move the two calls below before a call to setup_internal_backends
+ * (down in this same function)
+ */
+ init_saslmechanisms();
+ ldapi_init_extended_ops();
- /*
- * Initialize the default backend. This should be done before we
- * process the config. files
- */
- defbackend_init();
-
+ /*
+ * Initialize the default backend. This should be done before we
+ * process the config. files
+ */
+ defbackend_init();
+
/*
* Register the extensible objects with the factory.
*/
@@ -772,12 +746,12 @@ main( int argc, char **argv)
/*
* Register the controls that we support.
*/
- init_controls();
+ init_controls();
- /*
- * Process the config files.
- */
- if (0 == slapd_bootstrap_config(slapdFrontendConfig->configdir)) {
+ /*
+ * Process the config files.
+ */
+ if (0 == slapd_bootstrap_config(slapdFrontendConfig->configdir)) {
slapi_log_error(SLAPI_LOG_FATAL, "startup",
"The configuration files in directory %s could not be read or were not found. Please refer to the error log or output for more information.\n",
slapdFrontendConfig->configdir);
@@ -785,7 +759,7 @@ main( int argc, char **argv)
}
/* -sduloutre: must be done before any internal search */
- /* do it before splitting off to other modes too -robey */
+ /* do it before splitting off to other modes too -robey */
/* -richm: must be done before reading config files */
if (0 != (return_value = compute_init())) {
LDAPDebug(LDAP_DEBUG_ANY, "Initialization Failed 0 %d\n",return_value,0,0);
@@ -800,8 +774,8 @@ main( int argc, char **argv)
exit(1);
}
- n_port = config_get_port();
- s_port = config_get_secureport();
+ n_port = config_get_port();
+ s_port = config_get_secureport();
}
raise_process_limits(); /* should be done ASAP once config file read */
@@ -818,22 +792,22 @@ main( int argc, char **argv)
set_entry_points();
#if defined( XP_WIN32 )
- if (slapd_exemode == SLAPD_EXEMODE_SLAPD) {
- /* Register with the NT EventLog */
- hSlapdEventSource = RegisterEventSource(NULL, pszServerName );
- if( !hSlapdEventSource ) {
- char szMessage[256];
- PR_snprintf( szMessage, sizeof(szMessage), "Directory Server %s is terminating. Failed "
- "to set the EventLog source.", pszServerName);
- MessageBox(GetDesktopWindow(), szMessage, " ",
- MB_ICONEXCLAMATION | MB_OK);
- exit( 1 );
- }
+ if (slapd_exemode == SLAPD_EXEMODE_SLAPD) {
+ /* Register with the NT EventLog */
+ hSlapdEventSource = RegisterEventSource(NULL, pszServerName );
+ if( !hSlapdEventSource ) {
+ char szMessage[256];
+ PR_snprintf( szMessage, sizeof(szMessage), "Directory Server %s is terminating. Failed "
+ "to set the EventLog source.", pszServerName);
+ MessageBox(GetDesktopWindow(), szMessage, " ",
+ MB_ICONEXCLAMATION | MB_OK);
+ exit( 1 );
+ }
- /* Check to ensure there isn't a copy of this server already running. */
- if( MultipleInstances() )
- exit( 1 );
- }
+ /* Check to ensure there isn't a copy of this server already running. */
+ if( MultipleInstances() )
+ exit( 1 );
+ }
#endif
/*
@@ -852,8 +826,8 @@ main( int argc, char **argv)
* we need to be root in order to open them.
*/
- if ((slapd_exemode == SLAPD_EXEMODE_SLAPD) ||
- (slapd_exemode == SLAPD_EXEMODE_REFERRAL)) {
+ if ((slapd_exemode == SLAPD_EXEMODE_SLAPD) ||
+ (slapd_exemode == SLAPD_EXEMODE_REFERRAL)) {
ports_info.n_port = (unsigned short)n_port;
if ( slapd_listenhost2addr( config_get_listenhost(),
&ports_info.n_listenaddr ) != 0 ) {
@@ -868,9 +842,9 @@ main( int argc, char **argv)
return_value = daemon_pre_setuid_init(&ports_info);
if (0 != return_value) {
- LDAPDebug( LDAP_DEBUG_ANY, "Failed to init daemon\n",
- 0, 0, 0 );
- exit(1);
+ LDAPDebug( LDAP_DEBUG_ANY, "Failed to init daemon\n",
+ 0, 0, 0 );
+ exit(1);
}
}
@@ -879,9 +853,9 @@ main( int argc, char **argv)
#ifndef _WIN32
return_value = main_setuid(slapdFrontendConfig->localuser);
if (0 != return_value) {
- LDAPDebug( LDAP_DEBUG_ANY, "Failed to change user and group identity to that of %s\n",
+ LDAPDebug( LDAP_DEBUG_ANY, "Failed to change user and group identity to that of %s\n",
slapdFrontendConfig->localuser, 0, 0 );
- exit(1);
+ exit(1);
}
#endif
@@ -896,7 +870,7 @@ main( int argc, char **argv)
&& (0 != s_port) && (s_port <= LDAP_PORT_MAX);
/* As of DS 6.1, always do a full initialization so that other
* modules can assume NSS is available
- */
+ */
if ( slapd_nss_init((slapd_exemode == SLAPD_EXEMODE_SLAPD),
(slapd_exemode != SLAPD_EXEMODE_REFERRAL) /* have config? */ )) {
LDAPDebug(LDAP_DEBUG_ANY,
@@ -914,14 +888,14 @@ main( int argc, char **argv)
exit( 1 );
}
- if ((slapd_exemode == SLAPD_EXEMODE_SLAPD) ||
- (slapd_exemode == SLAPD_EXEMODE_REFERRAL)) {
- if ( init_ssl && ( 0 != slapd_ssl_init2(&ports_info.s_socket, 0) ) ) {
- LDAPDebug(LDAP_DEBUG_ANY,
- "ERROR: SSL Initialization phase 2 Failed.\n", 0, 0, 0 );
- exit( 1 );
- }
- }
+ if ((slapd_exemode == SLAPD_EXEMODE_SLAPD) ||
+ (slapd_exemode == SLAPD_EXEMODE_REFERRAL)) {
+ if ( init_ssl && ( 0 != slapd_ssl_init2(&ports_info.s_socket, 0) ) ) {
+ LDAPDebug(LDAP_DEBUG_ANY,
+ "ERROR: SSL Initialization phase 2 Failed.\n", 0, 0, 0 );
+ exit( 1 );
+ }
+ }
/*
* if we were called upon to do special database stuff, do it and be
@@ -929,52 +903,52 @@ main( int argc, char **argv)
*/
switch ( slapd_exemode ) {
case SLAPD_EXEMODE_LDIF2DB:
- return slapd_exemode_ldif2db();
+ return slapd_exemode_ldif2db();
case SLAPD_EXEMODE_DB2LDIF:
- return slapd_exemode_db2ldif(argc,argv);
+ return slapd_exemode_db2ldif(argc,argv);
case SLAPD_EXEMODE_DB2INDEX:
- return slapd_exemode_db2index();
+ return slapd_exemode_db2index();
case SLAPD_EXEMODE_ARCHIVE2DB:
- return slapd_exemode_archive2db();
+ return slapd_exemode_archive2db();
case SLAPD_EXEMODE_DB2ARCHIVE:
- return slapd_exemode_db2archive();
+ return slapd_exemode_db2archive();
case SLAPD_EXEMODE_DBTEST:
- return slapd_exemode_dbtest();
+ return slapd_exemode_dbtest();
case SLAPD_EXEMODE_REFERRAL:
/* check that all the necessary info was given, then go on */
- if (! config_check_referral_mode()) {
- LDAPDebug(LDAP_DEBUG_ANY,
- "ERROR: No referral URL supplied\n", 0, 0, 0);
+ if (! config_check_referral_mode()) {
+ LDAPDebug(LDAP_DEBUG_ANY,
+ "ERROR: No referral URL supplied\n", 0, 0, 0);
usage( myname, extraname );
- exit(1);
+ exit(1);
}
break;
case SLAPD_EXEMODE_SUFFIX2INSTANCE:
- return slapd_exemode_suffix2instance();
+ return slapd_exemode_suffix2instance();
#if defined(UPGRADEDB)
case SLAPD_EXEMODE_UPGRADEDB:
- return slapd_exemode_upgradedb();
+ return slapd_exemode_upgradedb();
#endif
case SLAPD_EXEMODE_PRINTVERSION:
- slapd_print_version(1);
- exit(1);
+ slapd_print_version(1);
+ exit(1);
}
/*
* Detach ourselves from the terminal (unless running in debug mode).
* We must detach before we start any threads since detach forks() on
* UNIX.
- * Have to detach after ssl_init - the user may be prompted for the PIN
- * on the terminal, so it must be open.
+ * Have to detach after ssl_init - the user may be prompted for the PIN
+ * on the terminal, so it must be open.
*/
detach();
@@ -995,8 +969,8 @@ main( int argc, char **argv)
* slapd processes that are currently running
*/
if ((slapd_exemode != SLAPD_EXEMODE_REFERRAL) &&
- ( add_new_slapd_process(slapd_exemode, db2ldif_dump_replica,
- skip_db_protect_check) == -1 )) {
+ ( add_new_slapd_process(slapd_exemode, db2ldif_dump_replica,
+ skip_db_protect_check) == -1 )) {
LDAPDebug( LDAP_DEBUG_ANY,
"Shutting down due to possible conflicts with other slapd processes\n",
0, 0, 0 );
@@ -1014,7 +988,7 @@ main( int argc, char **argv)
char *versionstring = config_get_versionstring();
char *buildnum = config_get_buildnum();
LDAPDebug( LDAP_DEBUG_ANY, "%s B%s starting up\n",
- versionstring, buildnum, 0 );
+ versionstring, buildnum, 0 );
slapi_ch_free((void **)&buildnum);
slapi_ch_free((void **)&versionstring);
}
@@ -1029,8 +1003,8 @@ main( int argc, char **argv)
slapdFrontendConfig->configdir);
eq_init(); /* must be done before plugins started */
- snmp_collator_start();
- ps_init_psearch_system(); /* must come before plugin_startall() */
+ snmp_collator_start();
+ ps_init_psearch_system(); /* must come before plugin_startall() */
/* Initailize the mapping tree */
@@ -1038,12 +1012,12 @@ main( int argc, char **argv)
{
LDAPDebug( LDAP_DEBUG_ANY, "Failed to init mapping tree\n",
0, 0, 0 );
- exit(1);
+ exit(1);
}
/* initialize UniqueID generator - must be done once backends are started
- and event queue is initialized but before plugins are started */
+ and event queue is initialized but before plugins are started */
sdn = slapi_sdn_new_dn_byval ("cn=uniqueid generator,cn=config");
rc = uniqueIDGenInit (NULL, sdn, slapd_exemode == SLAPD_EXEMODE_SLAPD);
slapi_sdn_free (&sdn);
@@ -1051,7 +1025,7 @@ main( int argc, char **argv)
{
LDAPDebug( LDAP_DEBUG_ANY,
"Fatal Error---Failed to initialize uniqueid generator; error = %d. "
- "Exiting now.\n", rc, 0, 0 );
+ "Exiting now.\n", rc, 0, 0 );
exit( 1 );
}
@@ -1060,17 +1034,17 @@ main( int argc, char **argv)
if ( slapd_security_library_is_initialized() != 0 ) {
- start_tls_register_plugin();
+ start_tls_register_plugin();
LDAPDebug( LDAP_DEBUG_PLUGIN,
- "Start TLS plugin registered.\n",
- 0, 0, 0 );
+ "Start TLS plugin registered.\n",
+ 0, 0, 0 );
}
#endif
- passwd_modify_register_plugin();
- LDAPDebug( LDAP_DEBUG_PLUGIN,
- "Password Modify plugin registered.\n", 0, 0, 0 );
+ passwd_modify_register_plugin();
+ LDAPDebug( LDAP_DEBUG_PLUGIN,
+ "Password Modify plugin registered.\n", 0, 0, 0 );
- plugin_startall(argc, argv, 1 /* Start Backends */, 1 /* Start Globals */);
+ plugin_startall(argc, argv, 1 /* Start Backends */, 1 /* Start Globals */);
if (housekeeping_start((time_t)0, NULL) == NULL) {
exit (1);
}
@@ -1078,50 +1052,50 @@ main( int argc, char **argv)
eq_start(); /* must be done after plugins started */
#ifdef HPUX10
- /* HPUX linker voodoo */
- if (collation_init == NULL) {
+ /* HPUX linker voodoo */
+ if (collation_init == NULL) {
exit (1);
- }
-
+ }
+
#endif /* HPUX */
- normalize_oc();
+ normalize_oc();
- if (n_port) {
+ if (n_port) {
#if defined(NET_SSL)
- } else if ( config_get_security()) {
+ } else if ( config_get_security()) {
#endif
- } else {
+ } else {
#ifdef _WIN32
- if( SlapdIsAService() )
- {
- LDAPServerStatus.dwCurrentState = SERVICE_STOPPED;
- LDAPServerStatus.dwCheckPoint = 0;
- LDAPServerStatus.dwWaitHint = 0;
- LDAPServerStatus.dwWin32ExitCode = 1;
- LDAPServerStatus.dwServiceSpecificExitCode = 1;
-
- SetServiceStatus(hLDAPServerServiceStatus, &LDAPServerStatus);
-
- /* Log this event */
- ReportSlapdEvent(EVENTLOG_INFORMATION_TYPE, MSG_SERVER_START_FAILED, 1,
- "Check server port specification");
- }
- else
- {
- char szMessage[256];
- PR_snprintf( szMessage, sizeof(szMessage), "The Directory Server %s is terminating due to an error. Check server port specification", pszServerName);
- MessageBox(GetDesktopWindow(), szMessage, " ", MB_ICONEXCLAMATION | MB_OK);
- }
+ if( SlapdIsAService() )
+ {
+ LDAPServerStatus.dwCurrentState = SERVICE_STOPPED;
+ LDAPServerStatus.dwCheckPoint = 0;
+ LDAPServerStatus.dwWaitHint = 0;
+ LDAPServerStatus.dwWin32ExitCode = 1;
+ LDAPServerStatus.dwServiceSpecificExitCode = 1;
+
+ SetServiceStatus(hLDAPServerServiceStatus, &LDAPServerStatus);
+
+ /* Log this event */
+ ReportSlapdEvent(EVENTLOG_INFORMATION_TYPE, MSG_SERVER_START_FAILED, 1,
+ "Check server port specification");
+ }
+ else
+ {
+ char szMessage[256];
+ PR_snprintf( szMessage, sizeof(szMessage), "The Directory Server %s is terminating due to an error. Check server port specification", pszServerName);
+ MessageBox(GetDesktopWindow(), szMessage, " ", MB_ICONEXCLAMATION | MB_OK);
+ }
#endif
- exit(1);
- }
+ exit(1);
+ }
}
- {
- Slapi_PBlock pb;
- memset( &pb, '\0', sizeof(pb) );
- pb.pb_backend = be;
+ {
+ Slapi_PBlock pb;
+ memset( &pb, '\0', sizeof(pb) );
+ pb.pb_backend = be;
}
if (slapd_exemode != SLAPD_EXEMODE_REFERRAL) {
@@ -1250,7 +1224,7 @@ process_command_line(int argc, char **argv, char *myname,
{"debug",ArgRequired,'d'},
{"backend",ArgRequired,'n'},
{"allowMultipleProcesses",ArgNone,'S'},
- {"configDir",ArgRequired,'D'},
+ {"instanceDir",ArgRequired,'D'},
{0,0,0}};
@@ -1266,7 +1240,7 @@ process_command_line(int argc, char **argv, char *myname,
/*{"whatshouldwecallthis",ArgNone,'C'},*/
{"allowMultipleProcesses",ArgNone,'S'},
{"noUniqueIds",ArgNone,'u'},
- {"configDir",ArgRequired,'D'},
+ {"instanceDir",ArgRequired,'D'},
{"encrypt",ArgOptional,'E'},
{"nowrap",ArgNone,'U'},
{"minimalEncode",ArgNone,'m'},
@@ -1290,7 +1264,7 @@ process_command_line(int argc, char **argv, char *myname,
{"allowMultipleProcesses",ArgNone,'S'},
{"namespaceid", ArgRequired, 'G'},
{"nostate",ArgNone,'Z'},
- {"configDir",ArgRequired,'D'},
+ {"instanceDir",ArgRequired,'D'},
{"encrypt",ArgOptional,'E'},
{0,0,0}};
@@ -1302,7 +1276,7 @@ process_command_line(int argc, char **argv, char *myname,
{"archive",ArgRequired,'a'},
{"backEndInstName",ArgRequired,'n'},
{"allowMultipleProcesses",ArgNone,'S'},
- {"configDir",ArgRequired,'D'},
+ {"instanceDir",ArgRequired,'D'},
{0,0,0}};
@@ -1313,7 +1287,7 @@ process_command_line(int argc, char **argv, char *myname,
{"pidfile",ArgRequired,'i'},
{"archive",ArgRequired,'a'},
{"allowMultipleProcesses",ArgNone,'S'},
- {"configDir",ArgRequired,'D'},
+ {"instanceDir",ArgRequired,'D'},
{0,0,0}};
char *opts_db2index = "vd:a:t:T:SD:n:s:x:";
@@ -1325,7 +1299,7 @@ process_command_line(int argc, char **argv, char *myname,
{"indexAttribute",ArgRequired,'t'},
{"vlvIndex",ArgRequired,'T'},
{"allowMultipleProcesses",ArgNone,'S'},
- {"configDir",ArgRequired,'D'},
+ {"instanceDir",ArgRequired,'D'},
{"include",ArgRequired,'s'},
{"exclude",ArgRequired,'x'},
{0,0,0}};
@@ -1337,7 +1311,7 @@ process_command_line(int argc, char **argv, char *myname,
{"debug",ArgRequired,'d'},
{"force",ArgNone,'f'},
{"archive",ArgRequired,'a'},
- {"configDir",ArgRequired,'D'},
+ {"instanceDir",ArgRequired,'D'},
{0,0,0}};
#endif
@@ -1348,7 +1322,7 @@ process_command_line(int argc, char **argv, char *myname,
{"port",ArgRequired,'p'},
{"referralMode",ArgRequired,'r'},
{"allowMultipleProcesses",ArgNone,'S'},
- {"configDir",ArgRequired,'D'},
+ {"instanceDir",ArgRequired,'D'},
{0,0,0}};
char *opts_suffix2instance = "s:D:";
@@ -1364,7 +1338,7 @@ process_command_line(int argc, char **argv, char *myname,
{"debug",ArgRequired,'d'},
{"pidfile",ArgRequired,'i'},
{"allowMultipleProcesses",ArgNone,'S'},
- {"configDir",ArgRequired,'D'},
+ {"instanceDir",ArgRequired,'D'},
{"startpidfile",ArgRequired,'w'},
{0,0,0}};
@@ -1446,7 +1420,7 @@ process_command_line(int argc, char **argv, char *myname,
while ( (i = getopt_ext( argc, argv, opts,
long_opts, &longopt_index)) != EOF ) {
- char *configdir = 0;
+ char *instancedir = 0;
switch ( i ) {
#ifdef LDAP_DEBUG
case 'd': /* turn on debugging */
@@ -1472,11 +1446,11 @@ process_command_line(int argc, char **argv, char *myname,
#endif
case 'D': /* config dir */
- configdir = rel2abspath( optarg_ext );
+ instancedir = rel2abspath( optarg_ext );
#if defined( XP_WIN32 )
pszServerName = slapi_ch_malloc( MAX_SERVICE_NAME );
- if( !SlapdGetServerNameFromCmdline(pszServerName, configdir, 1) )
+ if( !SlapdGetServerNameFromCmdline(pszServerName, instancedir, 1) )
{
MessageBox(GetDesktopWindow(), "Failed to get the Directory"
" Server name from the command-line argument.",
@@ -1484,13 +1458,13 @@ process_command_line(int argc, char **argv, char *myname,
exit( 1 );
}
#endif
- if ( config_set_configdir( "configdir (-D)",
- configdir, errorbuf, 1) != LDAP_SUCCESS ) {
+ if ( config_set_instancedir( "instancedir (-D)",
+ instancedir, errorbuf, 1) != LDAP_SUCCESS ) {
fprintf( stderr, "%s: aborting now\n", errorbuf );
usage( myname, *extraname );
exit( 1 );
}
- slapi_ch_free((void **)&configdir);
+ slapi_ch_free((void **)&instancedir);
break;
diff --git a/ldap/servers/slapd/modutil.c b/ldap/servers/slapd/modutil.c
index 47739318..e8b9ebf8 100644
--- a/ldap/servers/slapd/modutil.c
+++ b/ldap/servers/slapd/modutil.c
@@ -367,7 +367,7 @@ mod2smod (LDAPMod *mod, Slapi_Mod *smod)
if (mod->mod_op & LDAP_MOD_BVALUES)
{
- while (mod->mod_bvalues[smod->num_values])
+ while (mod->mod_bvalues && mod->mod_bvalues[smod->num_values])
{
smod->num_values ++;
}
@@ -375,7 +375,7 @@ mod2smod (LDAPMod *mod, Slapi_Mod *smod)
else
{
PR_ASSERT(0); /* ggood shouldn't ever use string values in server */
- while (mod->mod_values[smod->num_values])
+ while (mod->mod_values && mod->mod_values[smod->num_values])
{
smod->num_values ++;
}
diff --git a/ldap/servers/slapd/pblock.c b/ldap/servers/slapd/pblock.c
index 48e9f998..4a6bbca6 100644
--- a/ldap/servers/slapd/pblock.c
+++ b/ldap/servers/slapd/pblock.c
@@ -348,7 +348,7 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
(*(int *)value) = pblock->pb_op->o_params.operation_type;
break;
case SLAPI_OPINITIATED_TIME:
- (*(time_t *)value) = pblock->pb_op->o_time;
+ (*(int *)value) = pblock->pb_op->o_time;
break;
case SLAPI_REQUESTOR_ISROOT:
(*(int *)value) = pblock->pb_requestor_isroot;
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index 54044a71..5726a5c2 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -301,8 +301,6 @@ int config_set_versionstring(const char *attrname, char *versionstring, char *e
int config_set_enquote_sup_oc(const char *attrname, char *value, char *errorbuf, int apply );
int config_set_basedn( const char *attrname, char *value, char *errorbuf, int apply );
int config_set_configdir( const char *attrname, char *value, char *errorbuf, int apply );
-int config_set_schemadir( const char *attrname, char *value, char *errorbuf, int apply );
-int config_set_ldifdir( const char *attrname, char *value, char *errorbuf, int apply );
int config_set_attrname_exceptions( const char *attrname, char *value, char *errorbuf, int apply );
int config_set_hash_filters( const char *attrname, char *value, char *errorbuf, int apply );
int config_set_rewrite_rfc1274( const char *attrname, char *value, char *errorbuf, int apply );
@@ -400,7 +398,6 @@ char *config_get_buildnum(void);
int config_get_enquote_sup_oc();
char *config_get_basedn();
char *config_get_configdir();
-char *config_get_schemadir();
char **config_get_errorlog_list();
char **config_get_accesslog_list();
char **config_get_auditlog_list();
diff --git a/ldap/servers/slapd/schema.c b/ldap/servers/slapd/schema.c
index a8f35db8..e3ca1685 100644
--- a/ldap/servers/slapd/schema.c
+++ b/ldap/servers/slapd/schema.c
@@ -4014,11 +4014,7 @@ init_schema_dse(const char *configdir)
slapi_sdn_init_dn_byref(&schema,"cn=schema");
- schemadir = config_get_schemadir();
- if (NULL == schemadir) {
- /* schemadir info is not configured, let's use the default place */
- schemadir = slapi_ch_smprintf("%s/%s", configdir, SCHEMA_SUBDIR_NAME);
- }
+ schemadir = slapi_ch_smprintf("%s/%s", configdir, SCHEMA_SUBDIR_NAME);
filelist = get_priority_filelist(schemadir, ".*ldif$");
if (!filelist || !*filelist)
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index c6fb41f9..14947bca 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -1708,8 +1708,6 @@ typedef struct _slapdEntryPoints {
#define CONFIG_REWRITE_RFC1274_ATTRIBUTE "nsslapd-rewrite-rfc1274"
#define CONFIG_CONFIG_ATTRIBUTE "nsslapd-config"
-#define CONFIG_SCHEMADIR_ATTRIBUTE "nsslapd-schemadir"
-#define CONFIG_LDIFDIR_ATTRIBUTE "nsslapd-ldifdir"
#define CONFIG_SSLCLIENTAUTH_ATTRIBUTE "nsslapd-SSLclientAuth"
#define CONFIG_SSL_CHECK_HOSTNAME_ATTRIBUTE "nsslapd-ssl-check-hostname"
#define CONFIG_HASH_FILTERS_ATTRIBUTE "nsslapd-hash-filters"
@@ -1884,7 +1882,6 @@ typedef struct _slapdFrontendConfig {
char *workingdir; /* full path of directory before detach */
char *configdir; /* full path name of directory containing configuration files */
- char *schemadir; /* full path name of directory containing schema files */
int attrname_exceptions; /* if true, allow questionable attribute names */
int rewrite_rfc1274; /* return attrs for both v2 and v3 names */
char *schemareplace; /* see CONFIG_SCHEMAREPLACE_* #defines below */
diff --git a/ldap/servers/slapd/test-plugins/testbind.c b/ldap/servers/slapd/test-plugins/testbind.c
index 1b2bed98..3419a66e 100644
--- a/ldap/servers/slapd/test-plugins/testbind.c
+++ b/ldap/servers/slapd/test-plugins/testbind.c
@@ -69,7 +69,7 @@
#include <string.h>
#include "slapi-plugin.h"
-Slapi_PluginDesc bindpdesc = { "test-bind", "Fedora Project", "1.0.3",
+Slapi_PluginDesc bindpdesc = { "test-bind", "Fedora Project", "1.0.4",
"sample bind pre-operation plugin" };
static Slapi_ComponentId *plugin_id = NULL;
diff --git a/ldap/servers/slapd/test-plugins/testdatainterop.c b/ldap/servers/slapd/test-plugins/testdatainterop.c
index f855c47d..4f7e64f9 100644
--- a/ldap/servers/slapd/test-plugins/testdatainterop.c
+++ b/ldap/servers/slapd/test-plugins/testdatainterop.c
@@ -113,7 +113,7 @@
/*
* Static variables.
*/
-static Slapi_PluginDesc plugindesc = { PLUGIN_NAME, "Fedora Project", "1.0.3",
+static Slapi_PluginDesc plugindesc = { PLUGIN_NAME, "Fedora Project", "1.0.4",
"sample pre-operation null suffix plugin" };
static Slapi_ComponentId *plugin_id = NULL;
diff --git a/ldap/servers/slapd/test-plugins/testentry.c b/ldap/servers/slapd/test-plugins/testentry.c
index c8aa0373..87a0b0a3 100644
--- a/ldap/servers/slapd/test-plugins/testentry.c
+++ b/ldap/servers/slapd/test-plugins/testentry.c
@@ -90,7 +90,7 @@ nsslapd-pluginId: test-entry
#include <string.h>
#include "slapi-plugin.h"
-Slapi_PluginDesc entrypdesc = { "test-entry", "Fedora Project", "1.0.3",
+Slapi_PluginDesc entrypdesc = { "test-entry", "Fedora Project", "1.0.4",
"sample entry modification plugin" };
/* Entry store plug-in function */
diff --git a/ldap/servers/slapd/test-plugins/testextendedop.c b/ldap/servers/slapd/test-plugins/testextendedop.c
index f4d11137..38574c5b 100644
--- a/ldap/servers/slapd/test-plugins/testextendedop.c
+++ b/ldap/servers/slapd/test-plugins/testextendedop.c
@@ -83,7 +83,7 @@
/* OID of the extended operation handled by this plug-in */
#define MY_OID "1.2.3.4"
-Slapi_PluginDesc expdesc = { "test-extendedop", "Fedora Project", "1.0.3",
+Slapi_PluginDesc expdesc = { "test-extendedop", "Fedora Project", "1.0.4",
"sample extended operation plugin" };
diff --git a/ldap/servers/slapd/test-plugins/testgetip.c b/ldap/servers/slapd/test-plugins/testgetip.c
index 432fb127..724d96b7 100644
--- a/ldap/servers/slapd/test-plugins/testgetip.c
+++ b/ldap/servers/slapd/test-plugins/testgetip.c
@@ -74,7 +74,7 @@
#include "slapi-plugin.h"
#include "nspr.h"
-Slapi_PluginDesc getippdesc = { "test-getip", "Fedora Project", "1.0.3",
+Slapi_PluginDesc getippdesc = { "test-getip", "Fedora Project", "1.0.4",
"sample pre-operation plugin" };
static char *netaddr2str( PRNetAddr *addrp, char *buf, size_t buflen );
diff --git a/ldap/servers/slapd/test-plugins/testpostop.c b/ldap/servers/slapd/test-plugins/testpostop.c
index 0a4cda37..cb035e7f 100644
--- a/ldap/servers/slapd/test-plugins/testpostop.c
+++ b/ldap/servers/slapd/test-plugins/testpostop.c
@@ -93,7 +93,7 @@ static char changelogfile[MAX_PATH+1];
static char *changelogfile = "/tmp/changelog";
#endif
-Slapi_PluginDesc postoppdesc = { "test-postop", "Fedora Project", "1.0.3",
+Slapi_PluginDesc postoppdesc = { "test-postop", "Fedora Project", "1.0.4",
"sample post-operation plugin" };
static void write_changelog( int optype, char *dn, void *change, int flag );
diff --git a/ldap/servers/slapd/test-plugins/testpreop.c b/ldap/servers/slapd/test-plugins/testpreop.c
index 03cf46b9..e8fb8836 100644
--- a/ldap/servers/slapd/test-plugins/testpreop.c
+++ b/ldap/servers/slapd/test-plugins/testpreop.c
@@ -79,7 +79,7 @@
#include <string.h>
#include "slapi-plugin.h"
-Slapi_PluginDesc preoppdesc = { "test-preop", "Fedora Project", "1.0.3",
+Slapi_PluginDesc preoppdesc = { "test-preop", "Fedora Project", "1.0.4",
"sample pre-operation plugin" };
/* Pre-operation plug-in function */
diff --git a/ldap/servers/slapd/test-plugins/testsaslbind.c b/ldap/servers/slapd/test-plugins/testsaslbind.c
index 13ebd272..b68965a4 100644
--- a/ldap/servers/slapd/test-plugins/testsaslbind.c
+++ b/ldap/servers/slapd/test-plugins/testsaslbind.c
@@ -80,7 +80,7 @@ nsslapd-plugindescription: sample SASL bind pre-operation plugin
#include <string.h>
#include "slapi-plugin.h"
-Slapi_PluginDesc saslpdesc = { "test-saslbind", "Fedora Project", "1.0.3",
+Slapi_PluginDesc saslpdesc = { "test-saslbind", "Fedora Project", "1.0.4",
"sample SASL bind pre-operation plugin" };
diff --git a/ldap/servers/slapd/tools/pwenc.c b/ldap/servers/slapd/tools/pwenc.c
index 524c6a27..c87e0f64 100644
--- a/ldap/servers/slapd/tools/pwenc.c
+++ b/ldap/servers/slapd/tools/pwenc.c
@@ -82,7 +82,7 @@ static void
usage( name )
char *name;
{
- fprintf( stderr, "usage: %s -D config-dir [-H] [-s scheme | -c comparepwd ] password...\n", name );
+ fprintf( stderr, "usage: %s -D instance-dir [-H] [-s scheme | -c comparepwd ] password...\n", name );
exit( 1 );
}
@@ -133,7 +133,7 @@ main( argc, argv )
slapdFrontendConfig_t *slapdFrontendConfig = NULL;
char *opts = "Hs:c:D:";
- char *configdir = NULL;
+ char *instancedir = NULL;
name = argv[ 0 ];
pwsp = cmppwsp = NULL;
@@ -157,13 +157,13 @@ main( argc, argv )
/* kexcoff: quite the same as slapd_bootstrap_config */
FrontendConfig_init();
- configdir = rel2abspath( optarg );
- if ( config_set_configdir( "configdir (-D)", configdir,
+ instancedir = rel2abspath( optarg );
+ if ( config_set_instancedir( "configdir (-D)", instancedir,
errorbuf, 1) != LDAP_SUCCESS ) {
fprintf( stderr, "%s\n", errorbuf );
return( 1 );
}
- slapi_ch_free((void **)&configdir);
+ slapi_ch_free((void **)&instancedir);
slapdFrontendConfig = getFrontendConfig();
diff --git a/ldap/systools/idsktune.c b/ldap/systools/idsktune.c
index 5018ad26..8d90160f 100644
--- a/ldap/systools/idsktune.c
+++ b/ldap/systools/idsktune.c
@@ -108,7 +108,6 @@ extern char *optarg;
#include <sys/vfs.h>
#include <sys/utsname.h>
#include <linux/kernel.h>
-#include <linux/sys.h>
#include <sys/time.h>
#include <sys/param.h>
#include <mntent.h>
diff --git a/nsdefs.mk b/nsdefs.mk
index 04835286..09de1e09 100644
--- a/nsdefs.mk
+++ b/nsdefs.mk
@@ -227,8 +227,8 @@ COMMON_OBJDIR_32= $(subst $(NS64TAG),,$(COMMON_OBJDIR))
OBJDIR=$(COMMON_OBJDIR)
OBJDIR_32=$(COMMON_OBJDIR_32)
DO_SEARCH=no
-DIR_VERSION:=1.0.3
-NOSP_DIR_VERSION:=1.0.3
+DIR_VERSION:=1.0.4
+NOSP_DIR_VERSION:=1.0.4
DIR_NORM_VERSION:=1.0
PRODUCT_NAME="$(PRODUCTCORE) $(DIR_VERSION)"
# When you change DIRSDK_VERSION or DIRSDK_VERSION_DLL_SUFFIX, you must