From: Markus Valentin Date: Thu, 9 Mar 2023 09:58:42 +0000 (+0100) Subject: login-common: client_get_extra_disconnect_reason() - Add shutting_down and process_fu... X-Git-Tag: 2.4.0~2890 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd7545cfeba8f7c77b1e507c4876c287fc7c4d9f;p=thirdparty%2Fdovecot%2Fcore.git login-common: client_get_extra_disconnect_reason() - Add shutting_down and process_full reasons --- diff --git a/src/login-common/client-common.c b/src/login-common/client-common.c index 028929bd51..285d875b6d 100644 --- a/src/login-common/client-common.c +++ b/src/login-common/client-common.c @@ -1182,6 +1182,19 @@ bool client_get_extra_disconnect_reason(struct client *client, return TRUE; } + if (client->shutting_down) { + if (client->resource_constraint) { + *event_reason_r = "process_full"; + *human_reason_r = "client_limit and process_limit was hit" + " and this login session was killed."; + } else { + *event_reason_r = "shutting_down"; + *human_reason_r = "The process is shutting down so the" + " login is aborted."; + } + return TRUE; + } + /* Check for missing client SSL certificates before auth attempts. We may have advertised LOGINDISABLED, which would have prevented client from even attempting to authenticate. */ @@ -1272,12 +1285,16 @@ void client_notify_disconnect(struct client *client, if (!client->notified_disconnect) { if (client->v.notify_disconnect != NULL) client->v.notify_disconnect(client, reason, text); - if (reason == CLIENT_DISCONNECT_SYSTEM_SHUTDOWN) { - client->shutting_down = TRUE; - } - if (reason == CLIENT_DISCONNECT_RESOURCE_CONSTRAINT) { - client->shutting_down = TRUE; + switch (reason) { + case CLIENT_DISCONNECT_RESOURCE_CONSTRAINT: client->resource_constraint = TRUE; + /* fall through */ + case CLIENT_DISCONNECT_SYSTEM_SHUTDOWN: + client->shutting_down = TRUE; + break; + case CLIENT_DISCONNECT_TIMEOUT: + case CLIENT_DISCONNECT_INTERNAL_ERROR: + break; } client->notified_disconnect = TRUE; }