Mercurial > masqmail
changeset 157:586f001f5bbd
local_hosts defaults to localhost;foo;foo.example.org now
it is generated from the value of host_name
author | meillo@marmaro.de |
---|---|
date | Thu, 08 Jul 2010 09:59:52 +0200 |
parents | ee2afbf92428 |
children | 91b8b44ba619 |
files | man/masqmail.conf.5 src/conf.c |
diffstat | 2 files changed, 18 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/man/masqmail.conf.5 Thu Jul 08 09:49:05 2010 +0200 +++ b/man/masqmail.conf.5 Thu Jul 08 09:59:52 2010 +0200 @@ -128,7 +128,10 @@ Normally you should set it to "localhost;foo;foo.bar.com" if your host has the fully qualified domain name `foo.bar.com'. -Default: \fIlocalhost\fR +Default: localhost ; <value of \fBhost_name\fR cut at the first dot> ; <value of \fBhost_name\fR> + +Example: \fIlocalhost;foo;foo.example.org\fR +(if you have set \fBhost_name\fR to \fIfoo.example.org\fR) .TP \fBlocal_nets = \fIlist\fR
--- a/src/conf.c Thu Jul 08 09:49:05 2010 +0200 +++ b/src/conf.c Thu Jul 08 09:59:52 2010 +0200 @@ -433,7 +433,6 @@ conf.max_defer_time = 86400 * 4; /* 4 days */ conf.max_msg_size = 0; /* no limit on msg size */ conf.spool_dir = SPOOL_DIR; - conf.local_hosts = parse_list("localhost", FALSE); conf.mail_dir = "/var/mail"; if ((in = fopen(filename, "r")) == NULL) { @@ -614,6 +613,20 @@ if (conf.warn_intervals == NULL) conf.warn_intervals = parse_list("1h;4h;8h;1d;2d;3d", FALSE); + if (!conf.local_hosts) { + char* shortname = strdup(conf.host_name); + char* p = strchr(shortname, '.'); + if (p) { + *p = '\0'; + } + /* we don't care if shortname and conf.host_name are the same */ + char* local_hosts_str = g_strdup_printf("localhost;%s;%s", shortname, conf.host_name); + conf.local_hosts = parse_list(local_hosts_str, FALSE); + free(shortname); + free(local_hosts_str); + } + + return TRUE; }