+Wed Feb 18 02:46:17 EET 2004 Pekka Riikonen <priikone@silcnet.org>
+
+ * Fixed error handling in resuming data processing. Affected
+ files are lib/silcclient/client_resume.c and client.c.
+
Tue Feb 17 19:34:30 EET 2004 Pekka Riikonen <priikone@silcnet.org>
* Fixed silc_client_send_private_message to return TRUE correctly.
(SilcClientConnAuthInternalContext *)context;
SilcClient client = (SilcClient)ctx->client;
- client->internal->ops->connected(client, ctx->sock->user_data,
- SILC_CLIENT_CONN_ERROR_AUTH);
+ client->internal->ops->connected(client, ctx->sock->user_data, ctx->status);
silc_free(ctx);
}
protocol->state == SILC_PROTOCOL_STATE_FAILURE) {
/* Error occured during protocol */
SILC_LOG_DEBUG(("Error during authentication protocol"));
+ ctx->status = SILC_CLIENT_CONN_ERROR_AUTH;
goto err;
}
unsigned char *old_id;
SilcUInt16 old_id_len;
- if (!silc_client_process_detach_data(client, conn, &old_id, &old_id_len))
+ if (!silc_client_process_detach_data(client, conn, &old_id, &old_id_len)) {
+ ctx->status = SILC_CLIENT_CONN_ERROR_RESUME;
goto err;
+ }
old_client_id = silc_id_str2id(old_id, old_id_len, SILC_ID_CLIENT);
if (!old_client_id) {
silc_free(old_id);
+ ctx->status = SILC_CLIENT_CONN_ERROR_RESUME;
goto err;
}
if (!auth) {
silc_free(old_client_id);
silc_free(old_id);
+ ctx->status = SILC_CLIENT_CONN_ERROR_RESUME;
goto err;
}
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2002, 2003 Pekka Riikonen
+ Copyright (C) 2002, 2004 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
SilcBufferStruct detach;
SilcUInt32 ch_count;
int i, len;
+ char *newnick;
SILC_LOG_DEBUG(("Start"));
- silc_free(conn->nickname);
silc_buffer_set(&detach, conn->internal->params.detach_data,
conn->internal->params.detach_data_len);
SILC_LOG_HEXDUMP(("Detach data"), detach.data, detach.len);
+ *old_id = NULL;
+ *old_id_len = 0;
+
/* Take the old client ID from the detachment data */
len = silc_buffer_unformat(&detach,
- SILC_STR_UI16_NSTRING_ALLOC(&conn->nickname,
+ SILC_STR_UI16_NSTRING_ALLOC(&newnick,
NULL),
SILC_STR_UI16_NSTRING_ALLOC(old_id, old_id_len),
SILC_STR_UI_INT(NULL),
SILC_STR_END);
if (len == -1)
return FALSE;
+ if (!newnick || !(*old_id) || !(*old_id_len))
+ return FALSE;
+
+ silc_free(conn->nickname);
+ conn->nickname = newnick;
silc_buffer_pull(&detach, len);
protocol.h
- Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
+ Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 1997 - 2000 Pekka Riikonen
+ Copyright (C) 1997 - 2004 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
+ the Free Software Foundation; version 2 of the License.
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
typedef struct {
void *client;
SilcSocketConnection sock;
+ SilcClientConnectionStatus status;
/* SKE object from Key Exchange protocol. */
SilcSKE ske;