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_ALREADY_EXIST) {
+ 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,
- NULL) != 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;
}
SilcServerConfig config = (SilcServerConfig) context;
int got_errno = 0;
- if (!strcmp(name, "module_path")) {
- CONFIG_IS_DOUBLE(config->module_path);
- config->module_path = (*(char *)val ? strdup((char *) val) : NULL);
- }
- else if (!strcmp(name, "prefer_passphrase_auth")) {
+ if (!strcmp(name, "prefer_passphrase_auth")) {
config->prefer_passphrase_auth = *(SilcBool *)val;
}
else if (!strcmp(name, "require_reverse_lookup")) {
CONFIG_IS_DOUBLE(tmp->name);
tmp->name = strdup((char *) val);
}
- else if (!strcmp(name, "module")) {
- CONFIG_IS_DOUBLE(tmp->module);
- tmp->module = (*(char *)val ? strdup((char *) val) : NULL);
- }
else if (!strcmp(name, "keylength")) {
tmp->key_length = *(SilcUInt32 *)val;
}
got_err:
silc_free(tmp->name);
- silc_free(tmp->module);
silc_free(tmp);
config->tmp = NULL;
return got_errno;
CONFIG_IS_DOUBLE(tmp->name);
tmp->name = strdup((char *) val);
}
- else if (!strcmp(name, "module")) {
- CONFIG_IS_DOUBLE(tmp->module);
- tmp->module = (*(char *)val ? strdup((char *) val) : NULL);
- }
else if (!strcmp(name, "blocklength")) {
tmp->block_length = *(int *)val;
}
got_err:
silc_free(tmp->name);
- silc_free(tmp->module);
silc_free(tmp);
config->tmp = NULL;
return got_errno;
/* known config options tables */
static const SilcConfigTable table_general[] = {
- { "module_path", SILC_CONFIG_ARG_STRE, fetch_generic, NULL },
{ "prefer_passphrase_auth", SILC_CONFIG_ARG_TOGGLE, fetch_generic, NULL },
{ "require_reverse_lookup", SILC_CONFIG_ARG_TOGGLE, fetch_generic, NULL },
{ "connections_max", SILC_CONFIG_ARG_INT, fetch_generic, NULL },
static const SilcConfigTable table_cipher[] = {
{ "name", SILC_CONFIG_ARG_STR, fetch_cipher, NULL },
- { "module", SILC_CONFIG_ARG_STRE, fetch_cipher, NULL },
{ "keylength", SILC_CONFIG_ARG_INT, fetch_cipher, NULL },
{ "blocklength", SILC_CONFIG_ARG_INT, fetch_cipher, NULL },
{ 0, 0, 0, 0 }
static const SilcConfigTable table_hash[] = {
{ "name", SILC_CONFIG_ARG_STR, fetch_hash, NULL },
- { "module", SILC_CONFIG_ARG_STRE, fetch_hash, NULL },
{ "blocklength", SILC_CONFIG_ARG_INT, fetch_hash, NULL },
{ "digestlength", SILC_CONFIG_ARG_INT, fetch_hash, 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_LOG_DEBUG(("Freeing config context"));
/* Destroy general config stuff */
- silc_free(config->module_path);
silc_free(config->debug_string);
silc_free(config->param.version_protocol);
silc_free(config->param.version_software);
SILC_SERVER_CONFIG_LIST_DESTROY(SilcServerConfigCipher,
config->cipher)
silc_free(di->name);
- silc_free(di->module);
silc_free(di);
}
SILC_SERVER_CONFIG_LIST_DESTROY(SilcServerConfigHash, config->hash)
silc_free(di->name);
- silc_free(di->module);
silc_free(di);
}
SILC_SERVER_CONFIG_LIST_DESTROY(SilcServerConfigHmac, config->hmac)