#include "database.h"
#include "user_ops.h"
#include "housekeeping.h"
-#include "citadel_dirs.c"
+#include "svn_revision.h"
+#include "citadel_dirs.h"
+
+#include "context.h"
#include "modules_init.h"
#include "ecrash.h"
const char *CitadelServiceTCP="citadel-TCP";
-void go_threading(void);
+void go_threading(void);
/*
* Here's where it all begins.
eCrashParameters params;
// eCrashSymbolTable symbol_table;
#endif
+
+#ifdef HAVE_GC
+ GC_INIT();
+ GC_find_leak = 1;
+#endif
+
+
/* initialise semaphores here. Patch by Matt and davew
* its called here as they are needed by CtdlLogPrintf for thread safety
*/
running_as_daemon = 1;
}
+ /* run a few stats if -s was specified */
+ else if (!strncmp(argv[a], "-s", 2)) {
+ statcount = atoi(&argv[a][2]);
+ }
+
/* -x specifies the desired logging level */
else if (!strncmp(argv[a], "-x", 2)) {
verbosity = atoi(&argv[a][2]);
else
safestrncpy(relhome, &argv[a][2],
sizeof relhome);
- home_specified = 1;
home=1;
}
CtdlLogPrintf(CTDL_EMERG, "citserver: usage: "
"citserver "
"[-lLogFacility] "
- "[-d] [-D] "
+ "[-d] [-D] [-s]"
" [-tTraceFile]"
" [-xLogLevel] [-hHomeDir]\n");
exit(1);
CtdlLogPrintf(CTDL_NOTICE, "\n");
CtdlLogPrintf(CTDL_NOTICE, "\n");
CtdlLogPrintf(CTDL_NOTICE,
- "*** Citadel server engine v%d.%02d ***\n",
- (REV_LEVEL/100), (REV_LEVEL%100));
- CtdlLogPrintf(CTDL_NOTICE,
- "Copyright (C) 1987-2008 by the Citadel development team.\n");
- CtdlLogPrintf(CTDL_NOTICE,
- "This program is distributed under the terms of the GNU "
- "General Public License.\n");
+ "*** Citadel server engine v%d.%02d (build %s) ***\n",
+ (REV_LEVEL/100), (REV_LEVEL%100), svn_revision());
+ CtdlLogPrintf(CTDL_NOTICE, "Copyright (C) 1987-2008 by the Citadel development team.\n");
+ CtdlLogPrintf(CTDL_NOTICE, "This program is distributed under the terms of the GNU "
+ "General Public License.\n");
CtdlLogPrintf(CTDL_NOTICE, "\n");
CtdlLogPrintf(CTDL_DEBUG, "Called as: %s\n", argv[0]);
CtdlLogPrintf(CTDL_INFO, "%s\n", libcitadel_version_string());
CtdlLogPrintf(CTDL_INFO, "Loading citadel.config\n");
get_config();
config.c_ipgm_secret = rand();
+
+ /* get_control() MUST MUST MUST be called BEFORE the databases are opened!! */
+ CtdlLogPrintf(CTDL_INFO, "Acquiring control record\n");
+ get_control();
+
put_config();
#ifdef HAVE_RUN_DIR
*/
master_startup();
- CtdlLogPrintf(CTDL_INFO, "Acquiring control record\n");
- get_control();
-
+ /*
+ * Check that the control record is correct and place sensible values if it isn't
+ */
+ check_control();
+
+ /*
+ * Run any upgrade entry points
+ */
+ CtdlLogPrintf(CTDL_INFO, "Upgrading modules.\n");
+ upgrade_modules();
+
+/**
+ * Load the user for the masterCC or create them if they don't exist
+ */
+ if (CtdlGetUser(&masterCC.user, "SYS_Citadel"))
+ {
+ /** User doesn't exist. We can't use create user here as the user number needs to be 0 */
+ strcpy (masterCC.user.fullname, "SYS_Citadel") ;
+ CtdlPutUser(&masterCC.user);
+ CtdlGetUser(&masterCC.user, "SYS_Citadel"); /** Just to be safe */
+ }
+
/*
* Bind the server to a Unix-domain socket.
*/
CitadelServiceTCP);
- /*
- * Run any upgrade entry points
- */
- CtdlLogPrintf(CTDL_INFO, "Upgrading modules.\n");
- upgrade_modules();
/*
start_chkpwd_daemon();
}
+
+ /*
+ * check, whether we're fired up another time after a crash.
+ * if, post an aide message, so the admin has a chance to react.
+ */
+ checkcrash ();
+
+
/*
* Now that we've bound the sockets, change to the Citadel user id and its
* corresponding group ids