projects
/
silc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a71ca13
)
Fixed connection authentication protocol aborting.
author
Pekka Riikonen
<priikone@silcnet.org>
Mon, 19 Feb 2007 20:36:52 +0000
(20:36 +0000)
committer
Pekka Riikonen
<priikone@silcnet.org>
Mon, 19 Feb 2007 20:36:52 +0000
(20:36 +0000)
lib/silcclient/client_connect.c
patch
|
blob
|
history
lib/silccore/silcpacket.c
patch
|
blob
|
history
lib/silcske/silcconnauth.c
patch
|
blob
|
history
lib/silcske/silcske.c
patch
|
blob
|
history
lib/silcske/silcske_i.h
patch
|
blob
|
history
diff --git
a/lib/silcclient/client_connect.c
b/lib/silcclient/client_connect.c
index 95b0bff1dffc5dcf04ca49c3a30df2510d747ec6..765eba24d629094210fb6a3f756465ee5b702538 100644
(file)
--- a/
lib/silcclient/client_connect.c
+++ b/
lib/silcclient/client_connect.c
@@
-316,7
+316,7
@@
static void silc_client_connect_auth_completion(SilcConnAuth connauth,
silc_fsm_next(fsm, silc_client_st_connect_error);
}
silc_fsm_next(fsm, silc_client_st_connect_error);
}
- SILC_FSM_CALL_CONTINUE(fsm);
+ SILC_FSM_CALL_CONTINUE
_SYNC
(fsm);
}
/********************** CONNECTION_AUTH_REQUEST packet **********************/
}
/********************** CONNECTION_AUTH_REQUEST packet **********************/
diff --git
a/lib/silccore/silcpacket.c
b/lib/silccore/silcpacket.c
index ff6fdee6e8aa9ad526d2501b0a2db3c8a66c8c4f..8f1bded4ebaa69fb9ae6ccb8f94b810e3cc7f195 100644
(file)
--- a/
lib/silccore/silcpacket.c
+++ b/
lib/silccore/silcpacket.c
@@
-862,8
+862,9
@@
void silc_packet_stream_destroy(SilcPacketStream stream)
/* Delete from UDP remote hash table */
char tuple[64];
engine = stream->sc->engine;
/* Delete from UDP remote hash table */
char tuple[64];
engine = stream->sc->engine;
- silc_snprintf(tuple, sizeof(tuple), "%d%s", stream->remote_udp->remote_port,
- stream->remote_udp->remote_ip);
+ silc_snprintf(tuple, sizeof(tuple), "%d%s",
+ stream->remote_udp->remote_port
+ stream->remote_udp->remote_ip);
silc_mutex_lock(engine->lock);
silc_hash_table_del(engine->udp_remote, tuple);
silc_mutex_unlock(engine->lock);
silc_mutex_lock(engine->lock);
silc_hash_table_del(engine->udp_remote, tuple);
silc_mutex_unlock(engine->lock);
diff --git
a/lib/silcske/silcconnauth.c
b/lib/silcske/silcconnauth.c
index b5e59ab53af9cf37539b2763d1471f2555f23b0d..ecd515f084363d3f097dcfa442e60fba27a19132 100644
(file)
--- a/
lib/silcske/silcconnauth.c
+++ b/
lib/silcske/silcconnauth.c
@@
-227,6
+227,7
@@
SilcConnAuth silc_connauth_alloc(SilcSchedule schedule,
connauth->timeout_secs = timeout_secs;
connauth->ske = ske;
connauth->timeout_secs = timeout_secs;
connauth->ske = ske;
+ ske->refcnt++;
return connauth;
}
return connauth;
}
@@
-237,6
+238,10
@@
void silc_connauth_free(SilcConnAuth connauth)
{
if (connauth->public_keys)
silc_dlist_uninit(connauth->public_keys);
{
if (connauth->public_keys)
silc_dlist_uninit(connauth->public_keys);
+
+ /* Free reference */
+ silc_ske_free(connauth->ske);
+
silc_free(connauth);
}
silc_free(connauth);
}
@@
-374,12
+379,14
@@
SILC_FSM_STATE(silc_connauth_st_initiator_failure)
SILC_LOG_DEBUG(("Start"));
SILC_LOG_DEBUG(("Start"));
- /* Send FAILURE packet */
- SILC_PUT32_MSB(SILC_AUTH_FAILED, error);
- silc_packet_send(connauth->ske->stream, SILC_PACKET_FAILURE, 0, error, 4);
+ if (!connauth->aborted) {
+ /* Send FAILURE packet */
+ SILC_PUT32_MSB(SILC_AUTH_FAILED, error);
+ silc_packet_send(connauth->ske->stream, SILC_PACKET_FAILURE, 0, error, 4);
- /* Call completion callback */
- connauth->completion(connauth, FALSE, connauth->context);
+ /* Call completion callback */
+ connauth->completion(connauth, FALSE, connauth->context);
+ }
silc_packet_stream_unlink(connauth->ske->stream,
&silc_connauth_stream_cbs, connauth);
silc_packet_stream_unlink(connauth->ske->stream,
&silc_connauth_stream_cbs, connauth);
@@
-663,12
+670,14
@@
SILC_FSM_STATE(silc_connauth_st_responder_failure)
SILC_LOG_ERROR(("Authentication failed"));
SILC_LOG_ERROR(("Authentication failed"));
- /* Send FAILURE packet */
- SILC_PUT32_MSB(SILC_AUTH_FAILED, error);
- silc_packet_send(connauth->ske->stream, SILC_PACKET_FAILURE, 0, error, 4);
+ if (!connauth->aborted) {
+ /* Send FAILURE packet */
+ SILC_PUT32_MSB(SILC_AUTH_FAILED, error);
+ silc_packet_send(connauth->ske->stream, SILC_PACKET_FAILURE, 0, error, 4);
- /* Call completion callback */
- connauth->completion(connauth, FALSE, connauth->context);
+ /* Call completion callback */
+ connauth->completion(connauth, FALSE, connauth->context);
+ }
silc_packet_stream_unlink(connauth->ske->stream,
&silc_connauth_stream_cbs, connauth);
silc_packet_stream_unlink(connauth->ske->stream,
&silc_connauth_stream_cbs, connauth);
diff --git
a/lib/silcske/silcske.c
b/lib/silcske/silcske.c
index a726174339bde711d2108432905668a7fbc5fb37..cf97428eeed0d291334d2db4c2c778d619035939 100644
(file)
--- a/
lib/silcske/silcske.c
+++ b/
lib/silcske/silcske.c
@@
-1035,6
+1035,7
@@
SilcSKE silc_ske_alloc(SilcRng rng, SilcSchedule schedule,
ske->public_key = public_key;
ske->private_key = private_key;
ske->retry_timer = SILC_SKE_RETRY_MIN;
ske->public_key = public_key;
ske->private_key = private_key;
ske->retry_timer = SILC_SKE_RETRY_MIN;
+ ske->refcnt = 1;
return ske;
}
return ske;
}
@@
-1064,6
+1065,10
@@
void silc_ske_free(SilcSKE ske)
return;
}
return;
}
+ ske->refcnt--;
+ if (ske->refcnt > 0)
+ return;
+
/* Free start payload */
if (ske->start_payload)
silc_ske_payload_start_free(ske->start_payload);
/* Free start payload */
if (ske->start_payload)
silc_ske_payload_start_free(ske->start_payload);
diff --git
a/lib/silcske/silcske_i.h
b/lib/silcske/silcske_i.h
index ba75050a2fb9372ade1320e7b80c4ae5f9271dd9..051324550b66727f0f413281fae1b8466df22b40 100644
(file)
--- a/
lib/silcske/silcske_i.h
+++ b/
lib/silcske/silcske_i.h
@@
-88,6
+88,7
@@
struct SilcSKEStruct {
} retrans;
SilcUInt16 timeout; /* SKE timeout */
} retrans;
SilcUInt16 timeout; /* SKE timeout */
+ SilcUInt16 refcnt; /* Reference counter */
unsigned int aborted : 1; /* Set when SKE aborted */
unsigned int freed : 1; /* Set when freed during session */
unsigned int aborted : 1; /* Set when SKE aborted */
unsigned int freed : 1; /* Set when freed during session */