masqmail

changeset 317:55b7bde95d37

reworked allowed and denied addrs for routes The following refactorings had been made: - allowed_mail_locals + allowed_return_paths -> allowed_senders - not_allowed_mail_locals + not_allowed_return_paths -> denied_senders - allowed_rcpt_domains -> allowed_recipients - not_allowed_rcpt_domains -> denied_recipients The new options allow more consistent and more flexible matching.
author meillo@marmaro.de
date Thu, 28 Apr 2011 09:55:06 +0200
parents d596ac8b5afb
children 290da1595311
files admin/config-transition examples/example.route examples/openssl.route man/masqmail.route.5 src/address.c src/conf.c src/deliver.c src/masqmail.h src/route.c
diffstat 9 files changed, 167 insertions(+), 140 deletions(-) [+]
line diff
     1.1 --- a/admin/config-transition	Mon Apr 25 15:17:30 2011 +0200
     1.2 +++ b/admin/config-transition	Thu Apr 28 09:55:06 2011 +0200
     1.3 @@ -67,7 +67,7 @@
     1.4  "
     1.5  
     1.6  check["online_detect"] = "conf" SUBSEP "Removed in 0.3.2" SUBSEP "\
     1.7 -Destilled to online_query. \
     1.8 +Distilled to online_query. \
     1.9  "
    1.10  
    1.11  check["online_file"] = "conf" SUBSEP "Removed in 0.3.2" SUBSEP "\
    1.12 @@ -96,6 +96,34 @@
    1.13  If pipe is given, pipe will be used, otherwise smtp will be used. \
    1.14  "
    1.15  
    1.16 +check["(^|[ 	])allowed_return_paths"] = "route" SUBSEP "Removed in 0.3.2" SUBSEP "\
    1.17 +Replaced by 'allowed_senders'. \
    1.18 +"
    1.19 +
    1.20 +check["not_allowed_return_paths"] = "route" SUBSEP "Removed in 0.3.2" SUBSEP "\
    1.21 +Replaced by 'denied_senders'. \
    1.22 +"
    1.23 +
    1.24 +check["(^|[ 	])allowed_mail_locals"] = "route" SUBSEP "Removed in 0.3.2" SUBSEP "\
    1.25 +Replaced by 'allowed_senders', if neither wildcards nor '@' is used. \
    1.26 +"
    1.27 +
    1.28 +check["not_allowed_mail_locals"] = "route" SUBSEP "Removed in 0.3.2" SUBSEP "\
    1.29 +Replaced by 'denied_senders', if neither wildcards nor '@' is used. \
    1.30 +"
    1.31 +
    1.32 +check["(^|[ 	])allowed_rcpt_domains"] = "route" SUBSEP "Removed in 0.3.2" SUBSEP "\
    1.33 +Replaced by 'allowed_recipients', if the values are prepended with \
    1.34 +'*@', because 'allowed_recipients' matches complete addresses not just \
    1.35 +domains. \
    1.36 +"
    1.37 +
    1.38 +check["not_allowed_rcpt_domains"] = "route" SUBSEP "Removed in 0.3.2" SUBSEP "\
    1.39 +Replaced by 'denied_recipients', if the values are prepended with \
    1.40 +'*@', because 'allowed_recipients' matches complete addresses not just \
    1.41 +domains. \
    1.42 +"
    1.43 +
    1.44  # get files
    1.45  
    1.46  # already covered by the get.* and online_gets.* options in the conf
     2.1 --- a/examples/example.route	Mon Apr 25 15:17:30 2011 +0200
     2.2 +++ b/examples/example.route	Thu Apr 28 09:55:06 2011 +0200
     2.3 @@ -6,10 +6,10 @@
     2.4  #
     2.5  
     2.6  # users that can send mail over this connection:
     2.7 -# this is a list of the local parts of the original return addresses, as they are
     2.8 +# this is a list of the envelope sender addresses, as they are
     2.9  # configured with your mail client. If not set, anybody may send.
    2.10  
    2.11 -allowed_mail_locals = "okurth"
    2.12 +allowed_senders = "okurth"
    2.13  
    2.14  # local_hosts and local_nets will be checked before this.
    2.15  # cpwright.com uses the dialup up list of dul.maps.vix.com,
    2.16 @@ -20,7 +20,7 @@
    2.17  # You will find this necessary only if you send mail directly
    2.18  # (if mail_host is not set below)
    2.19  
    2.20 -not_allowed_rcpt_domains = "cpwright.com"
    2.21 +denied_recipients = "*@cpwright.com"
    2.22  
    2.23  #
    2.24  # settings:
     3.1 --- a/examples/openssl.route	Mon Apr 25 15:17:30 2011 +0200
     3.2 +++ b/examples/openssl.route	Thu Apr 28 09:55:06 2011 +0200
     3.3 @@ -14,8 +14,8 @@
     3.4  #wrapper="/usr/bin/openssl s_client -quiet -connect mail.gmx.net:465 2>/dev/null"
     3.5  
     3.6  
     3.7 -# which addresses are allowed through this route?
     3.8 -allowed_return_paths = "*@gmx.de;*@gmx.net"
     3.9 +# which sender addresses are allowed for this route?
    3.10 +allowed_senders = "*@gmx.de;*@gmx.net"
    3.11  
    3.12  # the authentication method
    3.13  #auth_name = "cram-md5"
     4.1 --- a/man/masqmail.route.5	Mon Apr 25 15:17:30 2011 +0200
     4.2 +++ b/man/masqmail.route.5	Thu Apr 28 09:55:06 2011 +0200
     4.3 @@ -17,62 +17,65 @@
     4.4  .SH ROUTE CONDITIONS
     4.5  
     4.6  .TP
     4.7 -\fBallowed_mail_locals\fR = \fIlist\fR
     4.8 +\fBallowed_senders\fR = \fIlist\fR
     4.9  
    4.10 -This is a semicolon `;' separated list of local parts of envelope
    4.11 -senders (= mail from = return path) which will be allowed
    4.12 -to send mail through this connection.
    4.13 -If unset and \fBnot_allowed_mail_locals\fR is also unset, all users are allowed.
    4.14 +This is a semicolon `;' separated list of envelope sender addresses.
    4.15 +Messages which have one of these addresses as the return path (= mail
    4.16 +from) are allowed to use this route
    4.17 +(if not also in \fBdenied_senders\fR).
    4.18 +
    4.19 +Glob patterns containing `?' and `*' can be used.
    4.20 +The special item "<>" matches the null sender address
    4.21 +(eg. failure notices or delivery notifications).
    4.22 +If the pattern doesn't contain an `@', it is seen as a pattern for the
    4.23 +local part only.
    4.24 +
    4.25 +Example: \fImeillo;*@*example.org;web*@example.com\fP
    4.26 +
    4.27 +(``meillo'' equals ``meillo@*'', i.e. the local part.)
    4.28  
    4.29  .TP
    4.30 -\fBnot_allowed_mail_locals\fR = \fIlist\fR
    4.31 +\fBdenied_senders\fR = \fIlist\fR
    4.32  
    4.33 -This is a semicolon `;' separated list of local parts of envelope
    4.34 -senders (= mail from = return path) which will be not allowed
    4.35 -to send mail through this connection.
    4.36 -Local parts in this list will not be allowed to use this route even if they
    4.37 -are part of \fBallowed_mail_locals\fR (see above).
    4.38 +This is a semicolon `;' separated list of envelope sender addresses.
    4.39 +Messages which have one of these addresses as the return path (=
    4.40 +mail from) will not
    4.41 +be sent using this route (even if also in \fBallowed_senders\fR).
    4.42 +
    4.43 +Glob patterns containing `?' and `*' can be used.
    4.44 +The special item "<>" matches the null sender address
    4.45 +(eg. failure notices or delivery notifications).
    4.46 +If the pattern doesn't contain an `@', it is seen as a pattern for the
    4.47 +local part only.
    4.48 +
    4.49 +Example: (see \fIallowed_senders\fP)
    4.50  
    4.51  .TP
    4.52 -\fBallowed_return_paths\fR = \fIlist\fR
    4.53 +\fBallowed_recipients\fR = \fIlist\fR
    4.54  
    4.55 -This is a semicolon `;' separated list of addresses.
    4.56 -Messages which have one of these addresses as the return path (=
    4.57 -envelope sender = mail from) will be used using this route
    4.58 -(if not also in \fBnot_allowed_return_paths\fR or an item in \fBnot_allowed_mail_locals\fR matches).
    4.59 +A list of envelope recipient addresses where mail can be sent to using
    4.60 +this route.
    4.61 +This is for example useful if you use this route configuration when connected to another LAN via ppp.
    4.62 +Glob patterns containing `?' and `*' can be used.
    4.63  
    4.64 -Patterns containing `?' and `*' can be used.
    4.65 -The special item "<>" matches the null sender address (eg. failure notices or delivery notifications).
    4.66 +Example: \fI*@example.org;*@*foo.bar\fP
    4.67 +
    4.68 +(See also examples for \fIallowed_senders\fP)
    4.69  
    4.70  .TP
    4.71 -\fBnot_allowed_return_paths\fR = \fIlist\fR
    4.72 +\fBdenied_recipients\fR = \fIlist\fR
    4.73  
    4.74 -This is a semicolon `;' separated list of addresses.
    4.75 -Messages which have one of these addresses as the return path (=
    4.76 -envelope sender = mail from) will not
    4.77 -be used using this route (even if also in \fBallowed_return_paths\fR
    4.78 -or an item in \fBallowed_mail_locals\fR matches).
    4.79 -
    4.80 -Patterns containing `?' and `*' can be used.
    4.81 -The special item "<>" matches the null sender address (eg. failure notices or delivery notifications).
    4.82 -
    4.83 -.TP
    4.84 -\fBallowed_rcpt_domains\fR = \fIlist\fR
    4.85 -
    4.86 -A list of recipient domains (of envelope recipients) where mail will be sent to.
    4.87 -This is for example useful if you use this route configuration when connected to another LAN via ppp.
    4.88 -Patterns containing `?' and `*' can be used.
    4.89 -
    4.90 -.TP
    4.91 -\fBnot_allowed_rcpt_domains\fR = \fIlist\fR
    4.92 -
    4.93 -A list of recipient domains (of envelope recipients) where mail will not be sent to.
    4.94 +A list of envelope recipient addresses where mail will not be sent to
    4.95 +using this route.
    4.96  This is for example useful if you send mail directly (\fBmail_host\fR is not set)
    4.97  and you know of hosts that will not accept mail from you because they use a dialup list
    4.98  (eg. \fBhttp://maps.vix.com/dul/\fR).
    4.99 -If any domain matches both \fBallowed_rcpt_domains\fR and \fBnot_allowed_rcpt_domains\fR,
   4.100 -mail will not be sent to this domain.
   4.101 -Patterns containing `?' and `*' can be used.
   4.102 +\fBdenied_recipients\fR overrules \fBallowed_recipients\fR.
   4.103 +Glob patterns containing `?' and `*' can be used.
   4.104 +
   4.105 +Example: \fI*@spamblocker.example.org\fP
   4.106 +
   4.107 +(See also examples for \fIallowed_senders\fP)
   4.108  
   4.109  .TP
   4.110  \fBlast_route\fR = \fIboolean\fR
   4.111 @@ -80,8 +83,9 @@
   4.112  If this is set, a mail which would have been delivered using this route,
   4.113  but has failed temporarily, will not be tried to be delivered using the next route.
   4.114  
   4.115 -If you have set up a special route with filters using the lists `allowed_rcpt_domains',
   4.116 -`allowed_return_paths', and `allowed_mail_locals' or their complements (not_),
   4.117 +If you have set up a special route with filters using the lists
   4.118 +`allowed_recipients' and `allowed_senders' or their complements
   4.119 +(denied_),
   4.120  and the mail passing these rules should be delivered using this route only,
   4.121  you should set this to `true'.
   4.122  Otherwise the mail would be passed to the next route (if any),
     5.1 --- a/src/address.c	Mon Apr 25 15:17:30 2011 +0200
     5.2 +++ b/src/address.c	Thu Apr 28 09:55:06 2011 +0200
     5.3 @@ -17,7 +17,6 @@
     5.4  */
     5.5  
     5.6  #include "masqmail.h"
     5.7 -#include <fnmatch.h>
     5.8  
     5.9  address*
    5.10  create_address(gchar * path, gboolean is_rfc821)
    5.11 @@ -186,15 +185,3 @@
    5.12  	}
    5.13  	return buffer;
    5.14  }
    5.15 -
    5.16 -gint
    5.17 -addr_match(address * addr1, address * addr2)
    5.18 -{
    5.19 -	int res;
    5.20 -
    5.21 -	if ((res = fnmatch(addr1->local_part, addr2->local_part, 0)) == 0) {
    5.22 -		if ((res = fnmatch(addr1->domain, addr2->domain, FNM_CASEFOLD)) == 0)
    5.23 -			return 0;
    5.24 -	}
    5.25 -	return res;
    5.26 -}
     6.1 --- a/src/conf.c	Mon Apr 25 15:17:30 2011 +0200
     6.2 +++ b/src/conf.c	Thu Apr 28 09:55:06 2011 +0200
     6.3 @@ -142,8 +142,14 @@
     6.4  	return list;
     6.5  }
     6.6  
     6.7 +/* Split the addrs at '@' into local_part and domain. Without an '@'
     6.8 +   everything is local_part. Create address structs, which are put
     6.9 +   into a list and returned.
    6.10 +   This funktion is used for lists of addrs containing globbing chars (* and ?).
    6.11 +   We don't need valid RFC821 addresses here, just patterns to match against.
    6.12 +*/
    6.13  static GList*
    6.14 -parse_address_list(gchar * line, gboolean read_file)
    6.15 +parse_address_glob_list(gchar * line, gboolean read_file)
    6.16  {
    6.17  	GList *plain_list = parse_list(line, read_file);
    6.18  	GList *node;
    6.19 @@ -151,13 +157,32 @@
    6.20  
    6.21  	foreach(plain_list, node) {
    6.22  		gchar *item = (gchar *) (node->data);
    6.23 -		address *addr = create_address(item, TRUE);
    6.24 -		if (addr)
    6.25 -			list = g_list_append(list, addr);
    6.26 +		char* at;
    6.27 +		char* p;
    6.28 +		address *addr = calloc(1, sizeof(address));
    6.29 +
    6.30 +		for (p=item+strlen(item)-1; isspace(*p) || *p=='>'; p--) {
    6.31 +			*p = '\0';
    6.32 +		}
    6.33 +		for (p=item; isspace(*p) || *p=='<'; p++) {
    6.34 +		}
    6.35 +
    6.36 +		addr->address = strdup(p);
    6.37 +		at = strrchr(p, '@');
    6.38 +		if (at) {
    6.39 +			*at = '\0';
    6.40 +			addr->local_part = strdup(p);
    6.41 +			addr->domain = strdup(at+1);
    6.42 +		} else {
    6.43 +			addr->local_part = strdup(p);
    6.44 +			addr->domain = "";
    6.45 +		}
    6.46 +		list = g_list_append(list, addr);
    6.47 +		DEBUG(6) debugf("parse_address_glob_list: read pattern `%s' `%s'\n",
    6.48 +		                addr->local_part, addr->domain);
    6.49  		g_free(item);
    6.50  	}
    6.51  	g_list_free(plain_list);
    6.52 -
    6.53  	return list;
    6.54  }
    6.55  
    6.56 @@ -648,18 +673,16 @@
    6.57  			route->instant_helo = parse_boolean(rval);
    6.58  		else if (strcmp(lval, "do_pipelining") == 0)
    6.59  			route->do_pipelining = parse_boolean(rval);
    6.60 -		else if (strcmp(lval, "allowed_return_paths") == 0)
    6.61 -			route->allowed_return_paths = parse_address_list(rval, TRUE);
    6.62 -		else if (strcmp(lval, "allowed_mail_locals") == 0)
    6.63 -			route->allowed_mail_locals = parse_list(rval, TRUE);
    6.64 -		else if (strcmp(lval, "not_allowed_return_paths") == 0)
    6.65 -			route->not_allowed_return_paths = parse_address_list(rval, TRUE);
    6.66 -		else if (strcmp(lval, "not_allowed_mail_locals") == 0)
    6.67 -			route->not_allowed_mail_locals = parse_list(rval, TRUE);
    6.68 -		else if (strcmp(lval, "allowed_rcpt_domains") == 0)
    6.69 -			route->allowed_rcpt_domains = parse_list(rval, TRUE);
    6.70 -		else if (strcmp(lval, "not_allowed_rcpt_domains") == 0)
    6.71 -			route->not_allowed_rcpt_domains = parse_list(rval, TRUE);
    6.72 +
    6.73 +		else if (strcmp(lval, "allowed_senders") == 0)
    6.74 +			route->allowed_senders = parse_address_glob_list(rval, TRUE);
    6.75 +		else if (strcmp(lval, "denied_senders") == 0)
    6.76 +			route->denied_senders = parse_address_glob_list(rval, TRUE);
    6.77 +		else if (strcmp(lval, "allowed_recipients") == 0)
    6.78 +			route->allowed_recipients = parse_address_glob_list(rval, TRUE);
    6.79 +		else if (strcmp(lval, "denied_recipients") == 0)
    6.80 +			route->denied_recipients = parse_address_glob_list(rval, TRUE);
    6.81 +
    6.82  		else if (strcmp(lval, "set_h_from_domain") == 0)
    6.83  			route->set_h_from_domain = g_strdup(rval);
    6.84  		else if (strcmp(lval, "set_h_reply_to_domain") == 0)
    6.85 @@ -808,10 +831,10 @@
    6.86  		g_free(r->wrapper);
    6.87  	if (r->helo_name)
    6.88  		g_free(r->helo_name);
    6.89 -	_g_list_free_all(r->allowed_mail_locals);
    6.90 -	_g_list_free_all(r->not_allowed_mail_locals);
    6.91 -	_g_list_free_all(r->allowed_rcpt_domains);
    6.92 -	_g_list_free_all(r->not_allowed_rcpt_domains);
    6.93 +	_g_list_free_all(r->allowed_senders);
    6.94 +	_g_list_free_all(r->denied_senders);
    6.95 +	_g_list_free_all(r->allowed_recipients);
    6.96 +	_g_list_free_all(r->denied_recipients);
    6.97  	if (r->set_h_from_domain)
    6.98  		g_free(r->set_h_from_domain);
    6.99  	if (r->set_h_reply_to_domain)
     7.1 --- a/src/deliver.c	Mon Apr 25 15:17:30 2011 +0200
     7.2 +++ b/src/deliver.c	Thu Apr 28 09:55:06 2011 +0200
     7.3 @@ -560,21 +560,21 @@
     7.4  			continue;
     7.5  		}
     7.6  
     7.7 -		/* filter by allowed return paths (= envelope sender) */
     7.8 -		if (!route_is_allowed_mail_local(route, msgout->msg->return_path)
     7.9 -		   || !route_is_allowed_return_path(route, msgout->msg->return_path)) {
    7.10 +		/* filter by allowed envelope sender */
    7.11 +		if (!route_sender_is_allowed(route, msgout->msg->return_path)) {
    7.12  			destroy_msg_out(msgout_cloned);
    7.13  			continue;
    7.14  		}
    7.15  
    7.16 -		/* filter by allowed rcpt addrs (= envelope rcpts) */
    7.17 -		GList *rcpt_list_allowed = NULL, *rcpt_list_notallowed = NULL;
    7.18 -		msg_rcptlist_route(route, msgout_cloned->rcpt_list, &rcpt_list_allowed, &rcpt_list_notallowed);
    7.19 -
    7.20 +		/* filter by allowed envelope rcpts */
    7.21 +		GList* rcpt_list_allowed = NULL;
    7.22 +		GList* rcpt_list_notallowed = NULL;
    7.23 +		route_split_rcpts(route, msgout_cloned->rcpt_list, &rcpt_list_allowed, &rcpt_list_notallowed);
    7.24  		if (!rcpt_list_allowed) {
    7.25  			destroy_msg_out(msgout_cloned);
    7.26  			continue;
    7.27  		}
    7.28 +
    7.29  		logwrite(LOG_NOTICE, "%s using '%s'\n", msgout->msg->uid, route->name);
    7.30  
    7.31  		g_list_free(msgout_cloned->rcpt_list);
     8.1 --- a/src/masqmail.h	Mon Apr 25 15:17:30 2011 +0200
     8.2 +++ b/src/masqmail.h	Thu Apr 28 09:55:06 2011 +0200
     8.3 @@ -84,12 +84,10 @@
     8.4  	gboolean is_local_net;
     8.5  	gboolean last_route;
     8.6  
     8.7 -	GList *allowed_return_paths;
     8.8 -	GList *not_allowed_return_paths;
     8.9 -	GList *allowed_mail_locals;
    8.10 -	GList *not_allowed_mail_locals;
    8.11 -	GList *allowed_rcpt_domains;
    8.12 -	GList *not_allowed_rcpt_domains;
    8.13 +	GList *allowed_senders;
    8.14 +	GList *denied_senders;
    8.15 +	GList *allowed_recipients;
    8.16 +	GList *denied_recipients;
    8.17  
    8.18  	interface *mail_host;
    8.19  	gchar *wrapper;
    8.20 @@ -390,7 +388,6 @@
    8.21  gboolean addr_is_delivered_children(address * addr);
    8.22  gboolean addr_is_finished_children(address * addr);
    8.23  gchar *addr_string(address * addr);
    8.24 -gint addr_match(address * addr1, address * addr2);
    8.25  
    8.26  /* accept.c */
    8.27  accept_error accept_message(FILE * in, message * msg, guint flags);
    8.28 @@ -493,9 +490,8 @@
    8.29  gboolean route_strip_msgout(connect_route * route, msg_out * msgout);
    8.30  msg_out *route_prepare_msgout(connect_route * route, msg_out * msgout);
    8.31  GList *route_msgout_list(connect_route * route, GList * msgout_list);
    8.32 -gboolean route_is_allowed_return_path(connect_route * route, address * ret_path);
    8.33 -gboolean route_is_allowed_mail_local(connect_route * route, address * ret_path);
    8.34 -void msg_rcptlist_route(connect_route * route, GList * rcpt_list, GList ** p_rcpt_list, GList ** p_non_rcpt_list);
    8.35 +gboolean route_sender_is_allowed(connect_route * route, address * ret_path);
    8.36 +void route_split_rcpts(connect_route * route, GList * rcpt_list, GList ** p_rcpt_list, GList ** p_non_rcpt_list);
    8.37  
    8.38  /* tables.c */
    8.39  table_pair *create_pair(gchar * key, gpointer value);
     9.1 --- a/src/route.c	Mon Apr 25 15:17:30 2011 +0200
     9.2 +++ b/src/route.c	Thu Apr 28 09:55:06 2011 +0200
     9.3 @@ -238,21 +238,34 @@
     9.4  }
     9.5  
     9.6  static gint
     9.7 -_g_list_addrcmp(gconstpointer a, gconstpointer b)
     9.8 +_g_list_addrcmp(gconstpointer pattern, gconstpointer addr)
     9.9  {
    9.10 -	return addr_match((address *) a, (address *) b);
    9.11 +	int res;
    9.12 +	address* patternaddr = (address*) pattern;
    9.13 +	address* stringaddr = (address*) addr;
    9.14 +
    9.15 +	DEBUG(6) debugf("_g_list_addrcmp: pattern `%s' `%s' on string `%s' `%s'\n",
    9.16 +	                patternaddr->local_part, patternaddr->domain,
    9.17 +	                stringaddr->local_part, stringaddr->domain);
    9.18 +	/* TODO: check if we should match here dependent on caseless_matching */
    9.19 +	res = fnmatch(patternaddr->local_part, stringaddr->local_part, 0);
    9.20 +	if (res != 0) {
    9.21 +		DEBUG(6) debugf("_g_list_addrcmp: ... failed on local_part\n");
    9.22 +		return res;
    9.23 +	}
    9.24 +	res = fnmatch(patternaddr->domain, stringaddr->domain, FNM_CASEFOLD);
    9.25 +	DEBUG(6) debugf("_g_list_addrcmp: ... %s\n", (res==0) ? "matched" : "failed on domain");
    9.26 +	return res;
    9.27  }
    9.28  
    9.29  gboolean
    9.30 -route_is_allowed_return_path(connect_route * route, address * ret_path)
    9.31 +route_sender_is_allowed(connect_route * route, address * ret_path)
    9.32  {
    9.33 -	if (route->not_allowed_return_paths != NULL) {
    9.34 -		if (g_list_find_custom(route->not_allowed_return_paths, ret_path, _g_list_addrcmp) != NULL) {
    9.35 -			return FALSE;
    9.36 -		}
    9.37 +	if (route->denied_senders && g_list_find_custom(route->denied_senders, ret_path, _g_list_addrcmp)) {
    9.38 +		return FALSE;
    9.39  	}
    9.40 -	if (route->allowed_return_paths != NULL) {
    9.41 -		if (g_list_find_custom(route->allowed_return_paths, ret_path, _g_list_addrcmp) != NULL) {
    9.42 +	if (route->allowed_senders) {
    9.43 +		if (g_list_find_custom(route->allowed_senders, ret_path, _g_list_addrcmp)) {
    9.44  			return TRUE;
    9.45  		} else {
    9.46  			return FALSE;
    9.47 @@ -261,49 +274,25 @@
    9.48  	return TRUE;
    9.49  }
    9.50  
    9.51 -static gint
    9.52 -_g_list_strcmp(gconstpointer a, gconstpointer b)
    9.53 -{
    9.54 -	return (gint) strcmp(a, b);
    9.55 -}
    9.56 -
    9.57 -gboolean
    9.58 -route_is_allowed_mail_local(connect_route * route, address * ret_path)
    9.59 -{
    9.60 -	gchar *loc_part = ret_path->local_part;
    9.61 -
    9.62 -	if (route->not_allowed_mail_locals != NULL) {
    9.63 -		if (g_list_find_custom(route->not_allowed_mail_locals, loc_part, _g_list_strcmp) != NULL)
    9.64 -			return FALSE;
    9.65 -	}
    9.66 -	if (route->allowed_mail_locals != NULL) {
    9.67 -		if (g_list_find_custom(route->allowed_mail_locals, loc_part, _g_list_strcmp) != NULL)
    9.68 -			return TRUE;
    9.69 -		else
    9.70 -			return FALSE;
    9.71 -	}
    9.72 -	return TRUE;
    9.73 -}
    9.74 -
    9.75  /*
    9.76     Make lists of matching/not matching rcpts.
    9.77     Local domains are NOT regared here, these should be sorted out previously
    9.78  */
    9.79  void
    9.80 -msg_rcptlist_route(connect_route * route, GList * rcpt_list, GList ** p_rcpt_list, GList ** p_non_rcpt_list)
    9.81 +route_split_rcpts(connect_route * route, GList * rcpt_list, GList ** p_rcpt_list, GList ** p_non_rcpt_list)
    9.82  {
    9.83  	GList *tmp_list = NULL;
    9.84  	/* sort out those domains that can be sent over this connection: */
    9.85 -	if (route->allowed_rcpt_domains) {
    9.86 -		DEBUG(5) debugf("testing for route->allowed_rcpt_domains\n");
    9.87 -		split_rcpts(rcpt_list, route->allowed_rcpt_domains, NULL, &tmp_list, p_non_rcpt_list);
    9.88 +	if (route->allowed_recipients) {
    9.89 +		DEBUG(5) debugf("testing for route->allowed_recipients\n");
    9.90 +		split_rcpts(rcpt_list, route->allowed_recipients, NULL, &tmp_list, p_non_rcpt_list);
    9.91  	} else {
    9.92 -		DEBUG(5) debugf("route->allowed_rcpt_domains == NULL\n");
    9.93 +		DEBUG(5) debugf("route->allowed_recipients == NULL\n");
    9.94  		tmp_list = g_list_copy(rcpt_list);
    9.95  	}
    9.96  
    9.97  	/* sort out those domains that cannot be sent over this connection: */
    9.98 -	split_rcpts(tmp_list, route->not_allowed_rcpt_domains, NULL, p_non_rcpt_list, p_rcpt_list);
    9.99 +	split_rcpts(tmp_list, route->denied_recipients, NULL, p_non_rcpt_list, p_rcpt_list);
   9.100  	g_list_free(tmp_list);
   9.101  }
   9.102