From: Pekka Riikonen Date: Sat, 10 May 2014 14:15:17 +0000 (+0300) Subject: silcclient: associate context with verify_public_key X-Git-Tag: silc.client.1.1.11~4 X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=commitdiff_plain;h=5647fc7838a3358928c3bc8ed8e32e6b7e6f26ab silcclient: associate context with verify_public_key To allow application to better target the public key verification request add support to have the client or server entry associated with the request inside SilcClientConnection context. --- diff --git a/lib/silcclient/client_prvmsg.c b/lib/silcclient/client_prvmsg.c index 8116a9ff..353d606c 100644 --- a/lib/silcclient/client_prvmsg.c +++ b/lib/silcclient/client_prvmsg.c @@ -1006,12 +1006,17 @@ silc_client_autoneg_key_verify_pubkey(SilcSKE ske, verify->context = ake; ake->verify = verify; + conn->context_type = SILC_ID_CLIENT; + conn->client_entry = client_entry; + /* Verify public key in application */ client->internal->ops->verify_public_key( client, conn, SILC_CONN_CLIENT, ake->public_key, silc_client_autoneg_key_verify_pubkey_cb, verify); + + conn->context_type = SILC_ID_NONE; } /* Key exchange protocol completion callback */ diff --git a/lib/silcclient/silcclient.h b/lib/silcclient/silcclient.h index 58e43f15..c6d8260a 100644 --- a/lib/silcclient/silcclient.h +++ b/lib/silcclient/silcclient.h @@ -232,9 +232,9 @@ struct SilcClientConnectionStruct { void *callback_context; /* Connection context */ SilcClient client; /* Pointer back to SilcClient */ - /* Current say() operation associated context, identifies the client, - channel or server the message is related to. Application can use - this information to target the message better. */ + /* Current say() or verify_public_key() operation associated context, + identifies the client, channel or server the operation is related to. + Application can use this information to target the operation better. */ union { SilcClientEntry client_entry; SilcChannelEntry channel_entry; @@ -519,8 +519,9 @@ typedef struct SilcClientOperationsStruct { The application can for example filter the message according the type. The variable argument list is arguments to the formatted message `msg'. A SilcClientEntry, SilcChannelEntry or SilcServerEntry - can be associated with the message inside the `conn' by the library, - and application may use it to better target the message. */ + can be associated with the message inside the SilcClientConnection + by the library, and application may use it to better target the + message. */ void (*say)(SilcClient client, SilcClientConnection conn, SilcClientMessageType type, char *msg, ...); @@ -603,7 +604,9 @@ typedef struct SilcClientOperationsStruct { entity (server or client) has sent the public key. If user decides to trust the key the application may save the key as trusted public key for later use. The `completion' must be called after the public key has - been verified. */ + been verified. A SilcClientEntry or SilcServerEntry can be associated + with this request inside the SilcClientConnection by the library, and + application may use it to better target the verification request. */ void (*verify_public_key)(SilcClient client, SilcClientConnection conn, SilcConnectionType conn_type, SilcPublicKey public_key,