Mercurial > dovecot > original-hg > dovecot-1.2
changeset 4190:19fc27f57b0c HEAD
Unless nfs_check=no or mmap_disable=yes, check for the first login if the
user's index directory exists in NFS mount. If so, refuse to run. This is
done only on first login to avoid constant extra overhead.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 14 Apr 2006 13:52:55 +0300 |
parents | 1fb345878e1b |
children | c75fb8c60672 |
files | src/master/mail-process.c src/master/master-settings.c src/master/master-settings.h |
diffstat | 3 files changed, 47 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/master/mail-process.c Fri Apr 14 13:27:55 2006 +0300 +++ b/src/master/mail-process.c Fri Apr 14 13:52:55 2006 +0300 @@ -6,6 +6,7 @@ #include "env-util.h" #include "str.h" #include "network.h" +#include "mountpoint.h" #include "restrict-access.h" #include "restrict-process-size.h" #include "var-expand.h" @@ -334,6 +335,43 @@ set->mail_executable); } +static void nfs_warn_if_found(const char *mail, const char *home) +{ + struct mountpoint point; + const char *path; + + if (mail == NULL) + path = home; + else { + path = strstr(mail, ":INDEX="); + if (path != NULL) { + /* indexes set separately */ + path += 7; + if (strncmp(path, "MEMORY", 6) == 0) + return; + } else { + path = strchr(mail, ':'); + if (path == NULL) { + /* autodetection for path */ + } else { + /* format:path */ + path++; + } + } + path = t_strcut(path, ':'); + } + + if (mountpoint_get(path, pool_datastack_create(), &point) <= 0) + return; + + if (point.type == NULL || strcasecmp(point.type, "NFS") != 0) + return; + + i_fatal("Mailbox indexes in %s are in NFS mount. " + "You must set mmap_disable=yes to avoid index corruptions. " + "If you're sure this check was wrong, set nfs_check=no.", path); +} + bool create_mail_process(struct login_group *group, int socket, const struct ip_addr *local_ip, const struct ip_addr *remote_ip, @@ -530,6 +568,12 @@ } } + if (set->nfs_check && !set->mmap_disable) { + /* do this only once */ + nfs_warn_if_found(getenv("MAIL"), home_dir); + set->nfs_check = FALSE; + } + env_put("LOGGED_IN=1"); env_put(t_strconcat("HOME=", home_dir, NULL)); env_put(t_strconcat("USER=", user, NULL));
--- a/src/master/master-settings.c Fri Apr 14 13:27:55 2006 +0300 +++ b/src/master/master-settings.c Fri Apr 14 13:52:55 2006 +0300 @@ -72,6 +72,7 @@ DEF(SET_BOOL, disable_plaintext_auth), DEF(SET_BOOL, verbose_ssl), DEF(SET_BOOL, shutdown_clients), + DEF(SET_BOOL, nfs_check), /* login */ DEF(SET_STR, login_dir), @@ -277,6 +278,7 @@ MEMBER(disable_plaintext_auth) TRUE, MEMBER(verbose_ssl) FALSE, MEMBER(shutdown_clients) TRUE, + MEMBER(nfs_check) TRUE, /* login */ MEMBER(login_dir) "login",