Fixed detaching bugs, channel key distribution after detach,
[silc.git] / apps / silcd / serverconfig.c
index 39f00afe0d912ecf5d759d054d319f245b07daff..73a38bfde43bba4a89a656b8cd95d75622496d76 100644 (file)
@@ -536,9 +536,9 @@ SILC_CONFIG_CALLBACK(fetch_serverinfo)
 
     /* try to load specified file, if fail stop config parsing */
     if (!silc_pkcs_load_private_key(file_tmp, &server_info->private_key,
-                                   SILC_PKCS_FILE_BIN))
+                                   "", 0, SILC_PKCS_FILE_BIN))
       if (!silc_pkcs_load_private_key(file_tmp, &server_info->private_key,
-                                     SILC_PKCS_FILE_PEM)) {
+                                     "", 0, SILC_PKCS_FILE_PEM)) {
        SILC_SERVER_LOG_ERROR(("Error: Could not load private key file."));
        return SILC_CONFIG_EPRINTLINE;
       }
@@ -1202,11 +1202,11 @@ static const SilcConfigTable table_routerconn[] = {
 };
 
 static const SilcConfigTable table_main[] = {
-  { "general",         SILC_CONFIG_ARG_BLOCK,  NULL,          table_general },
   { "cipher",          SILC_CONFIG_ARG_BLOCK,  fetch_cipher,  table_cipher },
   { "hash",            SILC_CONFIG_ARG_BLOCK,  fetch_hash,    table_hash },
   { "hmac",            SILC_CONFIG_ARG_BLOCK,  fetch_hmac,    table_hmac },
   { "pkcs",            SILC_CONFIG_ARG_BLOCK,  fetch_pkcs,    table_pkcs },
+  { "general",         SILC_CONFIG_ARG_BLOCK,  NULL,          table_general },
   { "serverinfo",      SILC_CONFIG_ARG_BLOCK,  fetch_serverinfo, table_serverinfo },
   { "logging",         SILC_CONFIG_ARG_BLOCK,  NULL,          table_logging },
   { "connectionparams",        SILC_CONFIG_ARG_BLOCK,  fetch_connparam, table_connparam },
@@ -1250,11 +1250,11 @@ SilcServerConfig silc_server_config_alloc(const char *filename)
 
   /* alloc a config object */
   config_new = silc_calloc(1, sizeof(*config_new));
-  config_new->refcount = 1;
   if (!config_new)
     return NULL;
 
   /* general config defaults */
+  config_new->refcount = 1;
   config_new->logging_timestamp = TRUE;
 
   /* obtain a config file object */
@@ -1540,6 +1540,7 @@ bool silc_server_config_register_ciphers(SilcServer server)
        silc_free(alg_name);
       } else {
        SILC_LOG_ERROR(("Error configuring ciphers"));
+        silc_sim_free(sim);
        silc_server_stop(server);
        exit(1);
       }
@@ -1623,6 +1624,7 @@ bool silc_server_config_register_hashfuncs(SilcServer server)
        silc_dlist_add(server->sim, sim);
       } else {
        SILC_LOG_ERROR(("Error configuring hash functions"));
+        silc_sim_free(sim);
        silc_server_stop(server);
        exit(1);
       }