X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fcitserver.c;h=6a85744a55ce04d0a653223c7af813b2d0bc07f4;hb=1e656d277fe91b7c4f5d73eab4a0dd0b7a173145;hp=92d031d41d8919387304aed4c30d37c38975e5bb;hpb=afd381ef27384ee5ee21052df19feed2d15b6481;p=citadel.git diff --git a/citadel/citserver.c b/citadel/citserver.c index 92d031d41..6a85744a5 100644 --- a/citadel/citserver.c +++ b/citadel/citserver.c @@ -40,6 +40,7 @@ #include #include #include +#include #include "citadel.h" #include "server.h" #include "sysdep_decls.h" @@ -55,7 +56,6 @@ #include "file_ops.h" #include "policy.h" #include "control.h" -#include "tools.h" #include "euidindex.h" #ifndef HAVE_SNPRINTF @@ -68,6 +68,7 @@ char *unique_session_numbers; int ScheduledShutdown = 0; int do_defrag = 0; time_t server_startup_time; +int panic_fd; /** * \brief print the actual stack frame. @@ -91,6 +92,31 @@ void cit_backtrace(void) free(strings); #endif } + +/** + * \brief print the actual stack frame. + */ +void cit_panic_backtrace(int SigNum) +{ +#ifdef HAVE_BACKTRACE + void *stack_frames[10]; + size_t size, i; + char **strings; + + printf("caught signal 11\n"); + size = backtrace(stack_frames, sizeof(stack_frames) / sizeof(void*)); + strings = backtrace_symbols(stack_frames, size); + for (i = 0; i < size; i++) { + if (strings != NULL) + lprintf(1, "%s\n", strings[i]); + else + lprintf(1, "%p\n", stack_frames[i]); + } + free(strings); +#endif + exit(-1); +} + /* * Various things that need to be initialized at startup */ @@ -798,7 +824,7 @@ void cmd_down(char *argbuf) { } else { - cprintf(Reply, CIT_OK); + cprintf(Reply, CIT_OK + SERVER_SHUTTING_DOWN); } time_to_die = 1; } @@ -902,10 +928,10 @@ void begin_session(struct CitContext *con) strcpy(con->lastcmdname, " "); strcpy(con->cs_clientname, "(unknown)"); strcpy(con->curr_user, NLI); - strcpy(con->net_node, ""); - strcpy(con->fake_username, ""); - strcpy(con->fake_hostname, ""); - strcpy(con->fake_roomname, ""); + *con->net_node = '\0'; + *con->fake_username = '\0'; + *con->fake_hostname = '\0'; + *con->fake_roomname = '\0'; generate_nonce(con); safestrncpy(con->cs_host, config.c_fqdn, sizeof con->cs_host); safestrncpy(con->cs_addr, "", sizeof con->cs_addr);