changeset 2088:4d0834aaa365 HEAD

Use initial SASL response for LOGIN command internally.
author Timo Sirainen <tss@iki.fi>
date Sun, 30 May 2004 07:41:27 +0300
parents a11f8fa33848
children d8cd285b148b
files src/imap-login/client-authenticate.c src/imap-login/client.c src/imap-login/client.h
diffstat 3 files changed, 9 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap-login/client-authenticate.c	Sun May 30 07:35:06 2004 +0300
+++ b/src/imap-login/client-authenticate.c	Sun May 30 07:41:27 2004 +0300
@@ -113,17 +113,11 @@
 	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 @@
 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 @@
 	}
 
 	/* 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(
--- a/src/imap-login/client.c	Sun May 30 07:35:06 2004 +0300
+++ b/src/imap-login/client.c	Sun May 30 07:41:27 2004 +0300
@@ -378,7 +378,6 @@
 
 	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 @@
 	i_stream_unref(client->input);
 	o_stream_unref(client->output);
 
-	buffer_free(client->plain_login);
 	i_free(client->common.virtual_user);
 	i_free(client);
 
--- a/src/imap-login/client.h	Sun May 30 07:35:06 2004 +0300
+++ b/src/imap-login/client.h	Sun May 30 07:41:27 2004 +0300
@@ -20,8 +20,6 @@
 
 	const char *cmd_tag, *cmd_name;
 
-	buffer_t *plain_login;
-
 	unsigned int tls:1;
 	unsigned int secured:1;
 	unsigned int cmd_finished:1;