From 4a6784f710a5f947f0543bef9a607aa54ee57391 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Tue, 4 Sep 2001 19:34:23 +0000 Subject: [PATCH] updates. --- CHANGES | 6 +++ TODO | 3 ++ apps/irssi/docs/help/in/oper.in | 2 +- apps/irssi/docs/help/in/silcoper.in | 2 +- apps/irssi/src/silc/core/silc-channels.c | 10 ++++ apps/irssi/src/silc/core/silc-servers.c | 6 +-- lib/silcclient/command.c | 62 +++++++++--------------- 7 files changed, 46 insertions(+), 45 deletions(-) diff --git a/CHANGES b/CHANGES index 91c309f0..abccd029 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,9 @@ +Tue Sep 4 22:31:28 EEST 2001 Pekka Riikonen + + * Added public key authentication support to OPER and SILCOPER + commands in the client library. Affected file is + lib/silcclient/command.c. + Tue Sep 4 12:39:17 EEST 2001 Pekka Riikonen * Changed the get_auth_methdod client operation to be asynchronous. diff --git a/TODO b/TODO index 0aae8730..87e796ca 100644 --- a/TODO +++ b/TODO @@ -17,6 +17,9 @@ TODO/bugs in Irssi SILC client o The QUIT command should wait for servers disconnection (at least for a while) before exiting the application. + o The JOIN commands HELP is generated from Irssi IRCs JOIN help and + the syntax is not same in SILC. This must be fixed. + o Add PERL scripting support from Irssi CVS. o Extend the /HELP command to support sub commands or something. So diff --git a/apps/irssi/docs/help/in/oper.in b/apps/irssi/docs/help/in/oper.in index 2a171261..40dc9c54 100644 --- a/apps/irssi/docs/help/in/oper.in +++ b/apps/irssi/docs/help/in/oper.in @@ -3,7 +3,7 @@ Gives you server operator priviledges if the correct username and passphrase are given. User will be prompted -for the passphrase if the is not provided. +for the passphrase if the -pubkey option is not provided. See also: KILL, SCONNECT, CLOSE, SILCOPER diff --git a/apps/irssi/docs/help/in/silcoper.in b/apps/irssi/docs/help/in/silcoper.in index 8f0c5056..5247bf46 100644 --- a/apps/irssi/docs/help/in/silcoper.in +++ b/apps/irssi/docs/help/in/silcoper.in @@ -3,7 +3,7 @@ Gives you router operator priviledges if the correct username and passphrase are given. User will be prompted -for the passphrase if the is not provided. +for the passphrase if the -pubkey option is not provided. NOTE: This command works only on router server. It has no effect on normal SILC server. diff --git a/apps/irssi/src/silc/core/silc-channels.c b/apps/irssi/src/silc/core/silc-channels.c index d500e63b..2ee76c58 100644 --- a/apps/irssi/src/silc/core/silc-channels.c +++ b/apps/irssi/src/silc/core/silc-channels.c @@ -1176,6 +1176,14 @@ static void command_key(const char *data, SILC_SERVER_REC *server, silc_free(serv); } +/* Lists locally saved client and server public keys. */ + +static void command_listkeys(const char *data, SILC_SERVER_REC *server, + WI_ITEM_REC *item) +{ + +} + void silc_channels_init(void) { signal_add("channel destroyed", (SIGNAL_FUNC) sig_channel_destroyed); @@ -1202,6 +1210,7 @@ void silc_channels_init(void) command_bind("notice", MODULE_NAME, (SIGNAL_FUNC) command_notice); command_bind("away", MODULE_NAME, (SIGNAL_FUNC) command_away); command_bind("key", MODULE_NAME, (SIGNAL_FUNC) command_key); + command_bind("listkeys", MODULE_NAME, (SIGNAL_FUNC) command_listkeys); silc_nicklist_init(); } @@ -1234,6 +1243,7 @@ void silc_channels_deinit(void) command_unbind("notice", (SIGNAL_FUNC) command_notice); command_unbind("away", (SIGNAL_FUNC) command_away); command_unbind("key", (SIGNAL_FUNC) command_key); + command_unbind("listkeys", (SIGNAL_FUNC) command_listkeys); silc_nicklist_deinit(); } diff --git a/apps/irssi/src/silc/core/silc-servers.c b/apps/irssi/src/silc/core/silc-servers.c index 574979c7..a810b8ee 100644 --- a/apps/irssi/src/silc/core/silc-servers.c +++ b/apps/irssi/src/silc/core/silc-servers.c @@ -260,9 +260,9 @@ char *silc_server_get_channels(SILC_SERVER_REC *server) /* SYNTAX: KEY CHANNEL set|unset|list|agreement|negotiate [] */ /* SYNTAX: KICK [@] [] */ /* SYNTAX: KILL [@] [] */ -/* SYNTAX: OPER [] */ -/* SYNTAX: SILCOPER [] */ -/* SYNTAX: TOPIC [ */ +/* SYNTAX: OPER [-pubkey] */ +/* SYNTAX: SILCOPER [-pubkey] */ +/* SYNTAX: TOPIC [] */ /* SYNTAX: UMODE +|- */ /* SYNTAX: WHOIS [@] [] */ /* SYNTAX: WHOWAS [@] [] */ diff --git a/lib/silcclient/command.c b/lib/silcclient/command.c index c4cf398c..5379000a 100644 --- a/lib/silcclient/command.c +++ b/lib/silcclient/command.c @@ -1605,11 +1605,15 @@ static void silc_client_command_oper_send(unsigned char *data, SilcClientConnection conn = cmd->conn; SilcBuffer buffer, auth; - if (cmd->argc == 3) { - /* Pulic key auth XXX TODO */ - auth = NULL; + if (cmd->argc >= 3) { + /* Encode the public key authentication payload */ + auth = silc_auth_public_key_auth_generate(cmd->client->public_key, + cmd->client->private_key, + conn->hash, + conn->local_id, + SILC_ID_CLIENT); } else { - /* Encode the authentication payload */ + /* Encode the password authentication payload */ auth = silc_auth_payload_encode(SILC_AUTH_PASSWORD, NULL, 0, data, data_len); } @@ -1634,8 +1638,6 @@ SILC_CLIENT_CMD_FUNC(oper) { SilcClientCommandContext cmd = (SilcClientCommandContext)context; SilcClientConnection conn = cmd->conn; - unsigned char *auth_data; - uint32 auth_data_len = 0; if (!cmd->conn) { SILC_NOT_CONNECTED(cmd->client, cmd->conn); @@ -1645,17 +1647,12 @@ SILC_CLIENT_CMD_FUNC(oper) if (cmd->argc < 2) { cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, - "Usage: /OPER []"); + "Usage: /OPER [-pubkey]"); COMMAND_ERROR; goto out; } - if (cmd->argc == 3) { - /* XXX Get public key */ - auth_data = NULL; - COMMAND_ERROR; - goto out; - } else { + if (cmd->argc < 3) { /* Get passphrase */ cmd->client->ops->ask_passphrase(cmd->client, conn, silc_client_command_oper_send, @@ -1663,13 +1660,7 @@ SILC_CLIENT_CMD_FUNC(oper) return; } - silc_client_command_oper_send(auth_data, auth_data_len, context); - - memset(auth_data, 0, auth_data_len); - silc_free(auth_data); - - /* Notify application */ - COMMAND; + silc_client_command_oper_send(NULL, 0, context); out: silc_client_command_free(cmd); @@ -1682,11 +1673,15 @@ static void silc_client_command_silcoper_send(unsigned char *data, SilcClientConnection conn = cmd->conn; SilcBuffer buffer, auth; - if (cmd->argc == 3) { - /* Pulic key auth XXX TODO */ - auth = NULL; + if (cmd->argc >= 3) { + /* Encode the public key authentication payload */ + auth = silc_auth_public_key_auth_generate(cmd->client->public_key, + cmd->client->private_key, + conn->hash, + conn->local_id, + SILC_ID_CLIENT); } else { - /* Encode the authentication payload */ + /* Encode the password authentication payload */ auth = silc_auth_payload_encode(SILC_AUTH_PASSWORD, NULL, 0, data, data_len); } @@ -1711,8 +1706,6 @@ SILC_CLIENT_CMD_FUNC(silcoper) { SilcClientCommandContext cmd = (SilcClientCommandContext)context; SilcClientConnection conn = cmd->conn; - unsigned char *auth_data; - uint32 auth_data_len = 0; if (!cmd->conn) { SILC_NOT_CONNECTED(cmd->client, cmd->conn); @@ -1722,17 +1715,12 @@ SILC_CLIENT_CMD_FUNC(silcoper) if (cmd->argc < 2) { cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, - "Usage: /SILCOPER []"); + "Usage: /SILCOPER [-pubkey]"); COMMAND_ERROR; goto out; } - if (cmd->argc == 3) { - /* XXX Get public key */ - auth_data = NULL; - COMMAND_ERROR; - goto out; - } else { + if (cmd->argc < 3) { /* Get passphrase */ cmd->client->ops->ask_passphrase(cmd->client, conn, silc_client_command_silcoper_send, @@ -1740,13 +1728,7 @@ SILC_CLIENT_CMD_FUNC(silcoper) return; } - silc_client_command_silcoper_send(auth_data, auth_data_len, context); - - memset(auth_data, 0, auth_data_len); - silc_free(auth_data); - - /* Notify application */ - COMMAND; + silc_client_command_silcoper_send(NULL, 0, context); out: silc_client_command_free(cmd); -- 2.24.0