updates.
authorPekka Riikonen <priikone@silcnet.org>
Sun, 4 Nov 2001 15:38:45 +0000 (15:38 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Sun, 4 Nov 2001 15:38:45 +0000 (15:38 +0000)
CHANGES
apps/irssi/config
apps/irssi/docs/help/in/key.in
apps/irssi/src/silc/core/silc-channels.c
apps/irssi/src/silc/core/silc-core.c
lib/silcclient/client_keyagr.c
lib/silcclient/silcapi.h

diff --git a/CHANGES b/CHANGES
index a64489209a4c9589c2ab1c7baa1f6941c7482a7f..d350218dc7a68fa58033fa32b5991bd2b158078d 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -15,6 +15,23 @@ Sat Nov  3 23:48:23 EET 2001  Pekka Riikonen <priikone@silcnet.org>
        * Find correct make to use in prepare-clean.  A patch by
          toma.  Affected file prepare-clean.
 
        * Find correct make to use in prepare-clean.  A patch by
          toma.  Affected file prepare-clean.
 
+Sat Nov  3 22:04:00 PST 2001  Brian Costello <bc@mksecure.com>
+
+       * Added irssi variables use_auto_addr, auto_bind_ip,
+          auto_bind_port and auto_public_ip.
+
+       * Changed the interface for silc_client_send_key_agreement
+          in lib/silcclient/silcapi.h
+
+       Affected files:
+
+         irssi/src/silc/core/silc-core.c
+         irssi/config
+         lib/silcclient/silcapi.h
+         irssi/src/silc/core/silc-channels.c
+         lib/silcclient/client_keyagr.c
+         irssi/docs/help/key
+
 Sat Nov  3 17:48:55 EET 2001  Pekka Riikonen <priikone@silcnet.org>
 
        * Added silc_pkcs_public_key_compare to compare two 
 Sat Nov  3 17:48:55 EET 2001  Pekka Riikonen <priikone@silcnet.org>
 
        * Added silc_pkcs_public_key_compare to compare two 
index 40e10e67bf676d15d9b71da713352ad9ac356828..b930de3d68f06b15c8ce49d3869271d01fe144e6 100644 (file)
@@ -57,6 +57,7 @@ settings = {
     use_msgs_window = "no";
     autocreate_windows = "no";
     autocreate_query_level = "none";
     use_msgs_window = "no";
     autocreate_windows = "no";
     autocreate_query_level = "none";
+    use_auto_addr = "no";
   };
   "fe-text" = { topicbar = "no"; mail_counter = "yes"; indent = "8"; };
 };
   };
   "fe-text" = { topicbar = "no"; mail_counter = "yes"; indent = "8"; };
 };
index b2ff1838e5c2f2cd433e78b72479b1cdcbadbc87..b4874c91afad2dda41d986d81ced48beef4b3d5f 100644 (file)
@@ -72,6 +72,17 @@ Commands:
       you can reply to the sender with the hostname and
       port of your key agreement server with this command.
 
       you can reply to the sender with the hostname and
       port of your key agreement server with this command.
 
+      If the hostname and port are ommitted, the irssi
+      boolean variable use_auto_addr will be examined.  If
+      this variable is set, the value of auto_bind_ip will
+      be used as the IP address to listen for the return
+      reply, the value of auto_public_ip will be the IP
+      address sent to the remote client, and auto_bind_port
+      will be the port value to be bound to AND sent to
+      the remote client.  If auto_public_ip is unset, but
+      auto_bind_ip IS, irssi will send the auto_bind_ip
+      variable's value to the remote client.
+
     negotiate  [<hostname> [<port>]]
 
       This may be called to start the key agreement with
     negotiate  [<hostname> [<port>]]
 
       This may be called to start the key agreement with
index 499b0cfe0cd157964786328b3f99bb956aefcc25..c02d61d2fc4e9724538a831d38b83fd3221db2ad 100644 (file)
@@ -861,6 +861,7 @@ static void command_key(const char *data, SILC_SERVER_REC *server,
   uint32 argc = 0;
   unsigned char **argv;
   uint32 *argv_lens, *argv_types;
   uint32 argc = 0;
   unsigned char **argv;
   uint32 *argv_lens, *argv_types;
+  char *bindhost = NULL;
  
   if (!server || !IS_SILC_SERVER(server) || !server->connected)
     cmd_return_error(CMDERR_NOT_CONNECTED);
  
   if (!server || !IS_SILC_SERVER(server) || !server->connected)
     cmd_return_error(CMDERR_NOT_CONNECTED);
@@ -1172,6 +1173,31 @@ static void command_key(const char *data, SILC_SERVER_REC *server,
     internal = silc_calloc(1, sizeof(*internal));
     internal->type = type;
     internal->server = server;
     internal = silc_calloc(1, sizeof(*internal));
     internal->type = type;
     internal->server = server;
+    
+    if (!hostname) {
+      if (settings_get_bool("use_auto_addr")) {
+       
+        hostname = (char *)settings_get_str("auto_public_ip");
+
+/* If the hostname isn't set, treat this case as if auto_public_ip wasn't
+ * set.
+ */
+        if ((hostname) && (*hostname == '\0')) {
+           hostname = NULL;
+        }
+        else {
+          bindhost = (char *)settings_get_str("auto_bind_ip");
+            
+/* if the bind_ip isn't set, but the public_ip IS, then assume then
+ * public_ip is the same value as the bind_ip.
+ */
+          if ((bindhost) && (*bindhost == '\0')) {
+            bindhost = hostname;
+          }
+           port = settings_get_int("auto_bind_port");
+        }
+      }  /* if use_auto_addr */
+    }
   }
 
   /* Start command is used to start key agreement (after receiving the
   }
 
   /* Start command is used to start key agreement (after receiving the
@@ -1201,7 +1227,8 @@ static void command_key(const char *data, SILC_SERVER_REC *server,
                       SILCTXT_KEY_AGREEMENT, argv[2]);
     internal->responder = TRUE;
     silc_client_send_key_agreement(silc_client, conn, client_entry, hostname, 
                       SILCTXT_KEY_AGREEMENT, argv[2]);
     internal->responder = TRUE;
     silc_client_send_key_agreement(silc_client, conn, client_entry, hostname, 
-                                  port, 120, keyagr_completion, internal);
+                                  bindhost, port, 120, keyagr_completion, 
+                                  internal);
     if (!hostname)
       silc_free(internal);
     goto out;
     if (!hostname)
       silc_free(internal);
     goto out;
index 1a8336615fcbc667827e2ec4c96835a917b32767..767cb0b184797bfce1e76d1078da2897ba13bfe5 100644 (file)
@@ -275,6 +275,16 @@ void silc_core_init_finish(void)
   /* Do some irssi initializing */
   settings_add_bool("server", "skip_motd", FALSE);
   settings_add_str("server", "alternate_nick", NULL);
   /* Do some irssi initializing */
   settings_add_bool("server", "skip_motd", FALSE);
   settings_add_str("server", "alternate_nick", NULL);
+  
+  /* Initialize the auto_addr variables Is "server" the best choice for
+   * this?  No existing category seems to apply.
+   */
+  
+  settings_add_bool("server", "use_auto_addr", FALSE);
+  settings_add_str("server", "auto_bind_ip", "");
+  settings_add_str("server", "auto_public_ip", "");
+  settings_add_int("server", "auto_bind_port", 0);
+                               
   silc_init_userinfo();
 
   /* Initialize client parameters */
   silc_init_userinfo();
 
   /* Initialize client parameters */
index 336ea5b77dbef6a407f4c171bb2e770a1293538e..d584baeffc9d48be41932839682b9a2084441046 100644 (file)
@@ -295,7 +295,8 @@ SILC_TASK_CALLBACK(silc_client_key_agreement_timeout)
 void silc_client_send_key_agreement(SilcClient client,
                                    SilcClientConnection conn,
                                    SilcClientEntry client_entry,
 void silc_client_send_key_agreement(SilcClient client,
                                    SilcClientConnection conn,
                                    SilcClientEntry client_entry,
-                                   char *hostname,
+                                   const char *hostname,
+                                   const char *bindhost,
                                    int port,
                                    uint32 timeout_secs,
                                    SilcKeyAgreementCallback completion,
                                    int port,
                                    uint32 timeout_secs,
                                    SilcKeyAgreementCallback completion,
@@ -310,18 +311,28 @@ void silc_client_send_key_agreement(SilcClient client,
   if (client_entry->ke)
     return;
 
   if (client_entry->ke)
     return;
 
-  /* Create the listener if hostname and port was provided */
+  /* Create the listener if hostname and port was provided.
+   * also, use bindhost if it was specified.
+   */
+   
   if (hostname) {
     ke = silc_calloc(1, sizeof(*ke));
   if (hostname) {
     ke = silc_calloc(1, sizeof(*ke));
+    
+    if (bindhost) {
+      ke->fd = silc_net_create_server(port, bindhost);
+    }
+    else {
     ke->fd = silc_net_create_server(port, hostname);
     ke->fd = silc_net_create_server(port, hostname);
+    }
 
     if (ke->fd < 0) {
       client->ops->say(client, conn, SILC_CLIENT_MESSAGE_ERROR, 
                       "Cannot create listener on %s on port %d: %s", 
 
     if (ke->fd < 0) {
       client->ops->say(client, conn, SILC_CLIENT_MESSAGE_ERROR, 
                       "Cannot create listener on %s on port %d: %s", 
-                      hostname, port, strerror(errno));
+                      (bindhost) ? bindhost:hostname, port, strerror(errno));
       completion(client, conn, client_entry, SILC_KEY_AGREEMENT_FAILURE,
                 NULL, context);
       silc_free(ke);
       completion(client, conn, client_entry, SILC_KEY_AGREEMENT_FAILURE,
                 NULL, context);
       silc_free(ke);
+
       return;
     }
 
       return;
     }
 
@@ -358,6 +369,7 @@ void silc_client_send_key_agreement(SilcClient client,
                          client_entry->id, SILC_ID_CLIENT, NULL, NULL,
                          buffer->data, buffer->len, FALSE);
   silc_buffer_free(buffer);
                          client_entry->id, SILC_ID_CLIENT, NULL, NULL,
                          buffer->data, buffer->len, FALSE);
   silc_buffer_free(buffer);
+
 }
 
 static int 
 }
 
 static int 
index 1038074a2166d11604d8e3148fe45aed1dd6ff35..155ea2da6f62af066d8fea7fe23a74d5fef9f588 100644 (file)
@@ -1586,7 +1586,8 @@ void silc_client_free_channel_private_keys(SilcChannelPrivateKey *keys,
 void silc_client_send_key_agreement(SilcClient client,
                                    SilcClientConnection conn,
                                    SilcClientEntry client_entry,
 void silc_client_send_key_agreement(SilcClient client,
                                    SilcClientConnection conn,
                                    SilcClientEntry client_entry,
-                                   char *hostname,
+                                   const char *hostname,
+                                   const char *bindhost,
                                    int port,
                                    uint32 timeout_secs,
                                    SilcKeyAgreementCallback completion,
                                    int port,
                                    uint32 timeout_secs,
                                    SilcKeyAgreementCallback completion,