X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=blobdiff_plain;f=apps%2Fsilc%2Fclientconfig.c;h=b6f5b150a832b58c814b063752ea0ff355e1660a;hp=e55157b30fdee38ec48eb3c322a87f1b2314e70a;hb=318d79b391bf6288e3e28c840217a7097f3d0392;hpb=0f9738ce962b8498bbed0a75d5fb6fa127e3577f diff --git a/apps/silc/clientconfig.c b/apps/silc/clientconfig.c index e55157b3..b6f5b150 100644 --- a/apps/silc/clientconfig.c +++ b/apps/silc/clientconfig.c @@ -17,14 +17,7 @@ GNU General Public License for more details. */ -/* - * $Id$ - * $Log$ - * Revision 1.1.1.1 2000/06/27 11:36:56 priikone - * Importet from internal CVS/Added Log headers. - * - * - */ +/* $Id$ */ #include "clientincludes.h" #include "clientconfig.h" @@ -60,11 +53,6 @@ SilcClientConfig silc_client_config_alloc(char *filename) SILC_LOG_DEBUG(("Allocating new configuration object")); new = silc_calloc(1, sizeof(*new)); - if (!new) { - fprintf(stderr, "Could not allocate new configuration object"); - return NULL; - } - new->filename = filename; /* Open configuration file and parse it */ @@ -155,7 +143,7 @@ int silc_client_config_parse(SilcClientConfig config, SilcBuffer buffer, /* Check for matching sections */ for (cptr = silc_client_config_sections; cptr->section; cptr++) - if (!strcmp(cp, cptr->section)) + if (!strncasecmp(cp, cptr->section, strlen(cptr->section))) break; if (!cptr->section) { @@ -490,7 +478,9 @@ int silc_client_config_parse_lines(SilcClientConfig config, /* Get command line (this may include parameters as well. They will be parsed later with standard command parser when executing particular command.) */ - config->commands->command = strdup(line->data); + config->commands->command = silc_calloc(strlen(line->data), + sizeof(char)); + memcpy(config->commands->command, line->data, strlen(line->data) - 1); if (ret < 0) break; @@ -539,7 +529,8 @@ int silc_client_config_parse_lines(SilcClientConfig config, void silc_client_config_register_ciphers(SilcClientConfig config) { SilcClientConfigSectionAlg *alg; - SilcClient client = (SilcClient)config->client; + SilcClientInternal app = (SilcClientInternal)config->client; + SilcClient client = app->client; SILC_LOG_DEBUG(("Registering configured ciphers")); @@ -596,11 +587,11 @@ void silc_client_config_register_ciphers(SilcClientConfig config) SILC_LOG_DEBUG(("context_len=%p", cipher.context_len)); /* Put the SIM to the table of all SIM's in client */ - client->sim = silc_realloc(client->sim, - sizeof(*client->sim) * - (client->sim_count + 1)); - client->sim[client->sim_count] = sim; - client->sim_count++; + app->sim = silc_realloc(app->sim, + sizeof(*app->sim) * + (app->sim_count + 1)); + app->sim[app->sim_count] = sim; + app->sim_count++; } else { SILC_LOG_ERROR(("Error configuring ciphers")); silc_client_stop(client); @@ -625,7 +616,8 @@ void silc_client_config_register_ciphers(SilcClientConfig config) void silc_client_config_register_pkcs(SilcClientConfig config) { SilcClientConfigSectionAlg *alg = config->pkcs; - SilcClient client = (SilcClient)config->client; + SilcClientInternal app = (SilcClientInternal)config->client; + SilcClient client = app->client; SilcPKCS tmp = NULL; SILC_LOG_DEBUG(("Registering configured PKCS")); @@ -649,7 +641,8 @@ void silc_client_config_register_pkcs(SilcClientConfig config) void silc_client_config_register_hashfuncs(SilcClientConfig config) { SilcClientConfigSectionAlg *alg; - SilcClient client = (SilcClient)config->client; + SilcClientInternal app = (SilcClientInternal)config->client; + SilcClient client = app->client; SILC_LOG_DEBUG(("Registering configured hash functions")); @@ -702,11 +695,11 @@ void silc_client_config_register_hashfuncs(SilcClientConfig config) SILC_LOG_DEBUG(("context_len=%p", hash.context_len)); /* Put the SIM to the table of all SIM's in client */ - client->sim = silc_realloc(client->sim, - sizeof(*client->sim) * - (client->sim_count + 1)); - client->sim[client->sim_count] = sim; - client->sim_count++; + app->sim = silc_realloc(app->sim, + sizeof(*app->sim) * + (app->sim_count + 1)); + app->sim[app->sim_count] = sim; + app->sim_count++; } else { SILC_LOG_ERROR(("Error configuring hash functions")); silc_client_stop(client);