]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
If location isn't given for namespace, use the default
authorTimo Sirainen <tss@iki.fi>
Sat, 6 Sep 2003 17:37:10 +0000 (20:37 +0300)
committerTimo Sirainen <tss@iki.fi>
Sat, 6 Sep 2003 17:37:10 +0000 (20:37 +0300)
--HG--
branch : HEAD

src/master/mail-process.c
src/master/master-settings.c

index 0329d62f52f67353600ad92c82a569df05fede84..fb954fb243f88e9a6ccbf3daaba26b563f47959a 100644 (file)
@@ -104,15 +104,21 @@ static const char *expand_mail_env(const char *env, const char *user,
 }
 
 static void env_put_namespace(struct namespace_settings *ns,
+                             const char *default_location,
                              const char *user, const char *home)
 {
        const char *location;
        unsigned int i;
 
+       if (default_location == NULL)
+               default_location = "";
+
        for (i = 1; ns != NULL; i++, ns = ns->next) {
                t_push();
 
-               location = expand_mail_env(ns->location, user, home);
+               location = ns->location != NULL ? ns->location :
+                       default_location;
+               location = expand_mail_env(location, user, home);
                env_put(t_strdup_printf("NAMESPACE_%u=%s", i, location));
 
                if (ns->separator != NULL) {
@@ -280,8 +286,10 @@ int create_mail_process(struct login_group *group, int socket,
        if (*mail == '\0' && set->default_mail_env != NULL)
                mail = expand_mail_env(set->default_mail_env, user, home_dir);
 
-       if (set->server->namespaces != NULL)
-               env_put_namespace(set->server->namespaces, user, home_dir);
+       if (set->server->namespaces != NULL) {
+               env_put_namespace(set->server->namespaces,
+                                 set->default_mail_env, user, home_dir);
+       }
 
        env_put(t_strconcat("MAIL=", mail, NULL));
        env_put(t_strconcat("USER=", data + reply->virtual_user_idx, NULL));
index d6a354b8e5ab18a237136c6916b7c3ec9c3f5044..5db71ea804066f52c3a8a6189c3d9a2d3cacdce4 100644 (file)
@@ -328,10 +328,6 @@ static int namespace_settings_verify(struct namespace_settings *ns)
        const char *name;
 
        name = ns->prefix != NULL ? ns->prefix : "";
-       if (ns->location == NULL) {
-               i_error("Namespace '%s': Missing location", name);
-               return FALSE;
-       }
 
        if (ns->separator != NULL &&
            ns->separator[0] != '\0' && ns->separator[1] != '\0') {