X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fcitserver.c;h=f389ac9f020b303551e62769d12c4d9135ea9b6c;hb=e6499f44a49d449e41ba605a0c7476019da432b4;hp=ce562ccdbba6953e58636d589e446044101d93d4;hpb=dda17adf6e6918dccf84b729faf4cd0834e47e49;p=citadel.git diff --git a/citadel/citserver.c b/citadel/citserver.c index ce562ccdb..f389ac9f0 100644 --- a/citadel/citserver.c +++ b/citadel/citserver.c @@ -138,13 +138,10 @@ void master_startup(void) { open_databases(); /* Load site-specific configuration */ - syslog(LOG_INFO, "Loading citadel.config"); + syslog(LOG_INFO, "Initializing configuration system"); initialize_config_system(); validate_config(); - - syslog(LOG_INFO, "Acquiring control record"); - get_control(); - put_config(); + migrate_legacy_control_record(); /* Check floor reference counts */ check_ref_counts(); @@ -183,16 +180,14 @@ void master_startup(void) { srand(seed); srandom(seed); - put_config(); - syslog(LOG_DEBUG, "master_startup() finished\n"); } /* - * Cleanup routine to be called when the server is shutting down. + * Cleanup routine to be called when the server is shutting down. Returns the needed exit code. */ -void master_cleanup(int exitcode) { +int master_cleanup(int exitcode) { struct CleanupFunctionHook *fcn; static int already_cleaning_up = 0; @@ -226,17 +221,17 @@ void master_cleanup(int exitcode) { } } - release_control(); - /* Now go away. */ syslog(LOG_NOTICE, "citserver: Exiting with status %d\n", exitcode); fflush(stdout); fflush(stderr); - if (restart_server != 0) - exit(1); - if ((running_as_daemon != 0) && ((exitcode == 0) )) + if (restart_server != 0) { + exitcode = 1; + } + else if ((running_as_daemon != 0) && ((exitcode == 0) )) { exitcode = CTDLEXIT_SHUTDOWN; - exit(exitcode); + } + return(exitcode); } @@ -380,69 +375,6 @@ void citproto_begin_admin_session() { } - - -/* - * This loop recognizes all server commands. - */ -void do_command_loop(void) { - char cmdbuf[SIZ]; - - time(&CC->lastcmd); - memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */ - if (client_getln(cmdbuf, sizeof cmdbuf) < 1) { - syslog(LOG_ERR, "Citadel client disconnected: ending session.\n"); - CC->kill_me = KILLME_CLIENT_DISCONNECTED; - return; - } - - /* Log the server command, but don't show passwords... */ - if ( (strncasecmp(cmdbuf, "PASS", 4)) && (strncasecmp(cmdbuf, "SETP", 4)) ) { - syslog(LOG_INFO, "[%d][%s(%ld)] %s", - CC->cs_pid, CC->curr_user, CC->user.usernum, cmdbuf - ); - } - else { - syslog(LOG_INFO, "[%d][%s(%ld)]