+ /* Resolve the authentication method to be used in this connection. The
+ completion callback is called after the application has resolved
+ the authentication method. */
+ client->ops->get_auth_method(client, sock->user_data, sock->hostname,
+ sock->port, silc_client_resolve_auth_method,
+ proto_ctx);
+}
+
+/* Authentication method resolving callback. Application calls this function
+ after we've called the client->ops->get_auth_method client operation
+ to resolve the authentication method. We will continue the executiong
+ of the protocol in this function. */
+
+void silc_client_resolve_auth_method(bool success,
+ SilcProtocolAuthMeth auth_meth,
+ const unsigned char *auth_data,
+ uint32 auth_data_len, void *context)
+{
+ SilcClientConnAuthInternalContext *proto_ctx =
+ (SilcClientConnAuthInternalContext *)context;
+ SilcClient client = (SilcClient)proto_ctx->client;
+
+ if (!success)
+ auth_meth = SILC_AUTH_NONE;
+
+ proto_ctx->auth_meth = auth_meth;
+
+ if (auth_data && auth_data_len) {
+ proto_ctx->auth_data = silc_calloc(auth_data_len, sizeof(*auth_data));
+ memcpy(proto_ctx->auth_data, auth_data, auth_data_len);
+ proto_ctx->auth_data_len = auth_data_len;
+ }
+
+ /* Allocate the authenteication protocol and execute it. */