diff options
Diffstat (limited to 'mflib/match_dnsbl.mf')
-rw-r--r-- | mflib/match_dnsbl.mf | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/mflib/match_dnsbl.mf b/mflib/match_dnsbl.mf index 0621a98c..53603be5 100644 --- a/mflib/match_dnsbl.mf +++ b/mflib/match_dnsbl.mf @@ -1,5 +1,6 @@ /* DNSBL checker. Copyright (C) 2006, 2007 Jan Rafaj + Copyright (C) 2008 Sergey Poznyakoff This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,27 +20,26 @@ #pragma regex push +extended -func match_dnsbl(string address, string zone, string range) +func match_dnsbl(string address, string zone, string iprange) returns number do - string rbl_ip - if %range = 'ANY' - set rbl_ip '127.0.0.0/8' + if %iprange = 'ANY' + set iprange '127.0.0.0/8' + m4_ifdef(`COMPAT_4_3',` else - set rbl_ip %range - if not %range matches '^([0-9]{1,3}\.){3}[0-9]{1,3}$' + if not %iprange matches `'''`^([0-9]{1,3}\.){3}[0-9]{1,3}/[0-9]{1,2}$`'''` return 0 fi fi - if not (%address matches '^([0-9]{1,3}\.){3}[0-9]{1,3}$' - and %address != %range) - return 0 + if not (%address matches `'''`^([0-9]{1,3}\.){3}[0-9]{1,3}$`'''` + and %address != %iprange) + return 0') fi if %address matches '^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$' - if match_cidr (resolve ("\4.\3.\2.\1", %zone), %rbl_ip) + if match_cidr (resolve ("\4.\3.\2.\1", %zone), %iprange) return 1 else return 0 |