From ba02cf1dae8acbe439f79085603bb93a870cce34 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 20 Jan 2011 23:09:44 +0200 Subject: [PATCH] lib-storage: Fixed handling chroot/home for services that don't really chroot (lmtp). --- src/lib-storage/mail-storage-service.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib-storage/mail-storage-service.c b/src/lib-storage/mail-storage-service.c index 3a9db4ef86..201a153f71 100644 --- a/src/lib-storage/mail-storage-service.c +++ b/src/lib-storage/mail-storage-service.c @@ -891,8 +891,12 @@ int mail_storage_service_next(struct mail_storage_service_ctx *ctx, } else if (len > 0 && temp_priv_drop) { /* we're dropping privileges only temporarily, so we can't chroot. fix home directory so we can access it. */ - set_keyval(ctx, user, "mail_home", - t_strconcat(chroot, "/", home, NULL)); + if (*home == '\0' || strcmp(home, "/") == 0) + home = chroot; + else + home = t_strconcat(chroot, home, NULL); + chroot = ""; + set_keyval(ctx, user, "mail_home", home); } if ((ctx->flags & MAIL_STORAGE_SERVICE_FLAG_NO_LOG_INIT) == 0) -- 2.47.3