#include "config.h"
#include "control.h"
#include "database.h"
+#include "user_ops.h"
#include "housekeeping.h"
#include "tools.h"
#include "citadel_dirs.c"
+#include "modules_init.h"
+
+
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#include "snprintf.h"
#endif
-int running_as_daemon = 0;
-
/*
* Here's where it all begins.
*/
#ifdef HAVE_RUN_DIR
struct stat filestats;
#endif
+
+ /* initialise semaphores here. Patch by Matt and davew
+ * its called here as they are needed by lprintf for thread safety
+ */
+ InitialiseSemaphores();
/* initialize the master context */
InitializeMasterCC();
/* on some dists rundir gets purged on startup. so we need to recreate it. */
if (stat(ctdl_run_dir, &filestats)==-1){
-#ifdef BSD_GETPWUID
+#ifdef SOLARIS_GETPWUID
pwp = getpwuid_r(config.c_ctdluid, &pw, pwbuf, sizeof(pwbuf));
#else
getpwuid_r(config.c_ctdluid, &pw, pwbuf, sizeof(pwbuf), &pwp);
*/
lprintf(CTDL_INFO, "Initializing server extensions\n");
size = strlen(ctdl_home_directory) + 9;
+
+/*
initialize_server_extensions();
+*/
+
+ initialise_modules();
+
+
+
+ /*
+ * If we need host auth, start our chkpwd daemon.
+ */
+ if (config.c_auth_mode == 1) {
+ start_chkpwd_daemon();
+ }
/*
* Now that we've bound the sockets, change to the Citadel user id and its
* corresponding group ids
*/
if (drop_root_perms) {
-#ifdef BSD_GETPWUID
+ cdb_chmod_data(); /* make sure we own our data files */
+
+#ifdef SOLARIS_GETPWUID
pwp = getpwuid_r(config.c_ctdluid, &pw, pwbuf, sizeof(pwbuf));
#else
getpwuid_r(config.c_ctdluid, &pw, pwbuf, sizeof(pwbuf), &pwp);
}
end_critical_section(S_WORKER_LIST);
- /* Create the indexer thread. */
+ /* Create the maintenance threads. */
create_maintenance_threads();
/* This thread is now useless. It can't be turned into a worker