]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Don't crash if trying to use an unsupported auth mechanism.
authorTimo Sirainen <tss@iki.fi>
Sat, 13 Dec 2008 11:16:54 +0000 (13:16 +0200)
committerTimo Sirainen <tss@iki.fi>
Sat, 13 Dec 2008 11:16:54 +0000 (13:16 +0200)
--HG--
branch : HEAD

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

index 7d6dc4af8a411127f20cbca6a1cddebd3f279d29..31c58a2899e56aa8a3fbc41727771107a8834c0a 100644 (file)
@@ -81,12 +81,16 @@ static void client_auth_input(struct imap_client *client)
 
 static void client_auth_failed(struct imap_client *client)
 {
+       client->common.auth_command_tag = NULL;
+
+       if (client->auth_initializing)
+               return;
+
        /* get back to normal client input. */
        if (client->io != NULL)
                io_remove(&client->io);
        client->io = io_add(client->common.fd, IO_READ,
                            client_input, client);
-       client->common.auth_command_tag = NULL;
        client_input(client);
 }
 
@@ -285,8 +289,10 @@ static int client_auth_begin(struct imap_client *client, const char *mech_name,
        client->common.auth_command_tag = client->cmd_tag;
 
        client_ref(client);
+       client->auth_initializing = TRUE;
        sasl_server_auth_begin(&client->common, IMAP_SERVICE_NAME, mech_name,
                               init_resp, sasl_callback);
+       client->auth_initializing = FALSE;
        if (!client->common.authenticating)
                return 1;
 
index 35f410a37ec2790d4bd8c2140afccdbc90cc4889..76de7ff82f963116db1fef580863f315c83535a1 100644 (file)
@@ -31,6 +31,7 @@ struct imap_client {
        unsigned int destroyed:1;
        unsigned int greeting_sent:1;
        unsigned int id_logged:1;
+       unsigned int auth_initializing:1;
 };
 
 void client_destroy(struct imap_client *client, const char *reason);
index 0126b732a50fdee2571fc3661f7bb810be8eb15e..da665ed502a9714d403b4ee449eba969c18381aa 100644 (file)
@@ -329,8 +329,10 @@ bool cmd_pass(struct pop3_client *client, const char *args)
        base64_encode(plain_login->data, plain_login->used, base64);
 
        client_ref(client);
+       client->auth_initializing = TRUE;
        sasl_server_auth_begin(&client->common, POP3_SERVICE_NAME, "PLAIN",
                               str_c(base64), sasl_callback);
+       client->auth_initializing = FALSE;
        if (!client->common.authenticating)
                return TRUE;
 
index dcebfe41fe32f9bf9a7cddcb3ca412ba0dc27118..6e76d24d9bdc608388b2d0eae338054249d351c1 100644 (file)
@@ -29,6 +29,7 @@ struct pop3_client {
 
        unsigned int login_success:1;
        unsigned int auth_connected:1;
+       unsigned int auth_initializing:1;
        unsigned int destroyed:1;
 };