From: Timo Sirainen Date: Sun, 30 May 2004 04:41:27 +0000 (+0300) Subject: Use initial SASL response for LOGIN command internally. X-Git-Tag: 1.1.alpha1~4018 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc6294e4f0d7a54ff601257adaa44331a91b234e;p=thirdparty%2Fdovecot%2Fcore.git Use initial SASL response for LOGIN command internally. --HG-- branch : HEAD --- diff --git a/src/imap-login/client-authenticate.c b/src/imap-login/client-authenticate.c index ef7c11fed8..d1c3a8d3f6 100644 --- a/src/imap-login/client-authenticate.c +++ b/src/imap-login/client-authenticate.c @@ -113,17 +113,11 @@ static void login_callback(struct auth_request *request, switch (auth_callback(request, reply, data, &client->common, master_callback, &error)) { case -1: + case 0: /* login failed */ client_auth_abort(client, error); break; - case 0: - /* continue */ - ptr = buffer_get_data(client->plain_login, &size); - auth_client_request_continue(request, ptr, size); - - buffer_set_used_size(client->plain_login, 0); - break; default: /* success, we should be able to log in. if we fail, just disconnect the client. */ @@ -147,6 +141,7 @@ client_get_auth_flags(struct imap_client *client) int cmd_login(struct imap_client *client, struct imap_arg *args) { const char *user, *pass, *error; + string_t *str; /* two arguments: username and password */ if (args[0].type != IMAP_ARG_ATOM && args[0].type != IMAP_ARG_STRING) @@ -170,18 +165,19 @@ int cmd_login(struct imap_client *client, struct imap_arg *args) } /* authorization ID \0 authentication ID \0 pass */ - buffer_set_used_size(client->plain_login, 0); - buffer_append_c(client->plain_login, '\0'); - buffer_append(client->plain_login, user, strlen(user)); - buffer_append_c(client->plain_login, '\0'); - buffer_append(client->plain_login, pass, strlen(pass)); + str = t_str_new(64); + str_append_c(str, '\0'); + str_append(str, user); + str_append_c(str, '\0'); + str_append(str, pass); client_ref(client); client->common.auth_request = auth_client_request_new(auth_client, "PLAIN", "IMAP", client_get_auth_flags(client), - NULL, 0, login_callback, + str_data(str), str_len(str), + login_callback, client, &error); if (client->common.auth_request == NULL) { client_send_tagline(client, t_strconcat( diff --git a/src/imap-login/client.c b/src/imap-login/client.c index a576f241f2..4ba1f667dd 100644 --- a/src/imap-login/client.c +++ b/src/imap-login/client.c @@ -378,7 +378,6 @@ struct client *client_create(int fd, struct ip_addr *ip, int ssl) client_open_streams(client, fd); client->common.io = io_add(fd, IO_READ, client_input, client); - client->plain_login = buffer_create_dynamic(system_pool, 128, 8192); client->last_input = ioloop_time; hash_insert(clients, client, client); @@ -442,7 +441,6 @@ int client_unref(struct imap_client *client) i_stream_unref(client->input); o_stream_unref(client->output); - buffer_free(client->plain_login); i_free(client->common.virtual_user); i_free(client); diff --git a/src/imap-login/client.h b/src/imap-login/client.h index 08fcca0009..74148633cb 100644 --- a/src/imap-login/client.h +++ b/src/imap-login/client.h @@ -20,8 +20,6 @@ struct imap_client { const char *cmd_tag, *cmd_name; - buffer_t *plain_login; - unsigned int tls:1; unsigned int secured:1; unsigned int cmd_finished:1;