From: Timo Sirainen Date: Mon, 9 Jan 2023 22:13:43 +0000 (+0200) Subject: doveadm sync: Use the main process's configuration for dsync-server process X-Git-Tag: 2.4.0~3067 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ca6157f384a9359923ac9566f9bb81b37a5defe;p=thirdparty%2Fdovecot%2Fcore.git doveadm sync: Use the main process's configuration for dsync-server process This preserves the old behavior. --- diff --git a/src/doveadm/doveadm-dsync.c b/src/doveadm/doveadm-dsync.c index f029406800..14b6903ebc 100644 --- a/src/doveadm/doveadm-dsync.c +++ b/src/doveadm/doveadm-dsync.c @@ -14,10 +14,12 @@ #include "str.h" #include "strescape.h" #include "str-parse.h" +#include "env-util.h" #include "var-expand.h" #include "process-title.h" #include "settings-parser.h" #include "imap-util.h" +#include "master-interface.h" #include "master-service.h" #include "master-service-settings.h" #include "master-service-ssl-settings.h" @@ -198,6 +200,14 @@ run_cmd(struct dsync_cmd_context *ctx, const char *const *args) dup2(fd_err[1], STDERR_FILENO) < 0) i_fatal("dup2() failed: %m"); + /* If doveadm is executed locally, use the already parsed + configuration. This also means that the dsync-server will + use the same configuration as the main process without + having to provide the same -c (etc.) parameters. */ + int config_fd = doveadm_settings_get_config_fd(); + fd_close_on_exec(config_fd, FALSE); + env_put(DOVECOT_CONFIG_FD_ENV, dec2str(config_fd)); + i_close_fd(&fd_in[0]); i_close_fd(&fd_in[1]); i_close_fd(&fd_out[0]);