dovecot-2.0: mail storage service: Added MAIL_STORAGE_SERVICE_FL...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jun 24 04:17:37 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/3f9dcaf102d1
changeset: 9523:3f9dcaf102d1
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Jun 23 21:17:32 2009 -0400
description:
mail storage service: Added MAIL_STORAGE_SERVICE_FLAG_NO_CHDIR.

diffstat:

2 files changed, 11 insertions(+), 5 deletions(-)
src/lib-storage/mail-storage-service.c |   12 ++++++++----
src/lib-storage/mail-storage-service.h |    4 +++-

diffs (57 lines):

diff -r 85912a6031a0 -r 3f9dcaf102d1 src/lib-storage/mail-storage-service.c
--- a/src/lib-storage/mail-storage-service.c	Tue Jun 23 21:15:21 2009 -0400
+++ b/src/lib-storage/mail-storage-service.c	Tue Jun 23 21:17:32 2009 -0400
@@ -350,7 +350,9 @@ mail_storage_service_init_post(struct ma
 			       const struct mail_storage_service_input *input,
 			       const char *home,
 			       const struct mail_user_settings *user_set,
-			       bool setuid_root, struct mail_user **mail_user_r,
+			       bool setuid_root,
+			       enum mail_storage_service_flags flags,
+			       struct mail_user **mail_user_r,
 			       const char **error_r)
 {
 	const struct mail_storage_settings *mail_set;
@@ -368,7 +370,8 @@ mail_storage_service_init_post(struct ma
 		/* we don't want to write core files to any users' home
 		   directories since they could contain information about other
 		   users' mails as well. so do no chdiring to home. */
-	} else if (*home != '\0') {
+	} else if (*home != '\0' &&
+		   (flags & MAIL_STORAGE_SERVICE_FLAG_NO_CHDIR) == 0) {
 		/* If possible chdir to home directory, so that core file
 		   could be written in case we crash. */
 		if (chdir(home) < 0) {
@@ -583,7 +586,8 @@ init_user_real(struct master_service *se
 	module_dir_init(modules);
 	mail_users_init(user_set->auth_socket_path, mail_set->mail_debug);
 	if (mail_storage_service_init_post(service, &input, home, user_set,
-					   FALSE, &mail_user, &error) < 0)
+					   FALSE, flags,
+					   &mail_user, &error) < 0)
 		i_fatal("%s", error);
 	return mail_user;
 }
@@ -731,7 +735,7 @@ int mail_storage_service_multi_next(stru
 			t_strconcat(user_set->mail_chroot, "/", home, NULL));
 	}
 	if (mail_storage_service_init_post(ctx->service, &user->input,
-					   home, user_set, TRUE,
+					   home, user_set, TRUE, ctx->flags,
 					   mail_user_r, error_r) < 0)
 		return -1;
 	return 0;
diff -r 85912a6031a0 -r 3f9dcaf102d1 src/lib-storage/mail-storage-service.h
--- a/src/lib-storage/mail-storage-service.h	Tue Jun 23 21:15:21 2009 -0400
+++ b/src/lib-storage/mail-storage-service.h	Tue Jun 23 21:17:32 2009 -0400
@@ -13,7 +13,9 @@ enum mail_storage_service_flags {
 	/* Force mail_debug=yes */
 	MAIL_STORAGE_SERVICE_FLAG_DEBUG			= 0x04,
 	/* Keep the current process permissions */
-	MAIL_STORAGE_SERVICE_FLAG_NO_RESTRICT_ACCESS	= 0x08
+	MAIL_STORAGE_SERVICE_FLAG_NO_RESTRICT_ACCESS	= 0x08,
+	/* Don't chdir() to user's home */
+	MAIL_STORAGE_SERVICE_FLAG_NO_CHDIR		= 0x10
 };
 
 struct mail_storage_service_input {


More information about the dovecot-cvs mailing list