From: Pekka Riikonen Date: Mon, 8 Jun 2009 05:03:02 +0000 (+0300) Subject: silcd: Abort active protocols in DETACH command X-Git-Tag: silc.client.1.1.8~3 X-Git-Url: http://git.silcnet.org/gitweb/?a=commitdiff_plain;h=59f343801620f8b02933d419efb111d5928b11b8;hp=aef788f086376673eef0939aa3ef74810318d5f3;p=silc.git silcd: Abort active protocols in DETACH command When detaching client, which results into closing of the actual connection it is important to abort any active protocols, such as rekeys, because they cannot be completed with detached clients. --- diff --git a/apps/silcd/command.c b/apps/silcd/command.c index 597f042e..080560ed 100644 --- a/apps/silcd/command.c +++ b/apps/silcd/command.c @@ -4068,15 +4068,28 @@ SILC_TASK_CALLBACK(silc_server_command_detach_cb) SilcClientID *client_id = (SilcClientID *)q->sock; SilcClientEntry client; SilcPacketStream sock; + SilcIDListData idata; + client = silc_idlist_find_client_by_id(server->local_list, client_id, TRUE, NULL); if (client && client->connection) { sock = client->connection; + SILC_LOG_DEBUG(("Detaching client %s", + silc_id_render(client->id, SILC_ID_CLIENT))); + /* Stop rekey for the client. */ silc_server_stop_rekey(server, client); + /* Abort any active protocol */ + idata = silc_packet_get_context(sock); + if (idata && idata->sconn && idata->sconn->op) { + SILC_LOG_DEBUG(("Abort active protocol")); + silc_async_abort(idata->sconn->op, NULL, NULL); + idata->sconn->op = NULL; + } + /* Close the connection on our side */ client->router = NULL; client->connection = NULL;