int ScheduledShutdown = 0;
time_t server_startup_time;
int panic_fd;
+int openid_level_supported = 0;
/*
* print the actual stack frame.
syslog(LOG_INFO, "Opening databases\n");
open_databases();
-
- ctdl_thread_internal_init_tsd();
-
- CtdlThreadAllocTSD();
-
check_ref_counts();
syslog(LOG_INFO, "Creating base rooms (if necessary)\n");
syslog(LOG_INFO, "Closing databases\n");
close_databases();
-#ifdef DEBUG_MEMORY_LEAKS
- dump_heap();
-#endif
-
/* If the operator requested a halt but not an exit, halt here. */
if (shutdown_and_halt) {
syslog(LOG_NOTICE, "citserver: Halting server without exiting.\n");
cprintf("%s\n", config.c_moreprompt);
cprintf("1\n"); /* 1 = yes, this system supports floors */
cprintf("1\n"); /* 1 = we support the extended paging options */
- cprintf("%s\n", CC->cs_nonce);
+ cprintf("\n"); /* nonce no longer supported */
cprintf("1\n"); /* 1 = yes, this system supports the QNOP command */
#ifdef HAVE_LDAP
cprintf("%s\n", config.c_default_cal_zone);
- /* Output load averages */
- cprintf("%f\n", CtdlThreadLoadAvg);
- cprintf("%f\n", CtdlThreadWorkerAvg);
- cprintf("%d\n", CtdlThreadGetCount());
+ /* thread load averages -- temporarily disabled during refactoring of this code */
+ cprintf("0\n"); /* load average */
+ cprintf("0\n"); /* worker average */
+ cprintf("0\n"); /* thread count */
cprintf("1\n"); /* yes, Sieve mail filtering is supported */
cprintf("%d\n", config.c_enable_fulltext);
cprintf("%s\n", svn_revision());
if (config.c_auth_mode == AUTHMODE_NATIVE) {
- cprintf("1\n"); /* OpenID is enabled when using native auth */
+ cprintf("%d\n", openid_level_supported); /* OpenID is enabled when using native auth */
}
else {
cprintf("0\n"); /* OpenID is disabled when using non-native auth */
sleep(5);
cprintf("%d Authentication failed.\n", ERROR + PASSWORD_REQUIRED);
syslog(LOG_ERR, "Warning: ipgm authentication failed.\n");
- CC->kill_me = 1;
+ CC->kill_me = KILLME_AUTHFAILED;
}
}
{
cprintf(Reply, CIT_OK + SERVER_SHUTTING_DOWN);
}
- CC->kill_me = 1; /* Even the DOWN command has to follow correct proceedure when disconecting */
+ CC->kill_me = KILLME_SERVER_SHUTTING_DOWN;
CtdlThreadStopAll();
}
}
-/*
- * Generate a "nonce" for APOP-style authentication.
- *
- * RFC 1725 et al specify a PID to be placed in front of the nonce.
- * Quoth BTX: That would be stupid.
- */
-void generate_nonce(CitContext *con) {
- struct timeval tv;
-
- memset(con->cs_nonce, NONCE_SIZE, 0);
- gettimeofday(&tv, NULL);
- memset(con->cs_nonce, NONCE_SIZE, 0);
- snprintf(con->cs_nonce, NONCE_SIZE, "<%d%ld@%s>",
- rand(), (long)tv.tv_usec, config.c_fqdn);
-}
-
/*
* Back-end function for starting a session
con->internal_pgm = 0;
con->download_fp = NULL;
con->upload_fp = NULL;
+ con->cached_msglist = NULL;
+ con->cached_num_msgs = 0;
con->FirstExpressMessage = NULL;
time(&con->lastcmd);
time(&con->lastidle);
*con->fake_hostname = '\0';
*con->fake_roomname = '\0';
*con->cs_clientinfo = '\0';
- generate_nonce(con);
safestrncpy(con->cs_host, config.c_fqdn, sizeof con->cs_host);
safestrncpy(con->cs_addr, "", sizeof con->cs_addr);
con->cs_UDSclientUID = -1;
ERROR + MAX_SESSIONS_EXCEEDED,
config.c_nodename, config.c_maxsessions
);
- CC->kill_me = 1;
+ CC->kill_me = KILLME_MAX_SESSIONS_EXCEEDED;
}
else {
cprintf("%d %s Citadel server ready.\n", CIT_OK, config.c_nodename);
void cmd_quit(char *argbuf)
{
cprintf("%d Goodbye.\n", CIT_OK);
- CC->kill_me = 1;
+ CC->kill_me = KILLME_CLIENT_LOGGED_OUT;
}
*/
void do_command_loop(void) {
char cmdbuf[SIZ];
- const char *old_name = NULL;
-
- old_name = CtdlThreadName("do_command_loop");
time(&CC->lastcmd);
memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
if (client_getln(cmdbuf, sizeof cmdbuf) < 1) {
- syslog(LOG_ERR, "Client disconnected: ending session.\n");
- CC->kill_me = 1;
- CtdlThreadName(old_name);
+ syslog(LOG_ERR, "Citadel client disconnected: ending session.\n");
+ CC->kill_me = KILLME_CLIENT_DISCONNECTED;
return;
}
time(&CC->lastidle);
}
- CtdlThreadName(cmdbuf);
-
if ((strncasecmp(cmdbuf, "ENT0", 4))
&& (strncasecmp(cmdbuf, "MESG", 4))
&& (strncasecmp(cmdbuf, "MSGS", 4)))
/* Run any after-each-command routines registered by modules */
PerformSessionHooks(EVT_CMD);
- CtdlThreadName(old_name);
}