Fixed JOIN notify timeout handling.
authorPekka Riikonen <priikone@silcnet.org>
Sat, 1 Sep 2007 10:20:04 +0000 (10:20 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Sat, 1 Sep 2007 10:20:04 +0000 (10:20 +0000)
CHANGES.TOOLKIT
lib/silcclient/client_entry.c
lib/silcclient/client_notify.c
lib/silcclient/command_reply.c

index 71d434b1aaeaf264d416b326b37545841358f88e..64cfe8c2232665660019d7a08b9512c96213a24f 100644 (file)
@@ -1,3 +1,8 @@
+Sun Aug 26 12:28:49 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+        * Fixed TIMEOUT handling in user info resolving during JOINing,
+          fixes crash.  Affected file is lib/silcclient/client_notify.c.
+
 Tue Jul 10 20:02:04 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
 
        * Added support for new PKCS API and other API changes from
index d3d6e44da3a6f88631e35bbae40db1cefa719990..2a26931ae9cac71fafa5ec849a418cde2322a3f9 100644 (file)
@@ -517,7 +517,6 @@ SilcUInt16 silc_client_get_clients_by_list(SilcClient client,
   SilcUInt32 *res_argv_lens = NULL, *res_argv_types = NULL, res_argc = 0;
   SilcUInt16 idp_len, cmd_ident;
   SilcID id;
-  va_list tmp;
   int i;
 
   SILC_LOG_DEBUG(("Resolve clients from Client ID list"));
@@ -585,7 +584,7 @@ SilcUInt16 silc_client_get_clients_by_list(SilcClient client,
 
   /* We have the clients in cache, get them and call the completion */
   silc_client_get_clients_list_cb(client, conn, SILC_COMMAND_WHOIS,
-                                 SILC_STATUS_OK, SILC_STATUS_OK, in, tmp);
+                                 SILC_STATUS_OK, SILC_STATUS_OK, in, NULL);
   return 0;
 
  err:
index 005299c61f1a0610c9a3186c8c939f471ed5aca1..e1c969136c796ae6480798f455be29ee5e162c91 100644 (file)
@@ -56,9 +56,14 @@ static void silc_client_notify_resolved(SilcClient client,
   /* If entry is still invalid, resolving failed.  Finish notify processing. */
   if (notify->client_entry && !notify->client_entry->internal.valid) {
     /* If resolving timedout try it again many times. */
-    if (status != SILC_STATUS_ERR_TIMEDOUT || ++notify->resolve_retry > 1000)
+    if (status != SILC_STATUS_ERR_TIMEDOUT || ++notify->resolve_retry > 1000) {
       silc_fsm_next(notify->fsm, silc_client_notify_processed);
-    silc_client_unref_client(client, conn, notify->client_entry);
+
+      /* Unref client only in case of non-timeout error.  In case of timeout
+        occurred, the routine reprocessing the notify is expected not to
+        create new references of the entry. */
+      silc_client_unref_client(client, conn, notify->client_entry);
+    }
   }
 
   /* If no entries found, just finish the notify processing */
@@ -524,7 +529,7 @@ SILC_FSM_STATE(silc_client_notify_signoff)
   if (tmp && tmp_len > 128)
     tmp[128] = '\0';
 
-  if (packet->dst_id_type == SILC_ID_CHANNEL) 
+  if (packet->dst_id_type == SILC_ID_CHANNEL)
     if (silc_id_str2id(packet->dst_id, packet->dst_id_len, SILC_ID_CHANNEL,
                       &id.u.channel_id, sizeof(id.u.channel_id)))
       channel = silc_client_get_channel_by_id(client, conn, &id.u.channel_id);
@@ -690,7 +695,7 @@ SILC_FSM_STATE(silc_client_notify_nick_change)
   SilcNotifyType type = silc_notify_get_type(payload);
   SilcArgumentPayload args = silc_notify_get_args(payload);
   SilcClientEntry client_entry = NULL;
-  unsigned char *tmp, oldnick[128 + 1];
+  unsigned char *tmp, oldnick[256 + 1];
   SilcUInt32 tmp_len;
   SilcID id, id2;
   SilcBool valid;
index 4289aa86a58fee096155e6384c8d4819ce3b5594..ebcc94e587f9d8cbdb59f6c6bf494ac67f889105 100644 (file)
@@ -1996,6 +1996,8 @@ SILC_FSM_STATE(silc_client_command_reply_getkey)
     goto out;
   }
   if (!silc_public_key_payload_decode(tmp, len, &public_key)) {
+    SAY(client, conn, SILC_CLIENT_MESSAGE_COMMAND_ERROR,
+        "Cannot decode public key: malformed/unsupported public key");
     ERROR_CALLBACK(SILC_STATUS_ERR_NOT_ENOUGH_PARAMS);
     goto out;
   }