From: Timo Sirainen Date: Mon, 23 Aug 2010 13:30:08 +0000 (+0100) Subject: dsync: Execute remote dsync binary before dropping privileges. X-Git-Tag: 2.0.1~17 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e4e9e0dcb26b327d65b232cc91957aa71c86a2de;p=thirdparty%2Fdovecot%2Fcore.git dsync: Execute remote dsync binary before dropping privileges. --- diff --git a/src/dsync/dsync.c b/src/dsync/dsync.c index 12957690e1..01c53363e2 100644 --- a/src/dsync/dsync.c +++ b/src/dsync/dsync.c @@ -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) {