Mercurial > masqmail
diff src/route.c @ 429:5593964ec779
Added route conditions based on the From header
New route config directives: allowed_from_hdrs, denied_from_hdrs.
This feature was motivated by Philipp Takacs <philipp29@t-online.de>.
author | markus schnalke <meillo@marmaro.de> |
---|---|
date | Thu, 20 Nov 2014 20:36:20 +0100 |
parents | 4cab237ce923 |
children |
line wrap: on
line diff
--- a/src/route.c Wed Apr 03 21:45:57 2013 +0200 +++ b/src/route.c Thu Nov 20 20:36:20 2014 +0100 @@ -344,6 +344,26 @@ g_list_free(tmp_list); } +gboolean +route_from_hdr_is_allowed(connect_route *route, char *from_hdr) +{ + address *addr = create_address_qualified(from_hdr, FALSE, + conf.host_name); + if (route->denied_from_hdrs && g_list_find_custom(route->denied_from_hdrs, addr, _g_list_addrcmp)) { + return FALSE; + } + if (route->allowed_from_hdrs) { + if (g_list_find_custom(route->allowed_from_hdrs, addr, + _g_list_addrcmp)) { + return TRUE; + } else { + return FALSE; + } + } + return TRUE; +} + + msg_out* route_prepare_msgout(connect_route *route, msg_out *msgout) {