]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: smtp-client-connection - Move auth cleanup to separate function.
authorStephan Bosch <stephan.bosch@open-xchange.com>
Fri, 21 Jan 2022 01:26:18 +0000 (02:26 +0100)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 31 Jan 2022 06:41:58 +0000 (06:41 +0000)
src/lib-smtp/smtp-client-connection.c

index b9a0a3455e8c4c692609b1554155a90fb4f73002..c7eefd126ed7d019d0e6d05ea43b3ff853cfca3e 100644 (file)
@@ -717,6 +717,12 @@ smtp_client_connection_clear_password(struct smtp_client_connection *conn)
        conn->password = NULL;
 }
 
+static void
+smtp_client_connection_auth_deinit(struct smtp_client_connection *conn)
+{
+       dsasl_client_free(&conn->sasl_client);
+}
+
 static void
 smtp_client_connection_auth_cb(const struct smtp_reply *reply,
                               struct smtp_client_connection *conn)
@@ -782,9 +788,9 @@ smtp_client_connection_auth_cb(const struct smtp_reply *reply,
        }
 
        smtp_client_connection_clear_password(conn);
+       smtp_client_connection_auth_deinit(conn);
 
        e_debug(conn->event, "Authenticated successfully");
-       dsasl_client_free(&conn->sasl_client);
 
        if (conn->to_connect != NULL)
                timeout_reset(conn->to_connect);
@@ -2008,7 +2014,7 @@ void smtp_client_connection_disconnect(struct smtp_client_connection *conn)
        ssl_iostream_destroy(&conn->ssl_iostream);
        if (conn->ssl_ctx != NULL)
                ssl_iostream_context_unref(&conn->ssl_ctx);
-       dsasl_client_free(&conn->sasl_client);
+       smtp_client_connection_auth_deinit(conn);
 
        o_stream_destroy(&conn->dot_output);