]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Fixed handling chroot/home for services that don't really chroot (lmtp).
authorTimo Sirainen <tss@iki.fi>
Thu, 20 Jan 2011 21:09:44 +0000 (23:09 +0200)
committerTimo Sirainen <tss@iki.fi>
Thu, 20 Jan 2011 21:09:44 +0000 (23:09 +0200)
src/lib-storage/mail-storage-service.c

index 3a9db4ef86b6ccae732f308958ac4e5e9f622558..201a153f71051b6821133985942fa446313e2757 100644 (file)
@@ -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)