]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
*-login: Remove redundant/early freeing of proxy_password
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 6 May 2020 13:26:34 +0000 (16:26 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 25 May 2020 08:38:55 +0000 (08:38 +0000)
The login-common code already does this after the proxying has failed or
succeeded. Having these duplicate frees immediately after sending the
password isn't all that useful, and most importantly they make it
impossible to reconnect after the password has been sent.

src/imap-login/imap-proxy.c
src/pop3-login/pop3-proxy.c
src/submission-login/submission-proxy.c

index c0951f02fe00df9d072448a2bcb1c2e21d2054fd..afcd8a6e9c1a414c27af14ec97fbc64da0eaa7e6 100644 (file)
@@ -65,15 +65,6 @@ static void proxy_write_id(struct imap_client *client, string_t *str)
        str_append(str, ")\r\n");
 }
 
-static void proxy_free_password(struct client *client)
-{
-       if (client->proxy_password == NULL)
-               return;
-
-       safe_memset(client->proxy_password, 0, strlen(client->proxy_password));
-       i_free_and_null(client->proxy_password);
-}
-
 static int proxy_write_starttls(struct imap_client *client, string_t *str)
 {
        enum login_proxy_ssl_flags ssl_flags = login_proxy_get_ssl_flags(client->common.login_proxy);
@@ -135,7 +126,6 @@ static int proxy_write_login(struct imap_client *client, string_t *str)
                str_append(str, "\r\n");
 
                client->proxy_sent_state |= IMAP_PROXY_SENT_STATE_LOGIN;
-               proxy_free_password(&client->common);
                return 0;
        }
 
@@ -169,7 +159,6 @@ static int proxy_write_login(struct imap_client *client, string_t *str)
                        base64_encode(output, len, str);
        }
        str_append(str, "\r\n");
-       proxy_free_password(&client->common);
        client->proxy_sent_state |= IMAP_PROXY_SENT_STATE_AUTHENTICATE;
        return 0;
 }
index 43cf99afaa9b841d31b3a6e31b352eeaadee5182..de04ae7c60a1744774df9e95025aea41015560a2 100644 (file)
@@ -17,15 +17,6 @@ static const char *pop3_proxy_state_names[POP3_PROXY_STATE_COUNT] = {
        "banner", "starttls", "xclient", "login1", "login2"
 };
 
-static void proxy_free_password(struct client *client)
-{
-       if (client->proxy_password == NULL)
-               return;
-
-       safe_memset(client->proxy_password, 0, strlen(client->proxy_password));
-       i_free_and_null(client->proxy_password);
-}
-
 static int proxy_send_login(struct pop3_client *client, struct ostream *output)
 {
        struct dsasl_client_settings sasl_set;
@@ -102,7 +93,6 @@ static int proxy_send_login(struct pop3_client *client, struct ostream *output)
        str_append(str, "\r\n");
        o_stream_nsend(output, str_data(str), str_len(str));
 
-       proxy_free_password(&client->common);
        if (client->proxy_state != POP3_PROXY_XCLIENT)
                client->proxy_state = POP3_PROXY_LOGIN2;
        return 0;
@@ -219,7 +209,6 @@ int pop3_proxy_parse_line(struct client *client, const char *line)
                /* USER successful, send PASS */
                o_stream_nsend_str(output, t_strdup_printf(
                        "PASS %s\r\n", client->proxy_password));
-               proxy_free_password(client);
                pop3_client->proxy_state = POP3_PROXY_LOGIN2;
                return 0;
        case POP3_PROXY_LOGIN2:
index 95a3f8928bb94f5c99670605fe1cbca55bd6ad25..652d041c44624d97c399c168f0748256f8b07b7e 100644 (file)
@@ -21,15 +21,6 @@ static const char *submission_proxy_state_names[SUBMISSION_PROXY_STATE_COUNT] =
        "banner", "ehlo", "starttls", "tls-ehlo", "xclient", "authenticate"
 };
 
-static void proxy_free_password(struct client *client)
-{
-       if (client->proxy_password == NULL)
-               return;
-
-       safe_memset(client->proxy_password, 0, strlen(client->proxy_password));
-       i_free_and_null(client->proxy_password);
-}
-
 static buffer_t *
 proxy_compose_xclient_forward(struct submission_client *client)
 {
@@ -144,8 +135,6 @@ proxy_send_login(struct submission_client *client, struct ostream *output)
        str_append(str, "\r\n");
        o_stream_nsend(output, str_data(str), str_len(str));
 
-       proxy_free_password(&client->common);
-
        if (client->proxy_state != SUBMISSION_PROXY_XCLIENT)
                client->proxy_state = SUBMISSION_PROXY_AUTHENTICATE;
        return 0;