if (opt_create_keypair == TRUE) {
/* Create new key pair and exit */
+ silc_cipher_register_default();
+ silc_pkcs_register_default();
+ silc_hash_register_default();
+ silc_hmac_register_default();
silc_client_create_key_pair(opt_pkcs, opt_bits,
NULL, NULL, NULL, NULL, NULL);
silc_free(opt_pkcs);
if (opt_show_key == TRUE) {
/* Dump the key */
+ silc_cipher_register_default();
+ silc_pkcs_register_default();
+ silc_hash_register_default();
+ silc_hmac_register_default();
silc_client_show_key(opt_keyfile);
silc_free(opt_keyfile);
exit(0);
app = silc_calloc(1, sizeof(*app));
/* Allocate new client */
- app->client = silc = silc_client_alloc(&ops, app);
+ app->client = silc = silc_client_alloc(&ops, app, silc_version_string);
if (!silc)
goto fail;
/* Read global configuration file. */
app->config = silc_client_config_alloc(opt_config_file);
- if (app->config == NULL)
- goto fail;
/* XXX Read local configuration file */
- /* Check ~/.silc directory and public and private keys */
- if (silc_client_check_silc_dir() == FALSE)
- goto fail;
-
/* Get user information */
silc->username = silc_get_username();
silc->hostname = silc_net_localhost();
silc->realname = silc_get_real_name();
/* Register all configured ciphers, PKCS and hash functions. */
- app->config->client = (void *)app;
- silc_client_config_register_ciphers(app->config);
- silc_client_config_register_pkcs(app->config);
- silc_client_config_register_hashfuncs(app->config);
- silc_client_config_register_hmacs(app->config);
+ if (app->config) {
+ app->config->client = (void *)app;
+ if (!silc_client_config_register_ciphers(app->config))
+ silc_cipher_register_default();
+ if (!silc_client_config_register_pkcs(app->config))
+ silc_pkcs_register_default();
+ if (!silc_client_config_register_hashfuncs(app->config))
+ silc_hash_register_default();
+ if (!silc_client_config_register_hmacs(app->config))
+ silc_hmac_register_default();
+ } else {
+ /* Register default ciphers, pkcs, hash funtions and hmacs. */
+ silc_cipher_register_default();
+ silc_pkcs_register_default();
+ silc_hash_register_default();
+ silc_hmac_register_default();
+ }
+
+ /* Check ~/.silc directory and public and private keys */
+ if (silc_client_check_silc_dir() == FALSE)
+ goto fail;
/* Load public and private key */
if (silc_client_load_keys(silc) == FALSE)
SILC_TASK_TIMEOUT,
SILC_TASK_PRI_LOW);
- if (app->config->commands) {
+ if (app->config && app->config->commands) {
/* Run user configured commands with timeout */
silc_task_register(silc->timeout_queue, 0,
silc_client_run_commands,
static void silc_client_process_message(SilcClientInternal app)
{
unsigned char *data;
- uint32 len;
+ SilcUInt32 len;
SILC_LOG_DEBUG(("Start"));
if (data[0] == '/' && data[1] != ' ') {
/* Command */
- uint32 argc = 0;
+ SilcUInt32 argc = 0;
unsigned char **argv, *tmpcmd;
- uint32 *argv_lens, *argv_types;
+ SilcUInt32 *argv_lens, *argv_types;
SilcClientCommand *cmd;
SilcClientCommandContext ctx;
(*cmd->cb)(ctx);
} else {
- if (app->conn->current_channel)
- silc_client_send_channel_message(app->client,
- app->conn,
- app->conn->current_channel, NULL,
- 0, "HALOO", 5, TRUE);
-
-#if 0
/* Normal message to a channel */
if (len && app->conn && app->conn->current_channel &&
app->conn->current_channel->on_channel == TRUE) {
app->conn->current_channel, NULL,
0, data, strlen(data), TRUE);
}
-#endif
}
out:
cs = app->config->commands;
while(cs) {
- uint32 argc = 0;
+ SilcUInt32 argc = 0;
unsigned char **argv, *tmpcmd;
- uint32 *argv_lens, *argv_types;
+ SilcUInt32 *argv_lens, *argv_types;
SilcClientCommand *cmd;
SilcClientCommandContext ctx;