]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
login-common: Avoid using client_destroy_success() when mail_max_userip_connections...
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 1 Nov 2017 19:09:56 +0000 (21:09 +0200)
committerTimo Sirainen <tss@dovecot.fi>
Mon, 6 Nov 2017 23:09:00 +0000 (01:09 +0200)
This was currently the only way how data != NULL here.

This change destroys ssl_proxy on client_destroy() instead of
client_unref(), but that doesn't make much of a practical difference. This
new behavior is a bit more correct though.

src/login-common/client-common-auth.c
src/login-common/client-common.c
src/login-common/client-common.h

index 4f69de395c52c280e5e76277f8657cb8f908ee20..d093aa0246e09b6d57163396736163cfcd9dce69 100644 (file)
@@ -729,8 +729,11 @@ sasl_callback(struct client *client, enum sasl_server_reply sasl_reply,
 
                if (data == NULL)
                        client_destroy_internal_failure(client);
-               else
-                       client_destroy_success(client, data);
+               else {
+                       /* e.g. mail_max_userip_connections is reached */
+                       client->no_extra_disconnect_reason = TRUE;
+                       client_destroy(client, data);
+               }
                break;
        case SASL_SERVER_REPLY_CONTINUE:
                i_assert(client->v.auth_send_challenge != NULL);
index 7d3a85246b6e1a6f653dfb8ff1dbcff2fd079497..a510ddf5299218a8cef70ed4e06dc8c930844fd3 100644 (file)
@@ -232,7 +232,8 @@ void client_destroy(struct client *client, const char *reason)
 
        pool_unref(&client->preproxy_pool);
 
-       if (!client->login_success && reason != NULL) {
+       if (!client->login_success &&
+           !client->no_extra_disconnect_reason && reason != NULL) {
                const char *extra_reason =
                        client_get_extra_disconnect_reason(client);
                if (extra_reason[0] != '\0')
index b633d0e27a17794aaafab5da83fca00e8aa07feb..10e6def2b6066b7a4ff9408132f3dbf06208af56 100644 (file)
@@ -199,6 +199,7 @@ struct client {
        bool destroyed:1;
        bool input_blocked:1;
        bool login_success:1;
+       bool no_extra_disconnect_reason:1;
        bool starttls:1;
        bool tls:1;
        bool secured:1;