Mercurial > masqmail
comparison 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 |
comparison
equal
deleted
inserted
replaced
428:e972c3cbe1e0 | 429:5593964ec779 |
---|---|
341 | 341 |
342 /* sort out those domains that cannot be sent over this connection: */ | 342 /* sort out those domains that cannot be sent over this connection: */ |
343 split_rcpts(tmp_list, route->denied_recipients, NULL, p_non_rcpt_list, p_rcpt_list); | 343 split_rcpts(tmp_list, route->denied_recipients, NULL, p_non_rcpt_list, p_rcpt_list); |
344 g_list_free(tmp_list); | 344 g_list_free(tmp_list); |
345 } | 345 } |
346 | |
347 gboolean | |
348 route_from_hdr_is_allowed(connect_route *route, char *from_hdr) | |
349 { | |
350 address *addr = create_address_qualified(from_hdr, FALSE, | |
351 conf.host_name); | |
352 if (route->denied_from_hdrs && g_list_find_custom(route->denied_from_hdrs, addr, _g_list_addrcmp)) { | |
353 return FALSE; | |
354 } | |
355 if (route->allowed_from_hdrs) { | |
356 if (g_list_find_custom(route->allowed_from_hdrs, addr, | |
357 _g_list_addrcmp)) { | |
358 return TRUE; | |
359 } else { | |
360 return FALSE; | |
361 } | |
362 } | |
363 return TRUE; | |
364 } | |
365 | |
346 | 366 |
347 msg_out* | 367 msg_out* |
348 route_prepare_msgout(connect_route *route, msg_out *msgout) | 368 route_prepare_msgout(connect_route *route, msg_out *msgout) |
349 { | 369 { |
350 message *msg = msgout->msg; | 370 message *msg = msgout->msg; |