From: Stephan Bosch Date: Fri, 14 Feb 2020 09:20:29 +0000 (+0100) Subject: lmtp: Add details to the DATA state for use in process title. X-Git-Tag: 2.3.11.2~585 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aaaf1d00c6303b996c96659c99a4d8088758db62;p=thirdparty%2Fdovecot%2Fcore.git lmtp: Add details to the DATA state for use in process title. --- diff --git a/src/lmtp/lmtp-client.c b/src/lmtp/lmtp-client.c index 95427c6b2b..5f43dfd790 100644 --- a/src/lmtp/lmtp-client.c +++ b/src/lmtp/lmtp-client.c @@ -340,6 +340,16 @@ client_connection_state_changed(void *context, refresh_proctitle(); } +void client_update_data_state(struct client *client, const char *new_args) +{ + i_assert(client->state.state == SMTP_SERVER_STATE_DATA); + i_free(client->state.args); + client->state.args = i_strdup(new_args); + + if (clients_count == 1) + refresh_proctitle(); +} + static void client_connection_proxy_data_updated(void *context, const struct smtp_proxy_data *data) diff --git a/src/lmtp/lmtp-client.h b/src/lmtp/lmtp-client.h index 50f3d54943..175a5ec17b 100644 --- a/src/lmtp/lmtp-client.h +++ b/src/lmtp/lmtp-client.h @@ -120,6 +120,7 @@ void client_disconnect(struct client *client, const char *enh_code, const char *reason) ATTR_NULL(2, 3); void client_state_reset(struct client *client); +void client_update_data_state(struct client *client, const char *new_args); void clients_destroy(void); diff --git a/src/lmtp/lmtp-local.c b/src/lmtp/lmtp-local.c index e26a9f7810..083636ea3e 100644 --- a/src/lmtp/lmtp-local.c +++ b/src/lmtp/lmtp-local.c @@ -471,6 +471,7 @@ lmtp_local_deliver(struct lmtp_local *local, io_loop_time_refresh(); lldctx.delivery_time_started = ioloop_timeval; + client_update_data_state(client, username); i_set_failure_prefix("lmtp(%s, %s): ", my_pid, username); if (mail_storage_service_next(storage_service, service_user, &rcpt_user, &error) < 0) { @@ -630,6 +631,7 @@ lmtp_local_deliver_to_rcpts(struct lmtp_local *local, struct smtp_server_transaction *trans, struct mail_deliver_session *session) { + struct client *client = local->client; uid_t first_uid = (uid_t)-1; struct mail *src_mail; struct lmtp_local_recipient *const *llrcpts; @@ -653,6 +655,7 @@ lmtp_local_deliver_to_rcpts(struct lmtp_local *local, ret = lmtp_local_deliver(local, cmd, trans, llrcpt, src_mail, session); + client_update_data_state(client, NULL); i_set_failure_prefix("lmtp(%s): ", my_pid); /* succeeded and mail_user is not saved in first_saved_mail */ diff --git a/src/lmtp/lmtp-proxy.c b/src/lmtp/lmtp-proxy.c index dd79fa5711..c98bf87d1b 100644 --- a/src/lmtp/lmtp-proxy.c +++ b/src/lmtp/lmtp-proxy.c @@ -696,6 +696,8 @@ void lmtp_proxy_data(struct client *client, i_assert(data_input->seekable); i_assert(proxy->data_input == NULL); + client_update_data_state(client, "proxying"); + proxy->data_input = data_input; i_stream_ref(proxy->data_input); if (i_stream_get_size(proxy->data_input, TRUE, &size) < 0) {