]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Use initial SASL response for LOGIN command internally.
authorTimo Sirainen <tss@iki.fi>
Sun, 30 May 2004 04:41:27 +0000 (07:41 +0300)
committerTimo Sirainen <tss@iki.fi>
Sun, 30 May 2004 04:41:27 +0000 (07:41 +0300)
--HG--
branch : HEAD

src/imap-login/client-authenticate.c
src/imap-login/client.c
src/imap-login/client.h

index ef7c11fed85b6a0221e8725e9432e712a8b43f6b..d1c3a8d3f6ea6ede95828ba7ddc79e542f562c69 100644 (file)
@@ -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(
index a576f241f24cb9a271267a801262c5c06bc169b7..4ba1f667dd1a098ea9c8871448704f34ddbc7540 100644 (file)
@@ -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);
 
index 08fcca0009ad2aa209dee9f30006e301c83d368f..74148633cbd1e2873731a0e5a2e4e87e4a5565a5 100644 (file)
@@ -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;