file during connecting.
Fixed auth protocol failure handling in Client library.
+Fri Oct 18 10:51:04 EEST 2002 Pekka Riikonen <priikone@silcnet.org>
+
+ * Added support for auto-passphrase authentication from the
+ config file during connecting which was not implemented
+ yet. Affected file irssi/src/silc/core/client_ops.c.
+
+ * Fixed a bug in authentication protocol failure handling which
+ was processing wrong callback context. Affected files
+ are lib/silcclient/client.c and protocol.c.
+
Thu Oct 17 23:45:12 EEST 2002 Pekka Riikonen <priikone@silcnet.org>
* Fixed string formatting crashbug in lib/silccore/silcattrs.c.
TODO/bugs in Irssi SILC client
==============================
- o Server password is not used at all. It is not possible to automize
- the password authentication currently. The silc_get_auth_method
- in irssi/src/silc/core/client_ops.c should find the connection's
- password, only if not found then continue resolving the auth method.
- Alternatively it can do it after resolving in the callback.
-
o UTF-8 encode/decode WHOIS userinfos, topic, etc.
o Manaul file for silc(1) and silc.conf.
(*internal->completion)(TRUE, auth_meth, NULL, 0, internal->context);
break;
case SILC_AUTH_PASSWORD:
- /* Do not ask the passphrase from user, the library will ask it if
- we do not provide it here. */
- (*internal->completion)(TRUE, auth_meth, NULL, 0, internal->context);
+ {
+ /* 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
SILC_LOG_DEBUG(("Start"));
- /* XXX must resolve from configuration whether this connection has
- any specific authentication data */
-
/* If we do not have this connection configured by the user in a
configuration file then resolve the authentication method from the
server for this session. */
conn, client->schedule);
}
-/* Callback called when error has occurred during connecting to the server.
- The `connect' client operation will be called. */
+/* Callback called when error has occurred during connecting (KE) to
+ the server. The `connect' client operation will be called. */
SILC_TASK_CALLBACK(silc_client_connect_failure)
{
silc_free(ctx);
}
+/* Callback called when error has occurred during connecting (auth) to
+ the server. The `connect' client operation will be called. */
+
+SILC_TASK_CALLBACK(silc_client_connect_failure_auth)
+{
+ SilcClientConnAuthInternalContext *ctx =
+ (SilcClientConnAuthInternalContext *)context;
+ SilcClient client = (SilcClient)ctx->client;
+
+ client->internal->ops->connect(client, ctx->sock->user_data,
+ SILC_CLIENT_CONN_ERROR);
+ silc_free(ctx);
+}
+
/* Start of the connection to the remote server. This is called after
succesful TCP/IP connection has been established to the remote host. */
silc_protocol_free(protocol);
if (ctx->packet)
silc_packet_context_free(ctx->packet);
+ ctx->packet = NULL;
silc_free(ctx);
sock->protocol = NULL;
proto_ctx->auth_meth = auth_meth;
- if (auth_data && auth_data_len) {
+ if (success && auth_data && auth_data_len) {
+
+ /* Passphrase must be UTF-8 encoded, if it isn't encode it */
+ if (auth_meth == SILC_AUTH_PASSWORD &&
+ !silc_utf8_valid(auth_data, auth_data_len)) {
+ int payload_len = 0;
+ unsigned char *autf8 = NULL;
+ payload_len = silc_utf8_encoded_len(auth_data, auth_data_len,
+ SILC_STRING_ASCII);
+ autf8 = silc_calloc(payload_len, sizeof(*autf8));
+ auth_data_len = silc_utf8_encode(auth_data, auth_data_len,
+ SILC_STRING_ASCII, autf8, payload_len);
+ auth_data = autf8;
+ }
+
proto_ctx->auth_data = silc_memdup(auth_data, auth_data_len);
proto_ctx->auth_data_len = auth_data_len;
}
/* Notify application of failure */
silc_schedule_task_add(client->schedule, ctx->sock->sock,
- silc_client_connect_failure, ctx,
+ silc_client_connect_failure_auth, ctx,
0, 1, SILC_TASK_TIMEOUT, SILC_TASK_PRI_NORMAL);
}
int payload_len = 0;
unsigned char *autf8 = NULL;
- SILC_LOG_DEBUG(("Start"));
+ SILC_LOG_DEBUG(("Sending authentication to server"));
/* Passphrase must be UTF-8 encoded, if it isn't encode it */
if (ctx->auth_meth == SILC_AUTH_PASSWORD &&