]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lmtp: Add details to the DATA state for use in process title.
authorStephan Bosch <stephan.bosch@open-xchange.com>
Fri, 14 Feb 2020 09:20:29 +0000 (10:20 +0100)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 21 Feb 2020 06:39:59 +0000 (06:39 +0000)
src/lmtp/lmtp-client.c
src/lmtp/lmtp-client.h
src/lmtp/lmtp-local.c
src/lmtp/lmtp-proxy.c

index 95427c6b2b9a9e43d708184b0d49cb40efb7f952..5f43dfd790f1a047dd74b9c61a2d5eb32c79fac2 100644 (file)
@@ -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)
index 50f3d54943f7724413cbe4b462149543ebd18a81..175a5ec17b6b44447ebe59fb608f5d986077f910 100644 (file)
@@ -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);
 
index e26a9f7810c2be5eb6cd7f5f69693c4ea0ebcf7e..083636ea3e822a5ab9024149ec291b61c95d3b91 100644 (file)
@@ -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 */
index dd79fa5711924c82536ab2f4d0c79d71b7ad7ef8..c98bf87d1bfe0f8a88da72e675de32f1daa338a4 100644 (file)
@@ -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) {