Author: nkinder
Update of /cvs/dirsec/adminserver/lib/libdsa
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv16109/lib/libdsa
Modified Files:
dsalib_conf.c dsalib_db.c dsalib_ldif.c dsalib_location.c
dsalib_updown.c
Log Message:
Resolves: 245665
Summary: Removed server root logic from dsalib.
Index: dsalib_conf.c
===================================================================
RCS file: /cvs/dirsec/adminserver/lib/libdsa/dsalib_conf.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- dsalib_conf.c 25 Jun 2007 23:23:12 -0000 1.2
+++ dsalib_conf.c 26 Jun 2007 18:34:47 -0000 1.3
@@ -123,7 +123,6 @@
{"nsslapd-suffix"},
{"nsslapd-localuser"},
{"nsslapd-bakdir"},
-{"nsslapd-lockdir"},
{"nsslapd-tmpdir"},
{0}
};
Index: dsalib_db.c
===================================================================
RCS file: /cvs/dirsec/adminserver/lib/libdsa/dsalib_db.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- dsalib_db.c 25 Jun 2007 23:23:12 -0000 1.2
+++ dsalib_db.c 26 Jun 2007 18:34:47 -0000 1.3
@@ -112,7 +112,7 @@
char startup_line[BIG_LINE];
char statfile[PATH_MAX];
char *tmp_dir;
- char *root;
+ char *instdir;
int haderror = 0;
int error = -1;
int status;
@@ -126,8 +126,8 @@
if ( status == DS_SERVER_UP ) {
return DS_SERVER_MUST_BE_DOWN;
}
- if ( (root = ds_get_install_root()) == NULL ) {
- return DS_NO_SERVER_ROOT;
+ if ( (instdir = ds_get_instance_dir()) == NULL ) {
+ return DS_NO_INSTANCE_DIR;
}
if ( file[strlen(file) - 1] == '\n' ) /* strip out returns */
@@ -145,7 +145,7 @@
"%s%cbak2db "
"%s%s%s > "
"%s%s%s 2>&1",
- root, FILE_SEP,
+ instdir, FILE_SEP,
ENQUOTE, file, ENQUOTE,
ENQUOTE, statfile, ENQUOTE );
alter_startup_line(startup_line);
@@ -189,7 +189,7 @@
char startup_line[BIG_LINE];
char statfile[PATH_MAX];
char *tmp_dir;
- char *root;
+ char *instdir;
int haderror = 0;
int error = -1;
FILE *sf = NULL;
@@ -198,8 +198,8 @@
time_t ltime;
#endif
- if ( (root = ds_get_install_root()) == NULL ) {
- return DS_NO_SERVER_ROOT;
+ if ( (instdir = ds_get_instance_dir()) == NULL ) {
+ return DS_NO_INSTANCE_DIR;
}
if ( (file == NULL) || (strlen(file) == 0) )
@@ -245,7 +245,7 @@
"%s%cdb2bak "
"%s%s%s > "
"%s%s%s 2>&1",
- root, FILE_SEP,
+ instdir, FILE_SEP,
ENQUOTE,
(file == NULL) ? "" : file,
ENQUOTE,
@@ -347,22 +347,20 @@
ds_vlvindex(char **backendList, char **vlvList)
{
char startup_line[BIG_LINE];
- char *root;
- char *instroot;
+ char *instdir;
char **vlvc = NULL;
- root = ds_get_server_root();
- instroot = ds_get_install_root();
- if ( (root == NULL) || (instroot == NULL) ) {
- return DS_NO_SERVER_ROOT;
+ instdir = ds_get_instance_dir();
+ if ( instdir == NULL ) {
+ return DS_NO_INSTANCE_DIR;
}
- PR_snprintf(startup_line, sizeof(startup_line), "%s/bin/slapd/server/%s db2index
"
+ PR_snprintf(startup_line, sizeof(startup_line), "%s/%s db2index "
"-D %s%s/%s "
"-n %s ",
- root, SLAPD_NAME,
- ENQUOTE, instroot, ENQUOTE,
+ CMDBINDIR, SLAPD_NAME,
+ ENQUOTE, instdir, ENQUOTE,
backendList[0]);
@@ -385,21 +383,19 @@
ds_addindex(char **attrList, char *backendName)
{
char startup_line[BIG_LINE];
- char *root;
- char *instroot;
+ char *instdir;
- root = ds_get_server_root();
- instroot = ds_get_install_root();
+ instdir = ds_get_instance_dir();
- if ( (root == NULL) || (instroot == NULL) ) {
- return DS_NO_SERVER_ROOT;
+ if ( instdir == NULL ) {
+ return DS_NO_INSTANCE_DIR;
}
- PR_snprintf(startup_line, sizeof(startup_line), "%s/bin/slapd/server/%s db2index
"
+ PR_snprintf(startup_line, sizeof(startup_line), "%s/%s db2index "
"-D %s%s%s "
"-n %s",
- root, SLAPD_NAME,
- ENQUOTE, instroot, ENQUOTE,
+ CMDBINDIR, SLAPD_NAME,
+ ENQUOTE, instdir, ENQUOTE,
backendName);
while( *attrList != NULL ) {
Index: dsalib_ldif.c
===================================================================
RCS file: /cvs/dirsec/adminserver/lib/libdsa/dsalib_ldif.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- dsalib_ldif.c 13 Jun 2007 01:37:17 -0000 1.1
+++ dsalib_ldif.c 26 Jun 2007 18:34:47 -0000 1.2
@@ -154,7 +154,7 @@
importldif(char *file, int preserve, char *backend, char *subtree)
{
char startup_line[BIG_LINE];
- char *root;
+ char *instdir;
int haderror = 0;
int i = 0, error = -1;
int status;
@@ -178,11 +178,11 @@
#endif /* DEBUG_CGI */
return DS_SERVER_MUST_BE_DOWN;
}
- if ( (root = ds_get_install_root()) == NULL ) {
+ if ( (instdir = ds_get_instance_dir()) == NULL ) {
#ifdef DEBUG_CGI
- fprintf(stderr, "importldif: could not get server root\n");
+ fprintf(stderr, "importldif: could not get instance directory\n");
#endif /* DEBUG_CGI */
- return DS_NO_SERVER_ROOT;
+ return DS_NO_INSTANCE_DIR;
}
if ( file[strlen(file) - 1] == '\n' ) /* strip out returns */
@@ -203,21 +203,21 @@
if ( preserve ) {
PR_snprintf(startup_line, BIG_LINE, "%s%cldif2db%s -i %s%s%s",
- root, FILE_SEP, SCRIPT_SUFFIX,
+ instdir, FILE_SEP, SCRIPT_SUFFIX,
ENQUOTE, file, ENQUOTE);
} else if (backend) {
PR_snprintf(startup_line, BIG_LINE, "%s%cldif2db%s -n %s%s%s -i %s%s%s",
- root, FILE_SEP, SCRIPT_SUFFIX,
+ instdir, FILE_SEP, SCRIPT_SUFFIX,
ENQUOTE, backend, ENQUOTE,
ENQUOTE, file, ENQUOTE);
} else if (subtree) {
PR_snprintf(startup_line, BIG_LINE, "%s%cldif2db%s -s %s%s%s -i %s%s%s",
- root, FILE_SEP, SCRIPT_SUFFIX,
+ instdir, FILE_SEP, SCRIPT_SUFFIX,
ENQUOTE, subtree, ENQUOTE,
ENQUOTE, file, ENQUOTE);
} else {
PR_snprintf(startup_line, BIG_LINE, "%s%cldif2db%s -i %s%s%s -noconfig",
- root, FILE_SEP, SCRIPT_SUFFIX,
+ instdir, FILE_SEP, SCRIPT_SUFFIX,
ENQUOTE, file, ENQUOTE);
}
alter_startup_line(startup_line);
@@ -311,13 +311,13 @@
char outfile[PATH_MAX];
char scriptfile[PATH_MAX];
char *tmp_dir;
- char *root;
+ char *instdir;
int haderror = 0;
int error = -1;
FILE *sf = NULL;
- if ( (root = ds_get_install_root()) == NULL ) {
- return DS_NO_SERVER_ROOT;
+ if ( (instdir = ds_get_instance_dir()) == NULL ) {
+ return DS_NO_INSTANCE_DIR;
}
if ( (file == NULL) || (strlen(file) == 0) )
@@ -343,7 +343,7 @@
else
PL_strncpyz( outfile, file, sizeof(outfile) );
- PR_snprintf(scriptfile, PATH_MAX, "%s%cdb2ldif", root, FILE_SEP);
+ PR_snprintf(scriptfile, PATH_MAX, "%s%cdb2ldif", instdir, FILE_SEP);
PATH_FOR_PLATFORM( outfile );
PATH_FOR_PLATFORM( scriptfile );
Index: dsalib_location.c
===================================================================
RCS file: /cvs/dirsec/adminserver/lib/libdsa/dsalib_location.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- dsalib_location.c 25 Jun 2007 23:23:12 -0000 1.2
+++ dsalib_location.c 26 Jun 2007 18:34:47 -0000 1.3
@@ -51,44 +51,21 @@
#include "plstr.h"
/*
- * Returns the server root. Info is
- * returned in a static area. The caller must copy it
- * for reuse if needed.
- */
-DS_EXPORT_SYMBOL char *
-ds_get_server_root()
-{
- char *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 );
-
- return root;
-}
-
-/*
- * Returns the install location of the server. Info is
- * returned in a static area. The caller must copy it
- * for reuse if needed.
+ * Returns the instance directory path 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_install_root()
+ds_get_instance_dir()
{
- char *root;
char *ds_name;
- static char install_root[PATH_MAX];
+ static char instance_dir[PATH_MAX];
- if ( (root = ds_get_server_root()) == NULL )
- return(NULL);
if ( (ds_name = ds_get_server_name()) == NULL )
return(NULL);
- PR_snprintf(install_root, sizeof(install_root), "%s/%s", root, ds_name);
- return(install_root);
+ PR_snprintf(instance_dir, sizeof(instance_dir), "%s/%s", DSLIBDIR,
ds_name);
+ return(instance_dir);
}
/*
@@ -136,9 +113,9 @@
char *rundir;
if (rundir = getenv("DS_RUN_DIR")) {
- return rundir;
+ return (rundir);
} else {
- return ds_get_config_value(DS_RUNDIR);
+ return (PIDDIR);;
}
}
@@ -231,6 +208,9 @@
return(install_root);
}
+/*
+ * Returns the Directory Server instance name.
+ */
DS_EXPORT_SYMBOL char *
ds_get_server_name()
{
Index: dsalib_updown.c
===================================================================
RCS file: /cvs/dirsec/adminserver/lib/libdsa/dsalib_updown.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- dsalib_updown.c 25 Jun 2007 23:23:12 -0000 1.2
+++ dsalib_updown.c 26 Jun 2007 18:34:47 -0000 1.3
@@ -156,7 +156,7 @@
configuration information in memory, we don't need to read it in
*/
DS_EXPORT_SYMBOL int
-ds_bring_up_server_install(int verbose, char *root, char *errorlog)
+ds_bring_up_server_install(int verbose, char *instdir, char *errorlog)
{
#if !defined( XP_WIN32 )
char startup_line[BIG_LINE];
@@ -174,7 +174,7 @@
status = ds_get_updown_status();
if ( status == DS_SERVER_UP )
return(DS_SERVER_ALREADY_UP);
- if (!root || !errorlog)
+ if (!instdir || !errorlog)
return(DS_SERVER_UNKNOWN);
if (verbose) {
@@ -187,7 +187,7 @@
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);
+ instdir, FILE_SEP, START_SCRIPT, statfile);
alter_startup_line(startup_line);
error = system(startup_line);
if (error == -1)
@@ -304,21 +304,20 @@
DS_EXPORT_SYMBOL int
ds_bring_up_server(int verbose)
{
- char *root;
+ char *instdir;
int status;
- char *errorlog;
+ char *errorlog;
status = ds_get_updown_status();
if ( status == DS_SERVER_UP )
return(DS_SERVER_ALREADY_UP);
- /* NGK - Need to eliminate root */
- if ( (root = ds_get_install_root()) == NULL )
+ if ( (instdir = ds_get_instance_dir()) == NULL )
return(DS_SERVER_UNKNOWN);
errorlog = ds_get_config_value(DS_ERRORLOG);
if ( errorlog == NULL ) {
errorlog = ds_get_errors_name(); /* fallback */
}
- return ds_bring_up_server_install(verbose, root, errorlog);
+ return ds_bring_up_server_install(verbose, instdir, errorlog);
}
DS_EXPORT_SYMBOL int
@@ -530,7 +529,7 @@
StartNetscapeProgram()
{
char line[BIG_LINE], cmd[BIG_LINE];
- char *tmp = ds_get_install_root();
+ char *tmp = ds_get_instance_dir();
CHAR ErrorString[512];
STARTUPINFO siStartInfo;