From: Pekka Riikonen Date: Sat, 1 Sep 2007 10:20:04 +0000 (+0000) Subject: Fixed JOIN notify timeout handling. X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=commitdiff_plain;h=e56abacd801336a327d35dd903b854ac41af011b Fixed JOIN notify timeout handling. --- diff --git a/CHANGES.TOOLKIT b/CHANGES.TOOLKIT index 71d434b1..64cfe8c2 100644 --- a/CHANGES.TOOLKIT +++ b/CHANGES.TOOLKIT @@ -1,3 +1,8 @@ +Sun Aug 26 12:28:49 EEST 2007 Pekka Riikonen + + * 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 * Added support for new PKCS API and other API changes from diff --git a/lib/silcclient/client_entry.c b/lib/silcclient/client_entry.c index d3d6e44d..2a26931a 100644 --- a/lib/silcclient/client_entry.c +++ b/lib/silcclient/client_entry.c @@ -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: diff --git a/lib/silcclient/client_notify.c b/lib/silcclient/client_notify.c index 005299c6..e1c96913 100644 --- a/lib/silcclient/client_notify.c +++ b/lib/silcclient/client_notify.c @@ -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; diff --git a/lib/silcclient/command_reply.c b/lib/silcclient/command_reply.c index 4289aa86..ebcc94e5 100644 --- a/lib/silcclient/command_reply.c +++ b/lib/silcclient/command_reply.c @@ -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; }