From: Stephan Bosch Date: Wed, 20 Sep 2017 19:49:34 +0000 (+0200) Subject: lib-storage: Added hostname, postmaster_address and recipient_delimiter settings... X-Git-Tag: 2.3.0.rc1~925 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c2ea6b029715a74b1f3724c7db05b222537371cd;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Added hostname, postmaster_address and recipient_delimiter settings to mail_storage_settings. Copied from lda_settings. --- diff --git a/src/lib-storage/mail-storage-settings.c b/src/lib-storage/mail-storage-settings.c index 8e2754b197..9c82b16728 100644 --- a/src/lib-storage/mail-storage-settings.c +++ b/src/lib-storage/mail-storage-settings.c @@ -5,6 +5,7 @@ #include "hash-format.h" #include "var-expand.h" #include "unichar.h" +#include "hostpid.h" #include "settings-parser.h" #include "mail-index.h" #include "mail-user.h" @@ -60,6 +61,10 @@ static const struct setting_define mail_storage_setting_defines[] = { DEF(SET_ENUM, lock_method), DEF(SET_STR, pop3_uidl_format), + DEF(SET_STR_VARS, postmaster_address), + DEF(SET_STR, hostname), + DEF(SET_STR, recipient_delimiter), + DEF(SET_STR, ssl_client_ca_dir), DEF(SET_STR, ssl_client_ca_file), DEF(SET_STR, ssl_crypto_device), @@ -103,6 +108,10 @@ const struct mail_storage_settings mail_storage_default_settings = { .lock_method = "fcntl:flock:dotlock", .pop3_uidl_format = "%08Xu%08Xv", + .postmaster_address = "postmaster@%d", + .hostname = "", + .recipient_delimiter = "+", + .ssl_client_ca_dir = "", .ssl_client_ca_file = "", .ssl_crypto_device = "" @@ -463,6 +472,22 @@ static bool mail_storage_settings_check(void *_set, pool_t pool ATTR_UNUSED, // FIXME: check set->mail_server_admin syntax (RFC 5464, Section 6.2.2) +#ifndef CONFIG_BINARY + if (*set->hostname == '\0') + set->hostname = p_strdup(pool, my_hostdomain()); + if (set->postmaster_address[0] == SETTING_STRVAR_UNEXPANDED[0] && + set->postmaster_address[1] == '\0') { + /* check for valid looking fqdn in hostname */ + if (strchr(set->hostname, '.') == NULL) { + *error_r = "postmaster_address setting not given"; + return FALSE; + } + set->postmaster_address = + p_strconcat(pool, SETTING_STRVAR_UNEXPANDED, + "postmaster@", set->hostname, NULL); + } +#endif + return TRUE; } diff --git a/src/lib-storage/mail-storage-settings.h b/src/lib-storage/mail-storage-settings.h index 288ad69572..fa005f1b31 100644 --- a/src/lib-storage/mail-storage-settings.h +++ b/src/lib-storage/mail-storage-settings.h @@ -46,6 +46,10 @@ struct mail_storage_settings { const char *lock_method; const char *pop3_uidl_format; + const char *postmaster_address; + const char *hostname; + const char *recipient_delimiter; + const char *ssl_client_ca_dir; const char *ssl_client_ca_file; const char *ssl_crypto_device;