]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
pop3-login: Fix the next command failing after unsuccessful AUTH
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 3 Aug 2020 10:21:14 +0000 (13:21 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 10 Aug 2020 06:53:42 +0000 (06:53 +0000)
If the AUTH command failed (e.g. bad password or proxying failure), the
next command was still processed as AUTH command. For example:

auth plain .
-ERR [AUTH] Invalid base64 data in initial response
quit
-ERR [AUTH] Unsupported authentication mechanism.

src/pop3-login/client-authenticate.c

index 21716d34b43cda52c33e2d732cf4d9127dac7e93..e2158333959a02540ee2f24b4c67d52802d45445 100644 (file)
@@ -127,6 +127,15 @@ int cmd_auth(struct pop3_client *pop3_client)
                ir = t_strdup(str_c(client->auth_response));
 
        pop3_client->auth_mech_name_parsed = FALSE;
+       /* The whole AUTH line command is parsed now. The rest of the SASL
+          protocol exchange happens in login-common code. We can free the
+          current command here already, because no pop3-login code is called
+          until the authentication is finished. Also, there's currently no
+          single location that is called in pop3-login code after the
+          authentication is finished. For example it could be an auth failure
+          or it could be a successful authentication with a proxying
+          failure. */
+       i_free(pop3_client->current_cmd);
        return client_auth_begin(client, t_strdup(client->auth_mech_name), ir);
 }