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 diff
     1.1 --- a/man/masqmail.conf.5	Thu Jul 08 09:49:05 2010 +0200
     1.2 +++ b/man/masqmail.conf.5	Thu Jul 08 09:59:52 2010 +0200
     1.3 @@ -128,7 +128,10 @@
     1.4  Normally you should set it to "localhost;foo;foo.bar.com" if your host has the
     1.5  fully qualified domain name `foo.bar.com'.
     1.6  
     1.7 -Default: \fIlocalhost\fR
     1.8 +Default: localhost ; <value of \fBhost_name\fR cut at the first dot> ; <value of \fBhost_name\fR>
     1.9 +
    1.10 +Example: \fIlocalhost;foo;foo.example.org\fR
    1.11 +(if you have set \fBhost_name\fR to \fIfoo.example.org\fR)
    1.12  
    1.13  .TP
    1.14  \fBlocal_nets = \fIlist\fR
     2.1 --- a/src/conf.c	Thu Jul 08 09:49:05 2010 +0200
     2.2 +++ b/src/conf.c	Thu Jul 08 09:59:52 2010 +0200
     2.3 @@ -433,7 +433,6 @@
     2.4  	conf.max_defer_time = 86400 * 4;  /* 4 days */
     2.5  	conf.max_msg_size = 0; /* no limit on msg size */
     2.6  	conf.spool_dir = SPOOL_DIR;
     2.7 -	conf.local_hosts = parse_list("localhost", FALSE);
     2.8  	conf.mail_dir = "/var/mail";
     2.9  
    2.10  	if ((in = fopen(filename, "r")) == NULL) {
    2.11 @@ -614,6 +613,20 @@
    2.12  	if (conf.warn_intervals == NULL)
    2.13  		conf.warn_intervals = parse_list("1h;4h;8h;1d;2d;3d", FALSE);
    2.14  
    2.15 +	if (!conf.local_hosts) {
    2.16 +		char* shortname = strdup(conf.host_name);
    2.17 +		char* p = strchr(shortname, '.');
    2.18 +		if (p) {
    2.19 +			*p = '\0';
    2.20 +		}
    2.21 +		/* we don't care if shortname and conf.host_name are the same */
    2.22 +		char* local_hosts_str = g_strdup_printf("localhost;%s;%s", shortname, conf.host_name);
    2.23 +		conf.local_hosts = parse_list(local_hosts_str, FALSE);
    2.24 +		free(shortname);
    2.25 +		free(local_hosts_str);
    2.26 +	}
    2.27 +
    2.28 +
    2.29  	return TRUE;
    2.30  }
    2.31