]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dsync: Execute remote dsync binary before dropping privileges.
authorTimo Sirainen <tss@iki.fi>
Mon, 23 Aug 2010 13:30:08 +0000 (14:30 +0100)
committerTimo Sirainen <tss@iki.fi>
Mon, 23 Aug 2010 13:30:08 +0000 (14:30 +0100)
src/dsync/dsync.c

index 12957690e13e5fbab695f5164ee0b6261dfa79b5..01c53363e23b81efec0e9cb077ead2f605ba5755 100644 (file)
@@ -243,16 +243,18 @@ int main(int argc, char *argv[])
        if (mail_storage_service_lookup(storage_service, &input,
                                        &service_user, &error) <= 0)
                i_fatal("User lookup failed: %s", error);
-       if (mail_storage_service_next(storage_service, service_user,
-                                     &mail_user) < 0)
-               i_fatal("User init failed");
 
        if (remote_cmd_args != NULL) {
-               /* user initialization may exec doveconf, so do our forking
-                  after that */
+               /* _service_lookup() may exec doveconf, so do our forking
+                  after that. but do it before _service_next() in case it
+                  drops process privileges */
                run_cmd(remote_cmd_args, &fd_in, &fd_out);
        }
 
+       if (mail_storage_service_next(storage_service, service_user,
+                                     &mail_user) < 0)
+               i_fatal("User init failed");
+
        /* create the first local worker */
        worker1 = dsync_worker_init_local(mail_user, alt_char);
        if (local_location != NULL) {