- InternalGetAuthMethod internal = (InternalGetAuthMethod)context;
-
- SILC_LOG_DEBUG(("Start"));
-
- switch (auth_meth) {
- case SILC_AUTH_NONE:
- /* No authentication required. */
- (*internal->completion)(TRUE, auth_meth, NULL, 0, internal->context);
- break;
- case SILC_AUTH_PASSWORD:
- {
- /* Check whether we find the password for this server in our
- configuration. If not, then don't provide so library will ask
- it from the user. */
- SERVER_SETUP_REC *setup = server_setup_find_port(conn->remote_host,
- conn->remote_port);
- if (!setup || !setup->password) {
- (*internal->completion)(TRUE, auth_meth, NULL, 0, internal->context);
- break;
- }
-
- (*internal->completion)(TRUE, auth_meth, setup->password,
- strlen(setup->password), internal->context);
- }
- break;
- case SILC_AUTH_PUBLIC_KEY:
- /* Do not get the authentication data now, the library will generate
- it using our default key, if we do not provide it here. */
- /* XXX In the future when we support multiple local keys and multiple
- local certificates we will need to ask from user which one to use. */
- (*internal->completion)(TRUE, auth_meth, NULL, 0, internal->context);
- break;
- }
-
- silc_free(internal);
+ GetAuthMethod a = context;
+ a->completion(passphrase ? SILC_AUTH_PASSWORD : SILC_AUTH_NONE,
+ passphrase, passphrase_len, a->context);
+ silc_free(a);