From c21be41aba4887b1f08fcb726bd43f5c237aca4f Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sat, 6 Sep 2003 20:37:10 +0300 Subject: [PATCH] If location isn't given for namespace, use the default --HG-- branch : HEAD --- src/master/mail-process.c | 14 +++++++++++--- src/master/master-settings.c | 4 ---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/master/mail-process.c b/src/master/mail-process.c index 0329d62f52..fb954fb243 100644 --- a/src/master/mail-process.c +++ b/src/master/mail-process.c @@ -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)); diff --git a/src/master/master-settings.c b/src/master/master-settings.c index d6a354b8e5..5db71ea804 100644 --- a/src/master/master-settings.c +++ b/src/master/master-settings.c @@ -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') { -- 2.47.3