From: Timo Sirainen Date: Thu, 9 Mar 2017 15:48:33 +0000 (-0500) Subject: pop3-login: Remove usage of client.common.proxy_state X-Git-Tag: 2.3.0.rc1~1958 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=339726ad7f9f8b787ced3cd12042d0c29938de3d;p=thirdparty%2Fdovecot%2Fcore.git pop3-login: Remove usage of client.common.proxy_state --- diff --git a/src/pop3-login/client.h b/src/pop3-login/client.h index f92f70ad00..498fe82e19 100644 --- a/src/pop3-login/client.h +++ b/src/pop3-login/client.h @@ -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; }; diff --git a/src/pop3-login/pop3-proxy.c b/src/pop3-login/pop3-proxy.c index d589cce45d..560c57a994 100644 --- a/src/pop3-login/pop3-proxy.c +++ b/src/pop3-login/pop3-proxy.c @@ -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]; }