masqmail
changeset 354:08932c629849
reworked the route concept; removed the idea of the localnet
Renamed to reflect the actual meaning more clearly:
s/online_routes/query_routes/g
s/local_net_route/permanent_routes/g
Removed local_nets, which are now represented by allowed_recipients
in a permanent route. (See. examples/localnet.route)
There is no more abiguity between `local' and `local net'.
Run admin/config-transition on your config to learn how to update it.
author | markus schnalke <meillo@marmaro.de> |
---|---|
date | Sun, 04 Sep 2011 11:25:38 +0200 |
parents | 48ff59cf0b34 |
children | ddb7b3fd3d08 |
files | admin/config-transition docs/simple-relay-setup examples/localnet.route examples/masqmail.conf man/masqmail.8 man/masqmail.conf.5 man/masqmail.route.5 src/conf.c src/deliver.c src/masqmail.h tests/relay-to-hostname-mta/makefile tests/relay-to-hostname-mta/online tests/relay-to-hostname-mta/test.conf.tpl tests/relay-to-localhost-mta/online tests/relay-to-localhost-mta/test.conf.tpl tests/relay-to-localhost-mta/test.route |
diffstat | 16 files changed, 163 insertions(+), 156 deletions(-) [+] |
line diff
1.1 --- a/admin/config-transition Sun Sep 04 10:23:00 2011 +0200 1.2 +++ b/admin/config-transition Sun Sep 04 11:25:38 2011 +0200 1.3 @@ -78,6 +78,24 @@ 1.4 Now known as online_query. online_detect=pipe is not needed anymore. \ 1.5 " 1.6 1.7 +check["connect_route\\\\."] = "conf" SUBSEP "Removed in 0.3.4" SUBSEP "\ 1.8 +The option had been already obsolete. Use \`query_routes.' instead.\ 1.9 +" 1.10 + 1.11 +check["online_routes\\\\."] = "conf" SUBSEP "Renamed in 0.3.4" SUBSEP "\ 1.12 +Known as \`query_routes.' now.\ 1.13 +" 1.14 + 1.15 +check["local_net_route"] = "conf" SUBSEP "Renamed in 0.3.4" SUBSEP "\ 1.16 +Known as \`permanent_routes' now, because that's what they actually are.\ 1.17 +" 1.18 + 1.19 +check["local_nets"] = "conf" SUBSEP "Removed in 0.3.4" SUBSEP "\ 1.20 +There is no concept of a \`\`local net'' in masqmail anymore. \ 1.21 +Create a permanent route with \`allowed_recipients' set accordingly. \ 1.22 +See man pages and example configurations for details.\ 1.23 +" 1.24 + 1.25 # route files 1.26 1.27 check["pop3_login"] = "route" SUBSEP "Removed in 0.3.0" SUBSEP "\
2.1 --- a/docs/simple-relay-setup Sun Sep 04 10:23:00 2011 +0200 2.2 +++ b/docs/simple-relay-setup Sun Sep 04 11:25:38 2011 +0200 2.3 @@ -28,7 +28,7 @@ 2.4 You need a config file like this one: 2.5 2.6 host_name = "foo.example.org" 2.7 - online_routes.default = /etc/masqmail/default.route 2.8 + query_routes.default = /etc/masqmail/default.route 2.9 2.10 (Substitute a real hostname, of course.) 2.11
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/examples/localnet.route Sun Sep 04 11:25:38 2011 +0200 3.3 @@ -0,0 +1,16 @@ 3.4 +# Example route for a local network 3.5 +# see also: man 5 masqmail.route 3.6 +# 3.7 +# Include this route with 3.8 +# permanent_routes = "/etc/masqmail/localnet.route" 3.9 +# in masqmail.conf 3.10 + 3.11 +# adjust this to the machines on the local net 3.12 +allowed_recipients = "*@*mydomain.invalid;*@also.onlocal.net" 3.13 + 3.14 +# We expect the target hosts to be online. If not, fail. 3.15 +# Use this setting if you are sure the target hosts are online. 3.16 +connect_error_fail = true 3.17 + 3.18 +# If you don't want to query the DNS, uncomment: 3.19 +#resolve_list = "byname"
4.1 --- a/examples/masqmail.conf Sun Sep 04 10:23:00 2011 +0200 4.2 +++ b/examples/masqmail.conf Sun Sep 04 11:25:38 2011 +0200 4.3 @@ -6,11 +6,6 @@ 4.4 # CHANGING THIS IS REQUIRED! 4.5 host_name="striped.patchwork.net" 4.6 4.7 -# Nets considered local, for immediate delivery attempts: 4.8 -# ALL hosts not included in either local_host or local_nets are 4.9 -# considered to be 'outside', meaning that messages to them will be queued 4.10 -#local_nets="*.patchwork.net;blue;striped" 4.11 - 4.12 # accept connections on these interfaces: 4.13 # Change this to something like: "localhost:25;foo:25" if other machines 4.14 # on your network shall be able to connect to masqmail. 4.15 @@ -38,14 +33,14 @@ 4.16 #caseless_matching = false 4.17 4.18 4.19 -# special routes: 4.20 +# routes 4.21 +# CHANGING THIS IS REQUIRED! 4.22 4.23 -# CHANGING THIS IS REQUIRED! 4.24 +# set up a route for the local net: 4.25 +#permanent_routes = "/etc/masqmail/localnet.route" 4.26 + 4.27 # You can use as many routes (one for each provider) as you like: 4.28 -#connect_route.example = "/etc/masqmail/example.route" 4.29 +#query_routes.example = "/etc/masqmail/example.route" 4.30 4.31 # you can also give a list of routes for a single connection: 4.32 -#connect_route.foobar = "/etc/masqmail/foo.route;/etc/masqmail/bar.route" 4.33 - 4.34 -# you can also set routes for the local net: 4.35 -#local_net_route = "/etc/masqmail/local.route;/etc/masqmail/other_lan.route" 4.36 +#query_routes.foobar = "/etc/masqmail/foo.route;/etc/masqmail/bar.route"
5.1 --- a/man/masqmail.8 Sun Sep 04 10:23:00 2011 +0200 5.2 +++ b/man/masqmail.8 Sun Sep 04 11:25:38 2011 +0200 5.3 @@ -87,8 +87,8 @@ 5.4 5.5 Do a single queue run. 5.6 Try to deliver all messages in the queue. 5.7 -Masqmail sends to addresses on the local host, on the local net, 5.8 -and to remote ones, if available online routes permit. 5.9 +Masqmail sends to addresses on the local host 5.10 +and to remote ones, if available online routes permit it. 5.11 That means, masqmail sends all queued mail it can. 5.12 Online detection is done with the configured 5.13 method (see \fBonline_query\fR in \fBmasqmail.conf(5)\fR). 5.14 @@ -101,7 +101,7 @@ 5.15 5.16 The route configuration for \fINAME\fP is read and queued mail 5.17 to matching remote recipients is sent. 5.18 -(See \fBonline_routes.\fINAME\fR in the main config file.) 5.19 +(See \fBquery_routes.\fINAME\fR in the main config file.) 5.20 5.21 You may want to use this option in scripts that run as soon as a link 5.22 to the internet has been set up (e.g. ip-up).
6.1 --- a/man/masqmail.conf.5 Sun Sep 04 10:23:00 2011 +0200 6.2 +++ b/man/masqmail.conf.5 Sun Sep 04 11:25:38 2011 +0200 6.3 @@ -25,8 +25,8 @@ 6.4 For some values, patterns (like `*',`?') can be used. 6.5 The spaces in front of and after the equal sign `=' are optional. 6.6 6.7 -Most lists (exceptions: \fBlocal_hosts\fR, \fBlocal_nets\fR, \fBlisten_addresses\fR, 6.8 -and \fBonline_routes\fR) accept files. 6.9 +Most lists (exceptions: \fBlocal_hosts\fR, \fBlisten_addresses\fR, 6.10 +\fBquery_routes.\fIname\fR and \fBpermanent_routes\fR) accept files. 6.11 These will be recognized by a leading slash `/'. 6.12 The contents of these files will be included at the position of the file name, 6.13 there can be items or other files before and after the file entry. 6.14 @@ -164,13 +164,6 @@ 6.15 not_local_addresses = "eric@mydomain.net" 6.16 6.17 .TP 6.18 -\fBlocal_nets = \fIlist\fR 6.19 - 6.20 -A semicolon `;' separated list of hostnames which are on the `local' net. 6.21 -Delivery to these hosts is attempted immediately. 6.22 -You can use patterns with `*', e.g. "*.bar.com". 6.23 - 6.24 -.TP 6.25 \fBlisten_addresses = \fIlist\fR 6.26 6.27 A semicolon `;' separated list of interfaces on which connections will be accepted. 6.28 @@ -222,35 +215,55 @@ 6.29 Default: false 6.30 6.31 .TP 6.32 -\fBonline_routes.\fIname\fR = \fIlist\fR 6.33 +\fBpermanent_routes\fR = \fIlist\fR 6.34 6.35 -Replace \fIname\fR with a name to identify a connection. 6.36 -Set this to a filename (or a list of filenames) for the special route configuration for that connection. 6.37 -You will use that name to call masqmail with the \fB\-qo\fR option every time a 6.38 -connection to your ISP is set up. 6.39 +Set this to the filename (or a semicolon-separated list of filenames) 6.40 +of the route configuration for always available connections. 6.41 +Main purpose is to define a mail server with mail_host in your local network, 6.42 +or if masqmail should send mail directly to the target host. 6.43 +If you have only a single host, you can leave it unset. 6.44 + 6.45 +A setting `\fBlocal_nets\fR = \fI"*home.net"\fR' in versions <= 0.3.3 6.46 +is in newer versions configured as: 6.47 +`\fBpermanent_routes\fR = \fI"/etc/masqmail/homenet.route"\fR' 6.48 +and the route file `homenet.route' containing: 6.49 +.in +1in 6.50 +.nf 6.51 +allowed_recipients = "*@*home.net" 6.52 +connect_error_fail = true 6.53 +resolve_list = byname 6.54 +.fi 6.55 +.in 0 6.56 +This is just as it had been with \fBlocal_net_route\fP, 6.57 +with the exception that the filtering for appropriate addresses 6.58 +is only in the route file and not with \fBlocal_nets\fR. 6.59 + 6.60 +.TP 6.61 +\fBquery_routes.\fIname\fR = \fIlist\fR 6.62 + 6.63 +Replace \fIname\fR with a name to identify the connection. 6.64 +Set this to a filename (or a semicolon-separated list of filenames) 6.65 +for the route configuration for that connection. 6.66 + 6.67 +Routes of this kind cannot be expected to be online always. 6.68 +Masqmail will query which of the routes are online. 6.69 + 6.70 +You can use the name to call masqmail with the \fB\-qo\fR option every time a 6.71 +connection to your ISP is set up, in order to send queued mail through this 6.72 +route. 6.73 6.74 Example: Your ISP has the name FastNet. 6.75 Then you write the following line in the main configuration: 6.76 6.77 - \fBonline_routes.FastNet\fR = \fI"/etc/masqmail/fastnet.route"\fR 6.78 +\fBquery_routes.\fBFastNet\fR = \fI"/etc/masqmail/fastnet.route"\fR 6.79 6.80 -\fI/etc/masqmail/fastnet.route\fR is the route configuration file, see \fBmasqmail.route(5)\fR. 6.81 -As soon as a link to FastNet has been set up, you call masqmail \fB\-qo \fIFastNet\fR. 6.82 +\fI/etc/masqmail/fastnet.route\fR is the route configuration file, 6.83 +see \fBmasqmail.route(5)\fR. 6.84 +As soon as a link to FastNet has been set up, 6.85 +you call `masqmail \fB\-qo \fIFastNet\fR'. 6.86 Masqmail will then read the specified file and send the mails. 6.87 6.88 -.TP 6.89 -\fBconnect_route.\fIname\fR = \fIlist\fR 6.90 - 6.91 -Old name for \fBonline_routes\fR. 6.92 - 6.93 -.TP 6.94 -\fBlocal_net_route = \fIfile\fR 6.95 - 6.96 -This is similar to \fBonline_routes.\fIname\fR but used for delilvery to the local net. 6.97 -Recipient addresses that are in local_nets will be routed using this route configuration. 6.98 -Main purpose is to define a mail server with mail_host in your local network. 6.99 -In simple environments this can be left unset. 6.100 -If unset, a default route configuration (named ``default local_net_route'') will be used. 6.101 +See \fBonline_query\fP. 6.102 6.103 .TP 6.104 \fBalias_file = \fIfile\fR 6.105 @@ -366,7 +379,7 @@ 6.106 6.107 Masqmail executes the command given and reads from its standard output. 6.108 The command should just print a route name, as defined 6.109 -with \fBonline_routes.\fIname\fR, to standard output and return a zero status code. 6.110 +with \fBquery_routes.\fIname\fR, to standard output and return a zero status code. 6.111 Masqmail assumes it is offline if the script returns with a non-zero status. 6.112 Leading and trailing whitespace is removed from the output. 6.113
7.1 --- a/man/masqmail.route.5 Sun Sep 04 10:23:00 2011 +0200 7.2 +++ b/man/masqmail.route.5 Sun Sep 04 11:25:38 2011 +0200 7.3 @@ -104,7 +104,7 @@ 7.4 The reason for this is that masqmail is designed for non permanent internet connections, 7.5 where such errors may occur quite often, and a bounce would be annoying. 7.6 7.7 -For the default local_net route it is set to true. 7.8 +You probably want to set this to true for permanent routes. 7.9 7.10 7.11 .SH SMTP CONFIGURATION 7.12 @@ -125,10 +125,14 @@ 7.13 Specify the method how the domain of the server is resolved. 7.14 Possible values are dns_mx, dns_a, byname. 7.15 For `dns_mx', the domain is assumed to be an MX pointer to a list of host names, 7.16 -these will be tried each in order (lowest preference value first, equal preference values in random order). 7.17 +these will be tried each in order 7.18 +(lowest preference value first, equal preference values in random order). 7.19 For `dns_a', the domain is assumed to be an A pointer. 7.20 For `byname', the library function \fBgethostbyname(3)\fR will be used. 7.21 7.22 +For routes to a local network, where you likely don't have a DNS service, 7.23 +use only `byname'. 7.24 + 7.25 The default is "dns_mx;dns_a;byname". 7.26 7.27 .TP
8.1 --- a/src/conf.c Sun Sep 04 10:23:00 2011 +0200 8.2 +++ b/src/conf.c Sun Sep 04 11:25:38 2011 +0200 8.3 @@ -506,8 +506,6 @@ 8.4 conf.local_addresses = parse_list(rval, TRUE); 8.5 else if (strcmp(lval, "not_local_addresses") == 0) 8.6 conf.not_local_addresses = parse_list(rval, TRUE); 8.7 - else if (strcmp(lval, "local_nets") == 0) 8.8 - conf.local_nets = parse_list(rval, FALSE); 8.9 else if (strcmp(lval, "do_save_envelope_to") == 0) 8.10 conf.do_save_envelope_to = parse_boolean(rval); 8.11 else if (strcmp(lval, "defer_all") == 0) 8.12 @@ -558,13 +556,12 @@ 8.13 #else 8.14 logwrite(LOG_WARNING, "%s ignored: not compiled with ident support\n", lval); 8.15 #endif 8.16 - } else if ((strncmp(lval, "connect_route.", 14) == 0) 8.17 - || (strncmp(lval, "online_routes.", 14) == 0)) { 8.18 + } else if (strncmp(lval, "query_routes.", 13) == 0) { 8.19 GList *file_list = parse_list(rval, FALSE); 8.20 - table_pair *pair = create_pair(&(lval[14]), file_list); 8.21 - conf.connect_routes = g_list_append(conf.connect_routes, pair); 8.22 - } else if (strcmp(lval, "local_net_route") == 0) { 8.23 - conf.local_net_routes = parse_list(rval, FALSE); 8.24 + table_pair *pair = create_pair(lval+13, file_list); 8.25 + conf.query_routes = g_list_append(conf.query_routes, pair); 8.26 + } else if (strcmp(lval, "permanent_routes") == 0) { 8.27 + conf.perma_routes = parse_list(rval, FALSE); 8.28 } else if (strcmp(lval, "online_query") == 0) 8.29 conf.online_query = g_strdup(rval); 8.30 else if (strcmp(lval, "do_queue") == 0) 8.31 @@ -630,7 +627,7 @@ 8.32 } 8.33 8.34 connect_route* 8.35 -read_route(gchar * filename, gboolean is_local_net) 8.36 +read_route(gchar * filename, gboolean is_perma) 8.37 { 8.38 gboolean ok = FALSE; 8.39 FILE *in; 8.40 @@ -645,7 +642,7 @@ 8.41 8.42 route->expand_h_sender_address = TRUE; 8.43 8.44 - route->is_local_net = is_local_net; 8.45 + route->is_perma = is_perma; 8.46 8.47 route->do_pipelining = TRUE; 8.48 8.49 @@ -773,10 +770,8 @@ 8.50 8.51 if (!route->resolve_list) { 8.52 #ifdef ENABLE_RESOLVER 8.53 - if (!is_local_net) { 8.54 - route->resolve_list = g_list_append(route->resolve_list, resolve_dns_mx); 8.55 - route->resolve_list = g_list_append(route->resolve_list, resolve_dns_a); 8.56 - } 8.57 + route->resolve_list = g_list_append(route->resolve_list, resolve_dns_mx); 8.58 + route->resolve_list = g_list_append(route->resolve_list, resolve_dns_a); 8.59 #endif 8.60 route->resolve_list = g_list_append(route->resolve_list, resolve_byname); 8.61 } 8.62 @@ -855,7 +850,7 @@ 8.63 } 8.64 8.65 GList* 8.66 -read_route_list(GList * rf_list, gboolean is_local_net) 8.67 +read_route_list(GList * rf_list, gboolean is_perma) 8.68 { 8.69 GList *list = NULL; 8.70 GList *node; 8.71 @@ -867,7 +862,7 @@ 8.72 8.73 foreach(rf_list, node) { 8.74 gchar *fname = (gchar *) (node->data); 8.75 - connect_route *route = read_route(fname, is_local_net); 8.76 + connect_route *route = read_route(fname, is_perma); 8.77 if (route) 8.78 list = g_list_append(list, route); 8.79 else 8.80 @@ -893,21 +888,3 @@ 8.81 } 8.82 g_list_free(list); 8.83 } 8.84 - 8.85 -connect_route* 8.86 -create_local_route() 8.87 -{ 8.88 - connect_route *route; 8.89 - 8.90 - route = g_malloc(sizeof(connect_route)); 8.91 - if (!route) { 8.92 - return NULL; 8.93 - } 8.94 - memset(route, 0, sizeof(connect_route)); 8.95 - route->is_local_net = TRUE; 8.96 - route->name = g_strdup("default local_net_route"); 8.97 - route->expand_h_sender_address = TRUE; 8.98 - route->resolve_list = g_list_append(NULL, resolve_byname); 8.99 - route->connect_error_fail = TRUE; 8.100 - return route; 8.101 -}
9.1 --- a/src/deliver.c Sun Sep 04 10:23:00 2011 +0200 9.2 +++ b/src/deliver.c Sun Sep 04 11:25:38 2011 +0200 9.3 @@ -667,15 +667,34 @@ 9.4 return TRUE; 9.5 } 9.6 9.7 -gboolean 9.8 -deliver_msgout_list_online(GList * msgout_list) 9.9 +int 9.10 +deliver_remote(GList* remote_msgout_list) 9.11 { 9.12 + int ok = TRUE; 9.13 + GList *route_list = NULL; 9.14 + GList *route_node; 9.15 GList *rf_list = NULL; 9.16 gchar *connect_name = NULL; 9.17 - gboolean ok = FALSE; 9.18 - GList *route_node; 9.19 - GList *route_list; 9.20 9.21 + if (!remote_msgout_list) { 9.22 + return FALSE; 9.23 + } 9.24 + 9.25 + /* perma routes */ 9.26 + if (conf.perma_routes) { 9.27 + DEBUG(5) debugf("processing perma_routes\n"); 9.28 + 9.29 + route_list = read_route_list(conf.perma_routes, TRUE); 9.30 + foreach(route_list, route_node) { 9.31 + connect_route *route = (connect_route *) (route_node->data); 9.32 + if (!deliver_route_msg_list(route, remote_msgout_list)) { 9.33 + ok = FALSE; 9.34 + } 9.35 + } 9.36 + destroy_route_list(route_list); 9.37 + } 9.38 + 9.39 + /* query routes */ 9.40 connect_name = online_query(); 9.41 if (!connect_name) { 9.42 DEBUG(5) debugf("online query returned false\n"); 9.43 @@ -686,7 +705,7 @@ 9.44 DEBUG(5) debugf("processing query_routes\n"); 9.45 logwrite(LOG_NOTICE, "detected online configuration `%s'\n", connect_name); 9.46 9.47 - rf_list = (GList *) table_find(conf.connect_routes, connect_name); 9.48 + rf_list = (GList *) table_find(conf.query_routes, connect_name); 9.49 if (!rf_list) { 9.50 logwrite(LOG_ALERT, "route list with name '%s' not found.\n", connect_name); 9.51 return FALSE; 9.52 @@ -701,7 +720,7 @@ 9.53 foreach(route_list, route_node) { 9.54 connect_route *route = (connect_route *) (route_node->data); 9.55 /* TODO: ok gets overwritten */ 9.56 - ok = deliver_route_msg_list(route, msgout_list); 9.57 + ok = deliver_route_msg_list(route, remote_msgout_list); 9.58 } 9.59 destroy_route_list(route_list); 9.60 9.61 @@ -709,10 +728,8 @@ 9.62 } 9.63 9.64 /* 9.65 - This function searches in the list of rcpt addresses 9.66 - for local and 'local net' addresses. Remote addresses 9.67 - which are reachable only when online are treated specially 9.68 - in another function. 9.69 + This function splits the list of rcpt addresses 9.70 + into local and remote addresses and processes them accordingly. 9.71 */ 9.72 gboolean 9.73 deliver_msg_list(GList * msg_list, guint flags) 9.74 @@ -720,8 +737,7 @@ 9.75 GList *msgout_list = NULL; 9.76 GList *msg_node; 9.77 GList *local_msgout_list = NULL; 9.78 - GList *localnet_msgout_list = NULL; 9.79 - GList *other_msgout_list = NULL; 9.80 + GList *remote_msgout_list = NULL; 9.81 GList *msgout_node; 9.82 GList *alias_table = NULL; 9.83 gboolean ok = TRUE; 9.84 @@ -732,7 +748,6 @@ 9.85 msgout_list = g_list_append(msgout_list, create_msg_out(msg)); 9.86 } 9.87 9.88 - 9.89 if (conf.alias_file) { 9.90 alias_table = table_read(conf.alias_file, ':'); 9.91 } 9.92 @@ -742,7 +757,6 @@ 9.93 msg_out *msgout = (msg_out *) (msgout_node->data); 9.94 GList *rcpt_list; 9.95 GList *local_rcpt_list = NULL; 9.96 - GList *localnet_rcpt_list = NULL; 9.97 GList *other_rcpt_list = NULL; 9.98 9.99 if (!spool_lock(msgout->msg->uid)) { 9.100 @@ -767,7 +781,9 @@ 9.101 rcpt_list = aliased_rcpt_list; 9.102 } 9.103 9.104 - split_rcpts(rcpt_list, conf.local_nets, &local_rcpt_list, &localnet_rcpt_list, &other_rcpt_list); 9.105 + /* split_rcpts(rcpt_list, NULL, &local_rcpt_list, * NULL, &other_rcpt_list); */ 9.106 + local_rcpt_list = local_rcpts(rcpt_list); 9.107 + other_rcpt_list = remote_rcpts(rcpt_list); 9.108 g_list_free(rcpt_list); 9.109 9.110 /* local recipients */ 9.111 @@ -777,18 +793,11 @@ 9.112 local_msgout_list = g_list_append(local_msgout_list, local_msgout); 9.113 } 9.114 9.115 - /* local net recipients */ 9.116 - if ((flags & DLVR_LAN) && localnet_rcpt_list) { 9.117 - msg_out *localnet_msgout = clone_msg_out(msgout); 9.118 - localnet_msgout->rcpt_list = localnet_rcpt_list; 9.119 - localnet_msgout_list = g_list_append(localnet_msgout_list, localnet_msgout); 9.120 - } 9.121 - 9.122 - /* remote recipients (the rest), requires online delivery */ 9.123 + /* remote recipients, requires online delivery */ 9.124 if ((flags & DLVR_ONLINE) && other_rcpt_list) { 9.125 - msg_out *other_msgout = clone_msg_out(msgout); 9.126 - other_msgout->rcpt_list = other_rcpt_list; 9.127 - other_msgout_list = g_list_append(other_msgout_list, other_msgout); 9.128 + msg_out *remote_msgout = clone_msg_out(msgout); 9.129 + remote_msgout->rcpt_list = other_rcpt_list; 9.130 + remote_msgout_list = g_list_append(remote_msgout_list, remote_msgout); 9.131 } 9.132 } 9.133 9.134 @@ -796,7 +805,7 @@ 9.135 destroy_table(alias_table); 9.136 } 9.137 9.138 - /* actual delivery */ 9.139 + /* process local/remote msgout lists -> delivery */ 9.140 9.141 if (local_msgout_list) { 9.142 DEBUG(5) debugf("local_msgout_list\n"); 9.143 @@ -809,33 +818,10 @@ 9.144 destroy_msg_out_list(local_msgout_list); 9.145 } 9.146 9.147 - if (localnet_msgout_list) { 9.148 - GList *route_list = NULL; 9.149 - GList *route_node; 9.150 - 9.151 - DEBUG(5) debugf("localnet_msgout_list\n"); 9.152 - if (conf.local_net_routes) { 9.153 - route_list = read_route_list(conf.local_net_routes, TRUE); 9.154 - } else { 9.155 - route_list = g_list_append(NULL, create_local_route()); 9.156 - } 9.157 - 9.158 - foreach(route_list, route_node) { 9.159 - connect_route *route = (connect_route *) (route_node->data); 9.160 - if (!deliver_route_msg_list(route, localnet_msgout_list)) { 9.161 - ok = FALSE; 9.162 - } 9.163 - } 9.164 - destroy_msg_out_list(localnet_msgout_list); 9.165 - destroy_route_list(route_list); 9.166 - } 9.167 - 9.168 - if (other_msgout_list) { 9.169 - DEBUG(5) debugf("other_msgout_list\n"); 9.170 - if (!deliver_msgout_list_online(other_msgout_list)) { 9.171 - ok = FALSE; 9.172 - } 9.173 - destroy_msg_out_list(other_msgout_list); 9.174 + if (remote_msgout_list) { 9.175 + DEBUG(5) debugf("remote_msgout_list\n"); 9.176 + deliver_remote(remote_msgout_list); 9.177 + destroy_msg_out_list(remote_msgout_list); 9.178 } 9.179 9.180 /* unlock spool files */
10.1 --- a/src/masqmail.h Sun Sep 04 10:23:00 2011 +0200 10.2 +++ b/src/masqmail.h Sun Sep 04 11:25:38 2011 +0200 10.3 @@ -81,7 +81,7 @@ 10.4 gchar *name; 10.5 gchar *filename; 10.6 10.7 - gboolean is_local_net; 10.8 + gboolean is_perma; 10.9 gboolean last_route; 10.10 10.11 GList *allowed_senders; 10.12 @@ -138,7 +138,6 @@ 10.13 GList *local_hosts; 10.14 GList *local_addresses; 10.15 GList *not_local_addresses; 10.16 - GList *local_nets; 10.17 GList *listen_addresses; 10.18 10.19 /* ANSI C defines unsigned long to be at least 32bit 10.20 @@ -170,8 +169,8 @@ 10.21 gchar *alias_file; 10.22 int (*localpartcmp) (const char *, const char *); 10.23 10.24 - GList *local_net_routes; 10.25 - GList *connect_routes; /* list of pairs which point to lists */ 10.26 + GList *perma_routes; 10.27 + GList *query_routes; /* list of pairs which point to lists */ 10.28 10.29 gchar *online_query; 10.30 10.31 @@ -261,7 +260,7 @@ 10.32 GList *rcpt_list; 10.33 10.34 GList *hdr_list; 10.35 - GList *xtra_hdr_list; 10.36 + GList *xtra_hdr_list; /* rewritten headers */ 10.37 } msg_out; 10.38 10.39 typedef struct _msgout_perhost { 10.40 @@ -344,11 +343,10 @@ 10.41 /* conf.c */ 10.42 void init_conf(); 10.43 gboolean read_conf(gchar * filename); 10.44 -connect_route *read_route(gchar * filename, gboolean is_local_net); 10.45 -GList *read_route_list(GList * rf_list, gboolean is_local_net); 10.46 +connect_route *read_route(gchar * filename, gboolean is_perma); 10.47 +GList *read_route_list(GList * rf_list, gboolean is_perma); 10.48 void destroy_route(connect_route * r); 10.49 void destroy_route_list(GList * list); 10.50 -connect_route *create_local_route(); 10.51 10.52 /* expand.c */ 10.53 GList *var_table_rcpt(GList * var_table, address * rcpt);
11.1 --- a/tests/relay-to-hostname-mta/makefile Sun Sep 04 10:23:00 2011 +0200 11.2 +++ b/tests/relay-to-hostname-mta/makefile Sun Sep 04 11:25:38 2011 +0200 11.3 @@ -14,6 +14,7 @@ 11.4 11.5 test.route: 11.6 echo mail_host=\"`hostname`\" >$@ 11.7 + echo "resolve_list = byname" >>$@ 11.8 11.9 clean: 11.10 rm -f test.conf test test.route
12.1 --- a/tests/relay-to-hostname-mta/online Sun Sep 04 10:23:00 2011 +0200 12.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 12.3 @@ -1,1 +0,0 @@ 12.4 -test
13.1 --- a/tests/relay-to-hostname-mta/test.conf.tpl Sun Sep 04 10:23:00 2011 +0200 13.2 +++ b/tests/relay-to-hostname-mta/test.conf.tpl Sun Sep 04 11:25:38 2011 +0200 13.3 @@ -13,10 +13,10 @@ 13.4 host_name="MASQMAIL-TEST" 13.5 13.6 # we want to deliver through a route named `test' to a local MTA 13.7 -# thus we do not define any hosts or nets as local 13.8 -# all mail should go through the `test' route. 13.9 -online_query = "/bin/cat PWD/online" 13.10 -online_routes.test = "PWD/test.route" 13.11 +# thus we do not define any hosts as local. All mail should go through 13.12 +# the route. 13.13 +permanent_routes = "PWD/test.route" 13.14 + 13.15 13.16 # spool files in the current directory 13.17 spool_dir="PWD"
14.1 --- a/tests/relay-to-localhost-mta/online Sun Sep 04 10:23:00 2011 +0200 14.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 14.3 @@ -1,1 +0,0 @@ 14.4 -test
15.1 --- a/tests/relay-to-localhost-mta/test.conf.tpl Sun Sep 04 10:23:00 2011 +0200 15.2 +++ b/tests/relay-to-localhost-mta/test.conf.tpl Sun Sep 04 11:25:38 2011 +0200 15.3 @@ -13,10 +13,10 @@ 15.4 host_name="MASQMAIL-TEST" 15.5 15.6 # we want to deliver through a route named `test' to a local MTA 15.7 -# thus we do not define any hosts or nets as local 15.8 -# all mail should go through the `test' route. 15.9 -online_query = "/bin/cat PWD/online" 15.10 -online_routes.test = "PWD/test.route" 15.11 +# thus we do not define any hosts as local. All mail should go through 15.12 +# the route. 15.13 +permanent_routes = "PWD/test.route" 15.14 + 15.15 15.16 # spool files in the current directory 15.17 spool_dir="PWD"