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 diff
     1.1 --- a/src/route.c	Wed Apr 03 21:45:57 2013 +0200
     1.2 +++ b/src/route.c	Thu Nov 20 20:36:20 2014 +0100
     1.3 @@ -344,6 +344,26 @@
     1.4  	g_list_free(tmp_list);
     1.5  }
     1.6  
     1.7 +gboolean
     1.8 +route_from_hdr_is_allowed(connect_route *route, char *from_hdr)
     1.9 +{
    1.10 +	address *addr = create_address_qualified(from_hdr, FALSE,
    1.11 +			conf.host_name);
    1.12 +	if (route->denied_from_hdrs && g_list_find_custom(route->denied_from_hdrs, addr, _g_list_addrcmp)) {
    1.13 +		return FALSE;
    1.14 +	}
    1.15 +	if (route->allowed_from_hdrs) {
    1.16 +		if (g_list_find_custom(route->allowed_from_hdrs, addr,
    1.17 +				_g_list_addrcmp)) {
    1.18 +			return TRUE;
    1.19 +		} else {
    1.20 +			return FALSE;
    1.21 +		}
    1.22 +	}
    1.23 +	return TRUE;
    1.24 +}
    1.25 +
    1.26 +
    1.27  msg_out*
    1.28  route_prepare_msgout(connect_route *route, msg_out *msgout)
    1.29  {