changeset 10586:e1d112ef2e4c HEAD

hostname setting now defaults to fqdn. postmaster_address defaults to postmaster@<hostname setting>.
author Timo Sirainen <tss@iki.fi>
date Tue, 26 Jan 2010 18:52:06 +0200
parents 941511db13c3
children bea4b2d1f27f
files src/lib-lda/lda-settings.c
diffstat 1 files changed, 6 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-lda/lda-settings.c	Tue Jan 26 13:40:01 2010 +0200
+++ b/src/lib-lda/lda-settings.c	Tue Jan 26 18:52:06 2010 +0200
@@ -67,25 +67,20 @@
 	.dependencies = lda_setting_dependencies
 };
 
-static bool lda_settings_check(void *_set, pool_t pool ATTR_UNUSED,
-			       const char **error_r)
+static bool lda_settings_check(void *_set, pool_t pool, const char **error_r)
 {
 	struct lda_settings *set = _set;
-	const char *fqdn = NULL;
 
+	if (*set->hostname == '\0')
+		set->hostname = p_strdup(pool, my_hostdomain());
 	if (*set->postmaster_address == '\0') {
-		fqdn = my_hostdomain();
-		/* check for valid looking fqdn */
-		if (strchr(fqdn, '.') == NULL) {
+		/* 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, "postmaster@",
-						      fqdn, NULL);
-	}
-	if (*set->hostname == '\0') {
-		i_assert(my_hostname != NULL);
-		set->hostname = my_hostname;
+						      set->hostname, NULL);
 	}
 	return TRUE;
 }