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"
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 */
/* 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) {
/* 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;
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"));
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);
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"));
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"));
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);