SILC_TASK_CALLBACK(stop_server)
{
- /* Stop scheduler, the program will stop eventually after noticing
- that the scheduler is down. */
- silc_schedule_stop(silcd->schedule);
+ silc_server_stop(silcd);
}
/* Dump server statistics into a file into /tmp directory */
{ 7, "silcd\\.c,server\\.c,command\\.c,server_backup\\.c,packet_send\\.c" },
/* All basic stuff from silcd/ */
- { 10, "silc_server_*" },
+ { 10, "silc_server_*,*silc_id_create_*,*idlist*,*skr*" },
/* All from silcd/ */
- { 15, "*silcd*,*serverid*,silc_server_*,*idlist*" },
+ { 15, "*silcd*,*serverid*,silc_server_*,*idlist*,*skr*" },
/* All from silcd/ and basic stuff from libs */
- { 20, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,*silcske*" },
+ { 20, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,*silcske*,"
+ "*skr*" },
/* All from silcd/ and more stuff from libs */
{ 25, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,"
- "*silcpacket*,*ske*,*silcrng*" },
+ "*silcpacket*,*ske*,*silcrng*,*skr*" },
/* All from silcd/ and even more stuff from libs */
- { 30, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,"
+ { 30, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,*skr*"
"*silcpacket*,*ske*,*silcrng*,*command*,*channel*,*private*,*notify*" },
/* All from silcd/ and even more stuff from libs + all from silccore */
- { 35, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,"
+ { 35, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,*skr*"
"*silcpacket*,*ske*,*silcrng*,*command*,*channel*,*private*,*notify*"
"*silcid*,*argument*" },
/* All from silcd/, all from silccore, silccrypt and silcmath */
- { 40, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,"
+ { 40, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,*skr*"
"*silcpacket*,*ske*,*silcrng*,*command*,*channel*,*private*,*notify*"
"*silcid*,*argument*,*pkcs*,*hmac*,*hash*,*cipher*,silc_math*" },
/* All from silcd/, all from silccore, silccrypt and silcmath + stuff
from silcutil */
- { 45, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,"
+ { 45, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,*skr*"
"*silcpacket*,*ske*,*silcrng*,*command*,*channel*,*private*,*notify*"
"*silcid*,*argument*,*pkcs*,*hmac*,*hash*,*cipher*,silc_math*,*sim*"
"*sockconn*" },
/* All from silcd/, all from silccore, silccrypt and silcmath + more stuff
from silcutil */
- { 50, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,"
+ { 50, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,*skr*"
"*silcpacket*,*ske*,*silcrng*,*command*,*channel*,*private*,*notify*"
"*silcid*,*argument*,*pkcs*,*hmac*,*hash*,*cipher*,silc_math*,*sim*"
"*sockconn*,*net*" },
/* All from silcd/, all from silccore, silccrypt and silcmath + more stuff
from silcutil */
- { 55, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,"
+ { 55, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,*skr*"
"*silcpacket*,*ske*,*silcrng*,*command*,*channel*,*private*,*notify*"
"*silcid*,*argument*,*pkcs*,*hmac*,*hash*,*cipher*,silc_math*,*sim*"
"*sockconn*,*net*,*log*,*config*" },
}
}
+#ifdef SILC_DEBUG
+#define NUM_DEBUGS 3000
+static char debugs[NUM_DEBUGS][128];
+static int cur_debug = 0;
+
+SilcBool silc_server_debug_callback(char *file, char *function, int line,
+ char *message, void *context)
+{
+ SilcTimeStruct curtime;
+
+ /* Save the message to ring buffer */
+ silc_time_value(0, &curtime);
+ silc_snprintf(debugs[cur_debug % NUM_DEBUGS], sizeof(debugs[0]),
+ "%02d:%02d:%02d %s:%d: %s", curtime.hour,
+ curtime.minute, curtime.second, function, line,
+ message);
+ cur_debug++;
+
+ return FALSE;
+}
+#endif /* SILC_DEBUG */
+
int main(int argc, char **argv)
{
int ret, opt, option_index;
char *silcd_config_file = NULL;
struct sigaction sa;
+#ifdef SILC_DEBUG
+ silc_log_set_debug_callbacks(silc_server_debug_callback, NULL, NULL, NULL);
+#endif /* SILC_DEBUG */
+
/* Parse command line arguments */
if (argc > 1) {
#ifdef HAVE_GETOPT_LONG
silc_pkcs_register_default();
silc_hash_register_default();
silc_hmac_register_default();
- silc_create_key_pair(opt_pkcs, opt_bits, pubfile, prvfile,
- opt_identifier, "", NULL, NULL, FALSE);
+ if (!silc_create_key_pair(opt_pkcs, opt_bits, pubfile, prvfile,
+ opt_identifier, "", NULL, NULL, FALSE))
+ exit(1);
exit(0);
}
silc_file_writefile(pidfile, buf, strlen(buf));
}
- silc_server_drop_privs(silcd);
}
+ silc_server_drop_privs(silcd);
/* Run the server. When this returns the server has been stopped
and we will exit. */
silc_server_run(silcd);
- /* Stop the server and free it. */
- silc_server_stop(silcd);
+ /* Free server */
silc_server_config_destroy(silcd->config);
silc_server_free(silcd);