changeset 12705:0fc2d00f83df

lib-storage: Fixed handling chroot/home for services that don't really chroot (lmtp).
author Timo Sirainen <tss@iki.fi>
date Thu, 20 Jan 2011 23:09:44 +0200
parents a3a7cc0172fd
children 5a3c87124066
files src/lib-storage/mail-storage-service.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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)