Fixed JOIN notify timeout handling, fixes a crash.
authorPekka Riikonen <priikone@silcnet.org>
Sat, 1 Sep 2007 08:52:01 +0000 (08:52 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Sat, 1 Sep 2007 08:52:01 +0000 (08:52 +0000)
lib/silcclient/client_notify.c
lib/silcclient/command_reply.c

index 5d431954d602b0882b0583d64b746451812b4b87..64c041eaf11a6371551c4b4a757b64a82a96a83c 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 */
index 9294fe8a166374840e69978abf1536342d860cee..a487cb95084bf8bcfe4eae239d2f1ada8b9a7ca3 100644 (file)
@@ -1997,6 +1997,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;
   }