masqmail
diff src/deliver.c @ 387:a408411ff8df
Added a glob-pattern aliasing facility.
One use-case is virtual hosting another catch-all maildrops, but you may
use it as a more flexible aliasing mechanism as well.
author | markus schnalke <meillo@marmaro.de> |
---|---|
date | Sat, 18 Feb 2012 12:35:12 +0100 |
parents | 3f923f97563b |
children | 7954b82040b3 |
line diff
1.1 --- a/src/deliver.c Sat Feb 18 11:43:06 2012 +0100 1.2 +++ b/src/deliver.c Sat Feb 18 12:35:12 2012 +0100 1.3 @@ -774,6 +774,7 @@ 1.4 GList *remote_msgout_list = NULL; 1.5 GList *msgout_node; 1.6 GList *alias_table = NULL; 1.7 + GList *globalias_table = NULL; 1.8 gboolean ok = TRUE; 1.9 1.10 /* create msgout_list */ 1.11 @@ -782,6 +783,9 @@ 1.12 msgout_list = g_list_append(msgout_list, create_msg_out(msg)); 1.13 } 1.14 1.15 + if (conf.globalias_file) { 1.16 + globalias_table = table_read(conf.globalias_file, ':'); 1.17 + } 1.18 if (conf.alias_file) { 1.19 alias_table = table_read(conf.alias_file, ':'); 1.20 } 1.21 @@ -808,9 +812,19 @@ 1.22 logwrite(LOG_ALERT, "invalid log_user address `%s', ignoring\n", conf.log_user); 1.23 } 1.24 } 1.25 + if (globalias_table) { 1.26 + GList *globaliased_rcpt_list; 1.27 + globaliased_rcpt_list = alias_expand(globalias_table, 1.28 + rcpt_list, 1.29 + msgout->msg->non_rcpt_list, 1); 1.30 + g_list_free(rcpt_list); 1.31 + rcpt_list = globaliased_rcpt_list; 1.32 + } 1.33 if (alias_table) { 1.34 GList *aliased_rcpt_list; 1.35 - aliased_rcpt_list = alias_expand(alias_table, rcpt_list, msgout->msg->non_rcpt_list); 1.36 + aliased_rcpt_list = alias_expand(alias_table, 1.37 + rcpt_list, 1.38 + msgout->msg->non_rcpt_list, 0); 1.39 g_list_free(rcpt_list); 1.40 rcpt_list = aliased_rcpt_list; 1.41 } 1.42 @@ -838,6 +852,9 @@ 1.43 if (alias_table) { 1.44 destroy_table(alias_table); 1.45 } 1.46 + if (globalias_table) { 1.47 + destroy_table(globalias_table); 1.48 + } 1.49 1.50 /* process local/remote msgout lists -> delivery */ 1.51