[Fedora-directory-commits] adminserver/lib/libdsa dsalib_conf.c, 1.1, 1.2 dsalib_db.c, 1.1, 1.2 dsalib_location.c, 1.1, 1.2 dsalib_updown.c, 1.1, 1.2
Nathan Kinder (nkinder)
fedora-directory-commits at redhat.com
Mon Jun 25 23:23:15 UTC 2007
- Previous message (by thread): [Fedora-directory-commits] adminserver Makefile.am, 1.16, 1.17 Makefile.in, 1.16, 1.17 aclocal.m4, 1.13, 1.14 config.guess, 1.8, 1.9 config.h.in, 1.4, 1.5 config.sub, 1.8, 1.9 configure, 1.15, 1.16 depcomp, 1.8, 1.9 install-sh, 1.8, 1.9 ltmain.sh, 1.3, 1.4 missing, 1.8, 1.9
- Next message (by thread): [Fedora-directory-commits] adminserver Makefile.am, 1.17, 1.18 Makefile.in, 1.17, 1.18 configure, 1.16, 1.17 configure.ac, 1.11, 1.12
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: nkinder
Update of /cvs/dirsec/adminserver/lib/libdsa
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv27108/lib/libdsa
Modified Files:
dsalib_conf.c dsalib_db.c dsalib_location.c dsalib_updown.c
Log Message:
Resolves: 245665
Summary: Make dsalib use Directory Server config values for paths.
Index: dsalib_conf.c
===================================================================
RCS file: /cvs/dirsec/adminserver/lib/libdsa/dsalib_conf.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- dsalib_conf.c 13 Jun 2007 01:37:17 -0000 1.1
+++ dsalib_conf.c 25 Jun 2007 23:23:12 -0000 1.2
@@ -122,6 +122,9 @@
{"nsslapd-rootpwstoragescheme"},
{"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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- dsalib_db.c 13 Jun 2007 01:37:17 -0000 1.1
+++ dsalib_db.c 25 Jun 2007 23:23:12 -0000 1.2
@@ -69,17 +69,10 @@
ds_get_bak_dirs()
{
char format_str[PATH_MAX];
- char *root;
int i = 0;
char **bak_dirs = NULL;
char *bakdir = NULL;
- if ( (root = ds_get_install_root()) == NULL )
- {
- ds_send_error("Cannot find server root directory.", 0);
- return(bak_dirs);
- }
-
if ( (bakdir = ds_get_bak_dir()) == NULL )
{
ds_send_error("Cannot find backup directory.", 0);
@@ -92,7 +85,7 @@
{
while( bak_dirs[i] != NULL )
{
- /* Prepend the filename with the install root */
+ /* Prepend the filename with the backup directory */
char filename[PATH_MAX];
PR_snprintf( filename, PATH_MAX, "%s%c%s",
bakdir, FILE_SEP, bak_dirs[i] );
Index: dsalib_location.c
===================================================================
RCS file: /cvs/dirsec/adminserver/lib/libdsa/dsalib_location.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- dsalib_location.c 13 Jun 2007 01:37:17 -0000 1.1
+++ dsalib_location.c 25 Jun 2007 23:23:12 -0000 1.2
@@ -99,7 +99,18 @@
DS_EXPORT_SYMBOL char *
ds_get_config_dir()
{
- return getenv("DS_CONFIG_DIR");
+ char *ds_name;
+ char *configdir_env;
+ static char configdir[PATH_MAX];
+
+ if (configdir_env = getenv("DS_CONFIG_DIR")) {
+ return configdir_env;
+ } else {
+ if ( (ds_name = ds_get_server_name()) == NULL )
+ return(NULL);
+ PR_snprintf(configdir, sizeof(configdir), "%s/%s", INSTCONFIGDIR, ds_name);
+ return (configdir);
+ }
}
/*
@@ -122,7 +133,13 @@
DS_EXPORT_SYMBOL char *
ds_get_run_dir()
{
- return getenv("DS_RUN_DIR");
+ char *rundir;
+
+ if (rundir = getenv("DS_RUN_DIR")) {
+ return rundir;
+ } else {
+ return ds_get_config_value(DS_RUNDIR);
+ }
}
/*
@@ -145,7 +162,13 @@
DS_EXPORT_SYMBOL char *
ds_get_bak_dir()
{
- return getenv("DS_BAK_DIR");
+ char *bakdir;
+
+ if (bakdir = getenv("DS_BAK_DIR")) {
+ return bakdir;
+ } else {
+ return ds_get_config_value(DS_BAKDIR);
+ }
}
/*
@@ -168,7 +191,13 @@
DS_EXPORT_SYMBOL char *
ds_get_tmp_dir()
{
- return getenv("DS_TMP_DIR");
+ char *tmpdir;
+
+ if (tmpdir = getenv("DS_TMP_DIR")) {
+ return tmpdir;
+ } else {
+ return ds_get_config_value(DS_TMPDIR);
+ }
}
/*
Index: dsalib_updown.c
===================================================================
RCS file: /cvs/dirsec/adminserver/lib/libdsa/dsalib_updown.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- dsalib_updown.c 13 Jun 2007 01:37:17 -0000 1.1
+++ dsalib_updown.c 25 Jun 2007 23:23:12 -0000 1.2
@@ -92,7 +92,7 @@
int status = 0;
if ( (rundir = ds_get_run_dir()) == NULL ) {
- fprintf(stderr, "ds_get_updown_status: could not get install root\n");
+ fprintf(stderr, "ds_get_updown_status: could not get run directory\n");
return(DS_SERVER_UNKNOWN);
}
PR_snprintf(pid_file_name, BIG_LINE, "%s/%s.pid", rundir, ds_get_server_name());
@@ -108,7 +108,7 @@
status = fscanf(pidfile, "%d\n", &ipid);
fclose(pidfile);
if ( status == -1 ) {
- fprintf(stderr,
+ 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? */
@@ -116,13 +116,13 @@
}
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
+ /* we should get ESRCH if the server is down, anything else may be
a real problem */
- if (errno != ESRCH) {
- fprintf(stderr,
+ 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);
}
@@ -310,6 +310,7 @@
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 )
return(DS_SERVER_UNKNOWN);
@@ -323,58 +324,50 @@
DS_EXPORT_SYMBOL int
ds_bring_down_server()
{
- char *root;
int status;
int cur_size;
char *errorlog;
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);
- 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
- {
+ if ( StopServer() == DS_SERVER_DOWN ) {
+ 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());
}
- Previous message (by thread): [Fedora-directory-commits] adminserver Makefile.am, 1.16, 1.17 Makefile.in, 1.16, 1.17 aclocal.m4, 1.13, 1.14 config.guess, 1.8, 1.9 config.h.in, 1.4, 1.5 config.sub, 1.8, 1.9 configure, 1.15, 1.16 depcomp, 1.8, 1.9 install-sh, 1.8, 1.9 ltmain.sh, 1.3, 1.4 missing, 1.8, 1.9
- Next message (by thread): [Fedora-directory-commits] adminserver Makefile.am, 1.17, 1.18 Makefile.in, 1.17, 1.18 configure, 1.16, 1.17 configure.ac, 1.11, 1.12
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Fedora-directory-commits
mailing list