/* p is a plain text password */
if (auth_data && auth_data_len) {
if (!silc_utf8_valid(p, strlen(p))) {
- *auth_data_len = silc_utf8_encoded_len(p, strlen(p), 0);
+ *auth_data_len = silc_utf8_encoded_len(p, strlen(p),
+ SILC_STRING_LANGUAGE);
*auth_data = silc_calloc(*auth_data_len, sizeof(unsigned char));
- silc_utf8_encode(p, strlen(p), SILC_STRING_ASCII, *auth_data,
+ silc_utf8_encode(p, strlen(p), SILC_STRING_LANGUAGE, *auth_data,
*auth_data_len);
} else {
*auth_data = (void *) strdup(p);
{
SILC_SERVER_CONFIG_SECTION_INIT(SilcServerConfigLogging);
- if (!strcmp(name, "quicklogs")) {
+ if (!strcmp(name, "timestamp")) {
+ config->logging_timestamp = *(bool *)val;
+ }
+ else if (!strcmp(name, "quicklogs")) {
config->logging_quick = *(bool *)val;
}
else if (!strcmp(name, "flushdelay")) {
};
static const SilcConfigTable table_logging[] = {
+ { "timestamp", SILC_CONFIG_ARG_TOGGLE, fetch_logging, NULL },
{ "quicklogs", SILC_CONFIG_ARG_TOGGLE, fetch_logging, NULL },
{ "flushdelay", SILC_CONFIG_ARG_INT, fetch_logging, NULL },
{ "info", SILC_CONFIG_ARG_BLOCK, fetch_logging, table_logging_c },
if (!config_new)
return NULL;
+ /* general config defaults */
+ config_new->logging_timestamp = TRUE;
+
/* obtain a config file object */
file = silc_config_open(filename);
if (!file) {
silc_free(config->logging_errors);
silc_free(config->logging_fatals);
- silc_log_set_file(SILC_LOG_INFO, NULL, 0, NULL);
- silc_log_set_file(SILC_LOG_WARNING, NULL, 0, NULL);
- silc_log_set_file(SILC_LOG_ERROR, NULL, 0, NULL);
- silc_log_set_file(SILC_LOG_FATAL, NULL, 0, NULL);
-
/* Destroy the ServerInfo struct */
if (config->server_info) {
register SilcServerConfigServerInfo *si = config->server_info;
SILC_LOG_DEBUG(("Setting configured log file names and options"));
+ silc_log_timestamp = config->logging_timestamp;
silc_log_quick = config->logging_quick;
silc_log_flushdelay = (config->logging_flushdelay ?
config->logging_flushdelay :
return serv;
}
+/* Find backup router connection by host (name or ip) */
+
+SilcServerConfigRouter *
+silc_server_config_find_backup_conn(SilcServer server, char *host)
+{
+ SilcServerConfig config = server->config;
+ SilcServerConfigRouter *serv = NULL;
+
+ if (!host)
+ return NULL;
+
+ if (!config->routers)
+ return NULL;
+
+ for (serv = config->routers; serv; serv = serv->next) {
+ if (!serv->backup_router)
+ continue;
+ if (!silc_string_compare(serv->host, host))
+ continue;
+ break;
+ }
+
+ return serv;
+}
+
/* Returns TRUE if configuration for a router connection that we are
initiating exists. */
return NULL;
}
+
+/* If we have backup router configured that is going to replace us this
+ function returns it. */
+
+SilcServerConfigRouter *
+silc_server_config_get_backup_router(SilcServer server)
+{
+ SilcServerConfig config = server->config;
+ SilcServerConfigRouter *serv = NULL;
+ int i;
+
+ if (server->server_type != SILC_ROUTER)
+ return NULL;
+
+ serv = config->routers;
+ for (i = 0; serv; i++) {
+ if (serv->initiator == FALSE && serv->backup_router == TRUE &&
+ serv->backup_local == TRUE &&
+ !strcmp(server->config->server_info->primary->server_ip,
+ serv->backup_replace_ip) &&
+ server->config->server_info->primary->port ==
+ serv->backup_replace_port)
+ return serv;
+ serv = serv->next;
+ }
+
+ return NULL;
+}