From: Timo Sirainen Date: Wed, 1 Nov 2017 19:09:56 +0000 (+0200) Subject: login-common: Avoid using client_destroy_success() when mail_max_userip_connections... X-Git-Tag: 2.3.0.rc1~550 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1a1159e589def1e32b7dc25397f15146672ef73e;p=thirdparty%2Fdovecot%2Fcore.git login-common: Avoid using client_destroy_success() when mail_max_userip_connections is reached 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. --- diff --git a/src/login-common/client-common-auth.c b/src/login-common/client-common-auth.c index 4f69de395c..d093aa0246 100644 --- a/src/login-common/client-common-auth.c +++ b/src/login-common/client-common-auth.c @@ -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); diff --git a/src/login-common/client-common.c b/src/login-common/client-common.c index 7d3a85246b..a510ddf529 100644 --- a/src/login-common/client-common.c +++ b/src/login-common/client-common.c @@ -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') diff --git a/src/login-common/client-common.h b/src/login-common/client-common.h index b633d0e27a..10e6def2b6 100644 --- a/src/login-common/client-common.h +++ b/src/login-common/client-common.h @@ -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;