Fixed detaching bugs, channel key distribution after detach,
[silc.git] / apps / silcd / serverconfig.c
index deecf1aac5af95c5a3da35252eb732d4f615dab1..73a38bfde43bba4a89a656b8cd95d75622496d76 100644 (file)
@@ -92,6 +92,10 @@ my_set_param_defaults(SilcServerConfigConnParams *params,
   SET_PARAM_DEFAULT(reconnect_interval, SILC_SERVER_RETRY_INTERVAL_MIN);
   SET_PARAM_DEFAULT(reconnect_interval_max, SILC_SERVER_RETRY_INTERVAL_MAX);
   SET_PARAM_DEFAULT(key_exchange_rekey, SILC_SERVER_REKEY);
+  SET_PARAM_DEFAULT(qos_rate_limit, SILC_SERVER_QOS_RATE_LIMIT);
+  SET_PARAM_DEFAULT(qos_bytes_limit, SILC_SERVER_QOS_BYTES_LIMIT);
+  SET_PARAM_DEFAULT(qos_limit_sec, SILC_SERVER_QOS_LIMIT_SEC);
+  SET_PARAM_DEFAULT(qos_limit_usec, SILC_SERVER_QOS_LIMIT_USEC);
 
 #undef SET_PARAM_DEFAULT
 }
@@ -532,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;
       }
@@ -1198,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 },
@@ -1246,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 */
@@ -1536,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);
       }
@@ -1619,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);
       }