comparison 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
comparison
equal deleted inserted replaced
386:13c9e0969054 387:a408411ff8df
772 GList *msg_node; 772 GList *msg_node;
773 GList *local_msgout_list = NULL; 773 GList *local_msgout_list = NULL;
774 GList *remote_msgout_list = NULL; 774 GList *remote_msgout_list = NULL;
775 GList *msgout_node; 775 GList *msgout_node;
776 GList *alias_table = NULL; 776 GList *alias_table = NULL;
777 GList *globalias_table = NULL;
777 gboolean ok = TRUE; 778 gboolean ok = TRUE;
778 779
779 /* create msgout_list */ 780 /* create msgout_list */
780 foreach(msg_list, msg_node) { 781 foreach(msg_list, msg_node) {
781 message *msg = (message *) msg_node->data; 782 message *msg = (message *) msg_node->data;
782 msgout_list = g_list_append(msgout_list, create_msg_out(msg)); 783 msgout_list = g_list_append(msgout_list, create_msg_out(msg));
783 } 784 }
784 785
786 if (conf.globalias_file) {
787 globalias_table = table_read(conf.globalias_file, ':');
788 }
785 if (conf.alias_file) { 789 if (conf.alias_file) {
786 alias_table = table_read(conf.alias_file, ':'); 790 alias_table = table_read(conf.alias_file, ':');
787 } 791 }
788 792
789 /* sort messages for different deliveries */ 793 /* sort messages for different deliveries */
806 rcpt_list = g_list_prepend(rcpt_list, addr); 810 rcpt_list = g_list_prepend(rcpt_list, addr);
807 } else { 811 } else {
808 logwrite(LOG_ALERT, "invalid log_user address `%s', ignoring\n", conf.log_user); 812 logwrite(LOG_ALERT, "invalid log_user address `%s', ignoring\n", conf.log_user);
809 } 813 }
810 } 814 }
815 if (globalias_table) {
816 GList *globaliased_rcpt_list;
817 globaliased_rcpt_list = alias_expand(globalias_table,
818 rcpt_list,
819 msgout->msg->non_rcpt_list, 1);
820 g_list_free(rcpt_list);
821 rcpt_list = globaliased_rcpt_list;
822 }
811 if (alias_table) { 823 if (alias_table) {
812 GList *aliased_rcpt_list; 824 GList *aliased_rcpt_list;
813 aliased_rcpt_list = alias_expand(alias_table, rcpt_list, msgout->msg->non_rcpt_list); 825 aliased_rcpt_list = alias_expand(alias_table,
826 rcpt_list,
827 msgout->msg->non_rcpt_list, 0);
814 g_list_free(rcpt_list); 828 g_list_free(rcpt_list);
815 rcpt_list = aliased_rcpt_list; 829 rcpt_list = aliased_rcpt_list;
816 } 830 }
817 831
818 /* split_rcpts(rcpt_list, NULL, &local_rcpt_list, NULL, &other_rcpt_list); */ 832 /* split_rcpts(rcpt_list, NULL, &local_rcpt_list, NULL, &other_rcpt_list); */
835 } 849 }
836 } 850 }
837 851
838 if (alias_table) { 852 if (alias_table) {
839 destroy_table(alias_table); 853 destroy_table(alias_table);
854 }
855 if (globalias_table) {
856 destroy_table(globalias_table);
840 } 857 }
841 858
842 /* process local/remote msgout lists -> delivery */ 859 /* process local/remote msgout lists -> delivery */
843 860
844 if (local_msgout_list) { 861 if (local_msgout_list) {