changeset 4701:190a66df2f82 HEAD

Renamed default_mail_env to mail_location. Keep the default_mail_env working anyway for backwards compatibility.
author Timo Sirainen <tss@iki.fi>
date Tue, 17 Oct 2006 13:55:56 +0300
parents 779bd2a6dcc1
children 11f080e5eff4
files dovecot-example.conf src/deliver/deliver.c src/master/mail-process.c src/master/master-settings.c src/master/master-settings.h
diffstat 5 files changed, 33 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/dovecot-example.conf	Mon Oct 16 14:12:40 2006 +0300
+++ b/dovecot-example.conf	Tue Oct 17 13:55:56 2006 +0300
@@ -179,9 +179,16 @@
 ## Mailbox locations and namespaces
 ##
 
-# Default MAIL environment to use when it's not set. By leaving this empty
-# dovecot tries to do some automatic detection as described in
-# doc/mail-storages.txt. There are a few special variables you can use, eg.:
+# Location for users' mailboxes. This is the same as the old default_mail_env
+# setting. The default is empty, which means that Dovecot tries to find the
+# mailboxes automatically. This won't work if the user doesn't have any mail
+# yet, so you should explicitly tell Dovecot the full location.
+#
+# If you're using mbox, giving a path to INBOX file (eg. /var/mail/%u) isn't
+# enough. You'll also need to tell Dovecot where the other mailboxes are and
+# where Dovecot can place its index files.
+#
+# There are a few special variables you can use, eg.:
 #
 #   %u - username
 #   %n - user part in user@domain, same as %u if there's no domain
@@ -190,11 +197,13 @@
 #
 # See doc/variables.txt for full list. Some examples:
 #
-#   default_mail_env = maildir:/var/mail/%1u/%u/Maildir
-#   default_mail_env = mbox:~/mail/:INBOX=/var/mail/%u
-#   default_mail_env = mbox:/var/mail/%d/%n/:INDEX=/var/indexes/%d/%n
+#   mail_location = maildir:/var/mail/%1u/%u/Maildir
+#   mail_location = mbox:~/mail/:INBOX=/var/mail/%u
+#   mail_location = mbox:/var/mail/%d/%n/:INDEX=/var/indexes/%d/%n
 #
-#default_mail_env = 
+# http://wiki.dovecot.org/MailLocation
+#
+#mail_location = 
 
 # If you need to set multiple mailbox locations or want to change default
 # namespace settings, you can do it by defining namespace sections:
@@ -206,7 +215,7 @@
 # accessible mailboxes.
 #
 # REMEMBER: If you add any namespaces, the default namespace must be added
-# explicitly, ie. default_mail_env does nothing unless you have a namespace
+# explicitly, ie. mail_location does nothing unless you have a namespace
 # without a location setting. Default namespace is simply done by having a
 # namespace with empty prefix.
 #namespace private {
@@ -220,7 +229,7 @@
    #prefix = 
 
    # Physical location of the mailbox. This is in same format as
-   # default_mail_env, which is also the default for it.
+   # mail_location, which is also the default for it.
    #location =
 
    # There can be only one INBOX, and this setting defines which namespace
@@ -999,7 +1008,7 @@
   #acl = vfile:/etc/dovecot-acls
 
   # Convert plugin. If set, specifies the source storage path which is
-  # converted to destination storage (default_mail_env).
+  # converted to destination storage (mail_location).
   #convert_mail = mbox:%h/mail
 
   # Trash plugin. When saving a message would make user go over quota, this
--- a/src/deliver/deliver.c	Mon Oct 16 14:12:40 2006 +0300
+++ b/src/deliver/deliver.c	Tue Oct 17 13:55:56 2006 +0300
@@ -520,10 +520,14 @@
         mail_storage_init();
 	mail_storage_register_all();
 
-	/* MAIL comes from userdb, DEFAULT_MAIL_ENV from dovecot.conf */
+	/* MAIL comes from userdb, MAIL_LOCATION from dovecot.conf */
 	mail_env = getenv("MAIL");
 	if (mail_env == NULL) 
+		mail_env = getenv("MAIL_LOCATION");
+	if (mail_env == NULL)  {
+		/* Keep this for backwards compatibility */
 		mail_env = getenv("DEFAULT_MAIL_ENV");
+	}
 	if (mail_env != NULL) {
 		table = get_var_expand_table(destination, getenv("HOME"));
 		mail_env = expand_mail_env(mail_env, table);
--- a/src/master/mail-process.c	Mon Oct 16 14:12:40 2006 +0300
+++ b/src/master/mail-process.c	Tue Oct 17 13:55:56 2006 +0300
@@ -283,8 +283,8 @@
 	/* user given environment - may be malicious. virtual_user comes from
 	   auth process, but don't trust that too much either. Some auth
 	   mechanism might allow leaving extra data there. */
-	if ((mail == NULL || *mail == '\0') && *set->default_mail_env != '\0')
-		mail = expand_mail_env(set->default_mail_env, var_expand_table);
+	if ((mail == NULL || *mail == '\0') && *set->mail_location != '\0')
+		mail = expand_mail_env(set->mail_location, var_expand_table);
 	env_put(t_strconcat("MAIL=", mail, NULL));
 
 	if (set->server->namespaces != NULL) {
--- a/src/master/master-settings.c	Mon Oct 16 14:12:40 2006 +0300
+++ b/src/master/master-settings.c	Tue Oct 17 13:55:56 2006 +0300
@@ -109,6 +109,7 @@
 	DEF(SET_STR, mail_extra_groups),
 
 	DEF(SET_STR, default_mail_env),
+	DEF(SET_STR, mail_location),
 	DEF(SET_STR, mail_cache_fields),
 	DEF(SET_STR, mail_never_cache_fields),
 	DEF(SET_INT, mail_cache_min_mail_count),
@@ -316,6 +317,7 @@
 	MEMBER(mail_extra_groups) "",
 
 	MEMBER(default_mail_env) "",
+	MEMBER(mail_location) "",
 	MEMBER(mail_cache_fields) "flags",
 	MEMBER(mail_never_cache_fields) "imap.envelope",
 	MEMBER(mail_cache_min_mail_count) 0,
@@ -864,6 +866,10 @@
 		return FALSE;
 	}
 #endif
+	if (*set->mail_location == '\0') {
+		/* keep this for backwards compatibility */
+		set->mail_location = set->default_mail_env;
+	}
 	return TRUE;
 }
 
--- a/src/master/master-settings.h	Mon Oct 16 14:12:40 2006 +0300
+++ b/src/master/master-settings.h	Tue Oct 17 13:55:56 2006 +0300
@@ -68,6 +68,7 @@
 	const char *mail_extra_groups;
 
 	const char *default_mail_env;
+	const char *mail_location;
 	const char *mail_cache_fields;
 	const char *mail_never_cache_fields;
 	unsigned int mail_cache_min_mail_count;