comparison src/address.c @ 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 bc9d9cd9ee8e
children 41958685480d
comparison
equal deleted inserted replaced
316:d596ac8b5afb 317:55b7bde95d37
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */ 17 */
18 18
19 #include "masqmail.h" 19 #include "masqmail.h"
20 #include <fnmatch.h>
21 20
22 address* 21 address*
23 create_address(gchar * path, gboolean is_rfc821) 22 create_address(gchar * path, gboolean is_rfc821)
24 { 23 {
25 address *addr; 24 address *addr;
184 } else { 183 } else {
185 buffer = g_strdup_printf("<%s@%s>", addr->local_part ? addr->local_part : "", addr->domain ? addr->domain : ""); 184 buffer = g_strdup_printf("<%s@%s>", addr->local_part ? addr->local_part : "", addr->domain ? addr->domain : "");
186 } 185 }
187 return buffer; 186 return buffer;
188 } 187 }
189
190 gint
191 addr_match(address * addr1, address * addr2)
192 {
193 int res;
194
195 if ((res = fnmatch(addr1->local_part, addr2->local_part, 0)) == 0) {
196 if ((res = fnmatch(addr1->domain, addr2->domain, FNM_CASEFOLD)) == 0)
197 return 0;
198 }
199 return res;
200 }