changeset 10540:d6d1df7ea4e0 HEAD

lda-settings: Try to set the the postmaster_address if it wasn't configured.
author Pascal Volk <user@localhost.localdomain.org>
date Wed, 30 Dec 2009 02:36:50 +0000
parents 0462fcfb809a
children 99dbadd0492b
files src/lib-lda/lda-settings.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-lda/lda-settings.c	Tue Dec 29 18:32:13 2009 -0500
+++ b/src/lib-lda/lda-settings.c	Wed Dec 30 02:36:50 2009 +0000
@@ -71,10 +71,17 @@
 			       const char **error_r)
 {
 	struct lda_settings *set = _set;
+	const char *fqdn = NULL;
 
 	if (*set->postmaster_address == '\0') {
-		*error_r = "postmaster_address setting not given";
-		return FALSE;
+		fqdn = my_hostdomain();
+		/* check for valid looking fqdn */
+		if (strchr(fqdn, '.') == 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);