Mercurial > dovecot > core-2.2
changeset 9523:3f9dcaf102d1 HEAD
mail storage service: Added MAIL_STORAGE_SERVICE_FLAG_NO_CHDIR.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 23 Jun 2009 21:17:32 -0400 |
parents | 85912a6031a0 |
children | 498965c87314 |
files | src/lib-storage/mail-storage-service.c src/lib-storage/mail-storage-service.h |
diffstat | 2 files changed, 11 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ 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 @@ /* 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 @@ 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 @@ 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;
--- 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 @@ /* 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 {