]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm sync: Use the main process's configuration for dsync-server process
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 9 Jan 2023 22:13:43 +0000 (00:13 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 27 Jan 2023 13:01:47 +0000 (13:01 +0000)
This preserves the old behavior.

src/doveadm/doveadm-dsync.c

index f029406800b5dfeb5dbca7d8ff8a6ae63bf19471..14b6903ebc2faab0a298d0c1c0a1413ab90bbf7e 100644 (file)
 #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]);