From: Timo Sirainen Date: Wed, 1 Nov 2017 19:15:53 +0000 (+0200) Subject: login-common: Move code in client_destroy_internal_failure() to its only caller X-Git-Tag: 2.3.0.rc1~549 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=86bca14f79caeff0830abd2315d8a0e5db4b979b;p=thirdparty%2Fdovecot%2Fcore.git login-common: Move code in client_destroy_internal_failure() to its only caller No need to have a function that has only a single caller. --- diff --git a/src/login-common/client-common-auth.c b/src/login-common/client-common-auth.c index d093aa0246..752b5efcd0 100644 --- a/src/login-common/client-common-auth.c +++ b/src/login-common/client-common-auth.c @@ -727,13 +727,19 @@ sasl_callback(struct client *client, enum sasl_server_reply sasl_reply, if (shutdown(client->fd, SHUT_RDWR) < 0 && errno != ENOTCONN) i_error("shutdown() failed: %m"); - if (data == NULL) - client_destroy_internal_failure(client); - else { + if (data != NULL) { /* e.g. mail_max_userip_connections is reached */ - client->no_extra_disconnect_reason = TRUE; - client_destroy(client, data); + } else { + /* The error should have been logged already. + The client will only see a generic internal error. */ + client_notify_disconnect(client, CLIENT_DISCONNECT_INTERNAL_ERROR, + "Internal login failure. " + "Refer to server log for more information."); + data = t_strdup_printf("Internal login failure (pid=%s id=%u)", + my_pid, client->master_auth_id); } + 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 a510ddf529..412c9cd730 100644 --- a/src/login-common/client-common.c +++ b/src/login-common/client-common.c @@ -308,16 +308,6 @@ void client_destroy_success(struct client *client, const char *reason) client_destroy(client, reason); } -void client_destroy_internal_failure(struct client *client) -{ - client_notify_disconnect(client, CLIENT_DISCONNECT_INTERNAL_ERROR, - "Internal login failure. " - "Refer to server log for more information."); - client_destroy(client, t_strdup_printf( - "Internal login failure (pid=%s id=%u)", - my_pid, client->master_auth_id)); -} - void client_ref(struct client *client) { client->refcount++; diff --git a/src/login-common/client-common.h b/src/login-common/client-common.h index 10e6def2b6..6a84c8f09b 100644 --- a/src/login-common/client-common.h +++ b/src/login-common/client-common.h @@ -244,7 +244,6 @@ client_create(int fd, bool ssl, pool_t pool, void **other_sets); void client_destroy(struct client *client, const char *reason); void client_destroy_success(struct client *client, const char *reason); -void client_destroy_internal_failure(struct client *client); void client_ref(struct client *client); bool client_unref(struct client **client) ATTR_NOWARN_UNUSED_RESULT;