From 70b818d9b32857da890398b7558f22f085125a22 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 22 Aug 2024 13:49:13 +0300 Subject: [PATCH] lib-program-client: Add program_client_parameters.append_args --- src/lib-program-client/program-client.c | 9 +++++++++ src/lib-program-client/program-client.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/lib-program-client/program-client.c b/src/lib-program-client/program-client.c index fbc75c28aa..5c2bfd4308 100644 --- a/src/lib-program-client/program-client.c +++ b/src/lib-program-client/program-client.c @@ -801,6 +801,15 @@ program_client_create_filter_auto(struct event *event, const char *execute_name, } const char *const *args = t_strsplit_spaces(set->execute_args, " "); + if (params->append_args != NULL) { + ARRAY_TYPE(const_string) new_args; + t_array_init(&new_args, 8); + array_append(&new_args, args, str_array_length(args)); + array_append(&new_args, params->append_args, + str_array_length(params->append_args)); + array_append_zero(&new_args); + args = array_front(&new_args); + } if (strcmp(set->execute_driver, "unix") == 0) { *pc_r = program_client_unix_create(event, set->execute_unix_socket_path, args, params); diff --git a/src/lib-program-client/program-client.h b/src/lib-program-client/program-client.h index f38fb54785..c460da9bb0 100644 --- a/src/lib-program-client/program-client.h +++ b/src/lib-program-client/program-client.h @@ -16,6 +16,8 @@ struct program_client_parameters { unsigned int client_connect_timeout_msecs; unsigned int input_idle_timeout_msecs; const char *dns_client_socket_path; + /* Append extra args to execute_args */ + const char *const *append_args; /* use o_stream_dot, which is mainly useful to make sure that an unexpectedly closed connection doesn't cause the partial input to -- 2.47.3