Skip to content

Commit

Permalink
login-common: Avoid using client_destroy_success() when mail_max_user…
Browse files Browse the repository at this point in the history
…ip_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.
  • Loading branch information
sirainen authored and Timo Sirainen committed Nov 6, 2017
1 parent 8bcf6fd commit 1a1159e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/login-common/client-common-auth.c
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion src/login-common/client-common.c
Expand Up @@ -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')
Expand Down
1 change: 1 addition & 0 deletions src/login-common/client-common.h
Expand Up @@ -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;
Expand Down

0 comments on commit 1a1159e

Please sign in to comment.