SilcPublicKey public_key;
SilcSKR skr = *auth_data;
SilcSKRFind find;
- SilcSKRStatus status;
+ SilcSKRStatus status = SILC_SKR_NOT_FOUND;
if (!silc_pkcs_load_public_key(p, &public_key)) {
SILC_SERVER_LOG_ERROR(("Error while parsing config file: "
find = silc_skr_find_alloc();
silc_skr_find_set_public_key(find, public_key);
silc_skr_find_set_usage(find, usage);
- silc_skr_find_set_context(find, key_context ? key_context : (void *)usage);
+ if (!key_context)
+ silc_skr_find_set_context(find, SILC_32_TO_PTR(usage));
silc_skr_find(skr, NULL, find, my_find_callback, &status);
- if (status != SILC_SKR_OK) {
+ if (status == SILC_SKR_OK) {
+ /* Already added, ignore error */
silc_pkcs_public_key_free(public_key);
- SILC_SERVER_LOG_WARNING(("Warning: public key file \"%s\" already "
- "configured, ignoring this key", p));
- return TRUE; /* non fatal error */
+ return TRUE;
}
/* Add the public key to repository */
- if (silc_skr_add_public_key(skr, public_key, usage,
- key_context ? key_context : (void *)usage) !=
- SILC_SKR_OK) {
+ status = silc_skr_add_public_key(skr, public_key, usage,
+ key_context ? key_context :
+ (void *)usage, NULL);
+ if (status != SILC_SKR_OK) {
SILC_SERVER_LOG_ERROR(("Error while adding public key \"%s\"", p));
return FALSE;
}
CONFIG_IS_DOUBLE(config->debug_string);
config->debug_string = (*(char *)val ? strdup((char *) val) : NULL);
}
+ else if (!strcmp(name, "http_server")) {
+ config->httpd = *(SilcBool *)val;
+ }
+ else if (!strcmp(name, "http_server_ip")) {
+ CONFIG_IS_DOUBLE(config->httpd_ip);
+ config->httpd_ip = (*(char *)val ? strdup((char *) val) : NULL);
+ }
+ else if (!strcmp(name, "http_server_port")) {
+ int port = *(int *)val;
+ if ((port <= 0) || (port > 65535)) {
+ SILC_SERVER_LOG_ERROR(("Error while parsing config file: "
+ "Invalid port number!"));
+ got_errno = SILC_CONFIG_EPRINTLINE;
+ goto got_err;
+ }
+ config->httpd_port = (SilcUInt16)port;
+ }
+ else if (!strcmp(name, "dynamic_server")) {
+ config->dynamic_server = *(SilcBool *)val;
+ }
+ else if (!strcmp(name, "local_channels")) {
+ config->local_channels = *(SilcBool *)val;
+ }
else
return SILC_CONFIG_EINTERNAL;
CONFIG_IS_DOUBLE(tmp->server_ip);
tmp->server_ip = strdup((char *) val);
}
+ else if (!strcmp(name, "public_ip")) {
+ SILC_SERVER_CONFIG_ALLOCTMP(SilcServerConfigServerInfoInterface);
+ CONFIG_IS_DOUBLE(tmp->public_ip);
+ tmp->public_ip = strdup((char *) val);
+ }
else if (!strcmp(name, "port")) {
int port = *(int *)val;
SILC_SERVER_CONFIG_ALLOCTMP(SilcServerConfigServerInfoInterface);
else if (!strcmp(name, "backuplocal")) {
tmp->backup_local = *(SilcBool *)val;
}
+ else if (!strcmp(name, "dynamic_connection")) {
+ tmp->dynamic_connection = *(SilcBool *)val;
+ }
else
return SILC_CONFIG_EINTERNAL;
{ "qos_limit_usec", SILC_CONFIG_ARG_INT, fetch_generic, NULL },
{ "channel_join_limit", SILC_CONFIG_ARG_INT, fetch_generic, NULL },
{ "debug_string", SILC_CONFIG_ARG_STR, fetch_generic, NULL },
+ { "http_server", SILC_CONFIG_ARG_TOGGLE, fetch_generic, NULL },
+ { "http_server_ip", SILC_CONFIG_ARG_STRE, fetch_generic, NULL },
+ { "http_server_port", SILC_CONFIG_ARG_INT, fetch_generic, NULL },
+ { "dynamic_server", SILC_CONFIG_ARG_TOGGLE, fetch_generic, NULL },
+ { "local_channels", SILC_CONFIG_ARG_TOGGLE, fetch_generic, NULL },
{ 0, 0, 0, 0 }
};
static const SilcConfigTable table_serverinfo_c[] = {
{ "ip", SILC_CONFIG_ARG_STR, fetch_serverinfo, NULL},
+ { "public_ip", SILC_CONFIG_ARG_STR, fetch_serverinfo, NULL},
{ "port", SILC_CONFIG_ARG_INT, fetch_serverinfo, NULL},
{ 0, 0, 0, 0 }
};
{ "backuphost", SILC_CONFIG_ARG_STRE, fetch_router, NULL },
{ "backupport", SILC_CONFIG_ARG_INT, fetch_router, NULL },
{ "backuplocal", SILC_CONFIG_ARG_TOGGLE, fetch_router, NULL },
+ { "dynamic_connection", SILC_CONFIG_ARG_TOGGLE, fetch_router, NULL },
{ 0, 0, 0, 0 }
};
ret = FALSE;
}
+ if (!config->server_info->public_key ||
+ !config->server_info->private_key) {
+ SILC_SERVER_LOG_ERROR(("\nError: Server keypair is missing"));
+ ret = FALSE;
+ }
+
+ if (!config->server_info->primary) {
+ SILC_SERVER_LOG_ERROR(("\nError: Missing mandatory block `Primary' "
+ "in `ServerInfo'"));
+ ret = FALSE;
+ }
+
+ if (!config->server_info->primary->server_ip) {
+ SILC_SERVER_LOG_ERROR(("\nError: Missing mandatory field `Ip' "
+ "in `Primary' in `ServerInfo'"));
+ ret = FALSE;
+ }
+
/* RouterConnection sanity checks */
if (config->routers && config->routers->backup_router == TRUE &&
"connection. You have marked it incorrectly as backup router."));
ret = FALSE;
}
-#if 0
- if (config->routers && config->routers->initiator == FALSE &&
- config->routers->backup_router == FALSE) {
- SILC_SERVER_LOG_ERROR((
- "\nError: First RouterConnection block must be primary router "
- "connection and it must be marked as Initiator."));
- ret = FALSE;
- }
-#endif
if (config->routers && config->routers->backup_router == TRUE &&
!config->servers && !config->routers->next) {
SILC_SERVER_LOG_ERROR((
silc_free(config->param.version_protocol);
silc_free(config->param.version_software);
silc_free(config->param.version_software_vendor);
+ silc_free(config->httpd_ip);
/* Destroy Logging channels */
if (config->logging_info)
silc_free(si->group);
silc_free(si->motd_file);
silc_free(si->pid_file);
- silc_pkcs_public_key_free(si->public_key);
- silc_pkcs_private_key_free(si->private_key);
+ if (si->public_key)
+ silc_pkcs_public_key_free(si->public_key);
+ if (si->private_key)
+ silc_pkcs_private_key_free(si->private_key);
silc_free(si);
}
SilcBool silc_server_config_register_pkcs(SilcServer server)
{
- return TRUE;
+ return FALSE;
}
/* Sets log files where log messages are saved by the server logger. */