]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
pop3-login: Remove usage of client.common.proxy_state
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 9 Mar 2017 15:48:33 +0000 (10:48 -0500)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 9 Mar 2017 16:44:02 +0000 (11:44 -0500)
src/pop3-login/client.h
src/pop3-login/pop3-proxy.c

index f92f70ad00c0e7d1e7980f4dda7a8dfba5fb2115..498fe82e194d99a5c404577f9bc11d89c494f69f 100644 (file)
@@ -21,6 +21,7 @@ struct pop3_client {
        char *last_user;
        char *apop_challenge;
        unsigned int apop_server_pid, apop_connect_uid;
+       enum pop3_proxy_state proxy_state;
        bool proxy_xclient;
 };
 
index d589cce45da23ea0ddf76bb11c21f4aa0770ff1a..560c57a994471413d2b8138426a0ba69236ec319 100644 (file)
@@ -43,9 +43,9 @@ static int proxy_send_login(struct pop3_client *client, struct ostream *output)
                        client->common.remote_port,
                        client_get_session_id(&client->common),
                        client->common.proxy_ttl - 1));
-               client->common.proxy_state = POP3_PROXY_XCLIENT;
+               client->proxy_state = POP3_PROXY_XCLIENT;
        } else {
-               client->common.proxy_state = POP3_PROXY_LOGIN1;
+               client->proxy_state = POP3_PROXY_LOGIN1;
        }
 
        str = t_str_new(128);
@@ -84,8 +84,8 @@ static int proxy_send_login(struct pop3_client *client, struct ostream *output)
        o_stream_nsend(output, str_data(str), str_len(str));
 
        proxy_free_password(&client->common);
-       if (client->common.proxy_state != POP3_PROXY_XCLIENT)
-               client->common.proxy_state = POP3_PROXY_LOGIN2;
+       if (client->proxy_state != POP3_PROXY_XCLIENT)
+               client->proxy_state = POP3_PROXY_LOGIN2;
        return 0;
 }
 
@@ -135,7 +135,7 @@ int pop3_proxy_parse_line(struct client *client, const char *line)
        i_assert(!client->destroyed);
 
        output = login_proxy_get_ostream(client->login_proxy);
-       switch (client->proxy_state) {
+       switch (pop3_client->proxy_state) {
        case POP3_PROXY_BANNER:
                /* this is a banner */
                if (strncmp(line, "+OK", 3) != 0) {
@@ -156,7 +156,7 @@ int pop3_proxy_parse_line(struct client *client, const char *line)
                        }
                } else {
                        o_stream_nsend_str(output, "STLS\r\n");
-                       client->proxy_state = POP3_PROXY_STARTTLS;
+                       pop3_client->proxy_state = POP3_PROXY_STARTTLS;
                }
                return 0;
        case POP3_PROXY_STARTTLS:
@@ -186,7 +186,7 @@ int pop3_proxy_parse_line(struct client *client, const char *line)
                        client_proxy_failed(client, TRUE);
                        return -1;
                }
-               client->proxy_state = client->proxy_sasl_client == NULL ?
+               pop3_client->proxy_state = client->proxy_sasl_client == NULL ?
                        POP3_PROXY_LOGIN1 : POP3_PROXY_LOGIN2;
                return 0;
        case POP3_PROXY_LOGIN1:
@@ -198,7 +198,7 @@ int pop3_proxy_parse_line(struct client *client, const char *line)
                o_stream_nsend_str(output, t_strdup_printf(
                        "PASS %s\r\n", client->proxy_password));
                proxy_free_password(client);
-               client->proxy_state = POP3_PROXY_LOGIN2;
+               pop3_client->proxy_state = POP3_PROXY_LOGIN2;
                return 0;
        case POP3_PROXY_LOGIN2:
                if (strncmp(line, "+ ", 2) == 0 &&
@@ -258,7 +258,9 @@ int pop3_proxy_parse_line(struct client *client, const char *line)
 
 void pop3_proxy_reset(struct client *client)
 {
-       client->proxy_state = POP3_PROXY_BANNER;
+       struct pop3_client *pop3_client = (struct pop3_client *)client;
+
+       pop3_client->proxy_state = POP3_PROXY_BANNER;
 }
 
 void pop3_proxy_error(struct client *client, const char *text)
@@ -268,5 +270,7 @@ void pop3_proxy_error(struct client *client, const char *text)
 
 const char *pop3_proxy_get_state(struct client *client)
 {
-       return pop3_proxy_state_names[client->proxy_state];
+       struct pop3_client *pop3_client = (struct pop3_client *)client;
+
+       return pop3_proxy_state_names[pop3_client->proxy_state];
 }