const char *CitadelServiceTCP="citadel-TCP";
+extern struct CitContext masterCC;
+
+
void go_threading(void);
/*
else
safestrncpy(relhome, &argv[a][2],
sizeof relhome);
- home_specified = 1;
home=1;
}
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 (getuser(&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") ;
+ putuser(&masterCC.user);
+ getuser(&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();
/*