updates.
authorPekka Riikonen <priikone@silcnet.org>
Tue, 4 Sep 2001 19:34:23 +0000 (19:34 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Tue, 4 Sep 2001 19:34:23 +0000 (19:34 +0000)
CHANGES
TODO
apps/irssi/docs/help/in/oper.in
apps/irssi/docs/help/in/silcoper.in
apps/irssi/src/silc/core/silc-channels.c
apps/irssi/src/silc/core/silc-servers.c
lib/silcclient/command.c

diff --git a/CHANGES b/CHANGES
index 91c309f0f50deb3bb5586aa140274a3a0518184e..abccd029b66cf4dd6c508db36f13fe2add4ec738 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,9 @@
+Tue Sep  4 22:31:28 EEST 2001  Pekka Riikonen <priikone@silcnet.org>
+
+       * 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 <priikone@silcnet.org>
 
        * Changed the get_auth_methdod client operation to be asynchronous.
 Tue Sep  4 12:39:17 EEST 2001  Pekka Riikonen <priikone@silcnet.org>
 
        * Changed the get_auth_methdod client operation to be asynchronous.
diff --git a/TODO b/TODO
index 0aae873017278ccf00bb6d92000b73f6abf2a5ee..87e796ca62880b7d543175c7cfdd8c24c9d9d551 100644 (file)
--- 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 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
  o Add PERL scripting support from Irssi CVS.
 
  o Extend the /HELP command to support sub commands or something.  So
index 2a171261a65925b5623804a1b526ebd02515ef41..40dc9c54d3a88d0caf93ac84463f0afb5f1af9f4 100644 (file)
@@ -3,7 +3,7 @@
 
 Gives you server operator priviledges if the correct
 username and passphrase are given. User will be prompted
 
 Gives you server operator priviledges if the correct
 username and passphrase are given. User will be prompted
-for the passphrase if the <public key> is not provided.
+for the passphrase if the -pubkey option is not provided.
 
 See also: KILL, SCONNECT, CLOSE, SILCOPER
 
 
 See also: KILL, SCONNECT, CLOSE, SILCOPER
 
index 8f0c5056f8c5ec11851edd5c5d838a9e029c62b5..5247bf46c5bfd2758ea508695c09c59ba10b2ce5 100644 (file)
@@ -3,7 +3,7 @@
 
 Gives you router operator priviledges if the correct
 username and passphrase are given. User will be prompted
 
 Gives you router operator priviledges if the correct
 username and passphrase are given. User will be prompted
-for the passphrase if the <public key> 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.
 
 NOTE: This command works only on router server. It has
 no effect on normal SILC server.
index d500e63bc0c58a36481d928da25ae985e25f46bd..2ee76c58e99ad308f936805e31052e5f0708e74f 100644 (file)
@@ -1176,6 +1176,14 @@ static void command_key(const char *data, SILC_SERVER_REC *server,
     silc_free(serv);
 }
 
     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);
 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("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();
 }
 
   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("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();
 }
 
   silc_nicklist_deinit();
 }
index 574979c76658cf8065ac39ae42d1567e134e1baf..a810b8eed7bc4475c31e2e76fd73c169ef271045 100644 (file)
@@ -260,9 +260,9 @@ char *silc_server_get_channels(SILC_SERVER_REC *server)
 /* SYNTAX: KEY CHANNEL <channel> set|unset|list|agreement|negotiate [<arguments>] */
 /* SYNTAX: KICK <channel> <nickname>[@<server>] [<comment>] */
 /* SYNTAX: KILL <channel> <nickname>[@<server>] [<comment>] */
 /* SYNTAX: KEY CHANNEL <channel> set|unset|list|agreement|negotiate [<arguments>] */
 /* SYNTAX: KICK <channel> <nickname>[@<server>] [<comment>] */
 /* SYNTAX: KILL <channel> <nickname>[@<server>] [<comment>] */
-/* SYNTAX: OPER <username> [<public key>] */
-/* SYNTAX: SILCOPER <username> [<public key>] */
-/* SYNTAX: TOPIC <channel> [<topic> */
+/* SYNTAX: OPER <username> [-pubkey] */
+/* SYNTAX: SILCOPER <username> [-pubkey] */
+/* SYNTAX: TOPIC <channel> [<topic>] */
 /* SYNTAX: UMODE +|-<modes> */
 /* SYNTAX: WHOIS <nickname>[@<server>] [<count>] */
 /* SYNTAX: WHOWAS <nickname>[@<server>] [<count>] */
 /* SYNTAX: UMODE +|-<modes> */
 /* SYNTAX: WHOIS <nickname>[@<server>] [<count>] */
 /* SYNTAX: WHOWAS <nickname>[@<server>] [<count>] */
index c4cf398c43a62036263786f62acc564a4c596498..5379000a24473ba256a5e1d37f0f2fb0953fcb66 100644 (file)
@@ -1605,11 +1605,15 @@ static void silc_client_command_oper_send(unsigned char *data,
   SilcClientConnection conn = cmd->conn;
   SilcBuffer buffer, auth;
 
   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 {
   } else {
-    /* Encode the authentication payload */
+    /* Encode the password authentication payload */
     auth = silc_auth_payload_encode(SILC_AUTH_PASSWORD, NULL, 0,
                                    data, data_len);
   }
     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;
 {
   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);
 
   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, 
 
   if (cmd->argc < 2) {
     cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                         "Usage: /OPER <username> [<public key>]");
+                         "Usage: /OPER <username> [-pubkey]");
     COMMAND_ERROR;
     goto out;
   }
 
     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,
     /* 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;
   }
 
     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);
 
  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;
 
   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 {
   } else {
-    /* Encode the authentication payload */
+    /* Encode the password authentication payload */
     auth = silc_auth_payload_encode(SILC_AUTH_PASSWORD, NULL, 0,
                                    data, data_len);
   }
     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;
 {
   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);
 
   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, 
 
   if (cmd->argc < 2) {
     cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                         "Usage: /SILCOPER <username> [<public key>]");
+                         "Usage: /SILCOPER <username> [-pubkey]");
     COMMAND_ERROR;
     goto out;
   }
 
     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,
     /* 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;
   }
 
     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);
 
  out:
   silc_client_command_free(cmd);