* make some pointers const...
[citadel.git] / citadel / server_main.c
index cfb7ce64f0a4bbde9b7fc92c2bf6e9d15bf1d033..b3d110cd8b498b4631621fb143eb0989b65d390d 100644 (file)
@@ -133,7 +133,6 @@ int main(int argc, char **argv)
                        else
                                safestrncpy(relhome, &argv[a][2],
                                                        sizeof relhome);
-                       home_specified = 1;
                        home=1;
                }
 
@@ -249,18 +248,26 @@ int main(int argc, char **argv)
         */
        master_startup();
 
+       /*
+        * Check that the control record is correct and place sensible values if it isn't
+        */
+       check_control();
        
-/*
- * Initialise the user 0 to have a name. It would be nice to do it in InitializeMasterCC
- * since it is contained within the MasterCC but we can't because the DB isn't available
- * at that time so we do it seperate.
+       /*
+        * 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
  */
-       /** Give user 0 a name and create them if necessary */
-       if (getuser(&masterCC.user, "Citadel"))
+       if (getuser(&masterCC.user, "SYS_Citadel"))
        {
-               getuserbynumber(&masterCC.user, 0);
-               strcpy (masterCC.user.fullname, "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 */
        }
        
        /*
@@ -284,11 +291,6 @@ int main(int argc, char **argv)
                                CitadelServiceTCP);
 
                                
-       /*
-        * Run any upgrade entry points
-        */
-       CtdlLogPrintf(CTDL_INFO, "Upgrading modules.\n");
-       upgrade_modules();
        
        
        /*
@@ -308,6 +310,14 @@ int main(int argc, char **argv)
                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