dovecot-2.0: lib-storage: Fixed handling chroot/home for service...

dovecot at dovecot.org dovecot at dovecot.org
Thu Jan 20 23:09:47 EET 2011


details:   http://hg.dovecot.org/dovecot-2.0/rev/0fc2d00f83df
changeset: 12570:0fc2d00f83df
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Jan 20 23:09:44 2011 +0200
description:
lib-storage: Fixed handling chroot/home for services that don't really chroot (lmtp).

diffstat:

 src/lib-storage/mail-storage-service.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r a3a7cc0172fd -r 0fc2d00f83df src/lib-storage/mail-storage-service.c
--- a/src/lib-storage/mail-storage-service.c	Wed Jan 19 20:06:39 2011 +0000
+++ b/src/lib-storage/mail-storage-service.c	Thu Jan 20 23:09:44 2011 +0200
@@ -891,8 +891,12 @@
 	} 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)


More information about the dovecot-cvs mailing list