]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
pop3-login: Use struct client authenticating member
authorAki Tuomi <aki.tuomi@open-xchange.com>
Thu, 9 Jul 2020 06:38:37 +0000 (09:38 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 10 Jul 2020 06:58:10 +0000 (09:58 +0300)
This is what should be used instead of introducing our own.

Broken in 6c55437036b3de11804eb68f66d84cb164c33d63

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

index be202f03327cf62f98acbb9416b3449fb001a564..e50e45c1d1fec86f198ba00c3a2128ec04d72f76 100644 (file)
@@ -121,6 +121,7 @@ int cmd_auth(struct pop3_client *pop3_client, bool *parsed_r)
                i_stream_skip(client->input, i);
        }
 
+       client->authenticating = TRUE;
        /* get SASL-IR, if any */
        if ((ret = client_auth_read_line(client)) <= 0)
                return ret;
index a17bdb2e775ce98c8733dab19cb91416943459ed..082b5e389a32ce95b32922ea6d7284368043c33f 100644 (file)
@@ -117,7 +117,16 @@ static bool client_command_execute(struct pop3_client *client, const char *cmd,
 
 static void pop3_client_input(struct client *client)
 {
-       i_assert(!client->authenticating);
+       if (client->authenticating) {
+               struct pop3_client *pop3_client =
+                       container_of(client, struct pop3_client, common);
+               bool parsed;
+               cmd_auth(pop3_client, &parsed);
+               if (!parsed)
+                       client->authenticating = FALSE;
+               else
+                       return;
+       }
 
        if (!client_read(client))
                return;
@@ -169,16 +178,13 @@ static bool pop3_client_input_next_cmd(struct client *client)
        const char *cmd, *args;
        bool parsed;
 
-       if (!pop3_client->authenticating && !client_read_cmd_name(client, &cmd))
+       if (!client_read_cmd_name(client, &cmd))
                return FALSE;
 
-       if (pop3_client->authenticating ||
-           strcmp(cmd, "AUTH") == 0) {
-               pop3_client->authenticating = TRUE;
+       if (strcmp(cmd, "AUTH") == 0) {
                int ret = cmd_auth(pop3_client, &parsed);
                if (ret == 0 || !parsed)
                        return FALSE;
-               pop3_client->authenticating = !parsed;
                return parsed;
        }
 
index 7a24f54fa11c7320a76cac5ef564f17bd5fe117c..f052623a9f244c59a0844d21f824b9c72030d87a 100644 (file)
@@ -24,7 +24,6 @@ struct pop3_client {
        enum pop3_proxy_state proxy_state;
        bool proxy_xclient;
        bool auth_mech_name_parsed;
-       bool authenticating;
 };
 
 enum pop3_cmd_reply {