diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2007-03-19 15:25:14 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2007-03-19 15:25:14 +0000 |
commit | 97231604a8bb43cd56452edd84aa006b22abc26c (patch) | |
tree | f713eabebc74062a893edd992fb055b4b4cf83e8 /mflib | |
parent | 8d9cffd85d23a38fd3f794c594c1779401906688 (diff) | |
download | mailfromd-97231604a8bb43cd56452edd84aa006b22abc26c.tar.gz mailfromd-97231604a8bb43cd56452edd84aa006b22abc26c.tar.bz2 |
Update
git-svn-id: file:///svnroot/mailfromd/trunk@1295 7a8a7f39-df28-0410-adc6-e0d955640f24
Diffstat (limited to 'mflib')
-rw-r--r-- | mflib/Makefile.am | 1 | ||||
-rw-r--r-- | mflib/heloarg_test.mf | 35 | ||||
-rw-r--r-- | mflib/is_ip.mf | 13 | ||||
-rw-r--r-- | mflib/match_cidr.mf | 1 | ||||
-rw-r--r-- | mflib/match_dnsbl.mf | 27 | ||||
-rw-r--r-- | mflib/match_rhsbl.mf | 23 | ||||
-rw-r--r-- | mflib/revip.mf | 15 | ||||
-rw-r--r-- | mflib/strip_domain_part.mf | 11 |
8 files changed, 6 insertions, 120 deletions
diff --git a/mflib/Makefile.am b/mflib/Makefile.am index 75bb1ece..e778e1bb 100644 --- a/mflib/Makefile.am +++ b/mflib/Makefile.am @@ -30,3 +30,4 @@ inc_DATA =\ spf.mf\ strip_domain_part.mf\ valid_domain.mf +EXTRA_DIST=$(inc_DATA) diff --git a/mflib/heloarg_test.mf b/mflib/heloarg_test.mf index 41625c03..48587d39 100644 --- a/mflib/heloarg_test.mf +++ b/mflib/heloarg_test.mf @@ -16,39 +16,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -# number heloarg_test (string ARG, string REMOTE_IP, string LOCAL_IP) -# -# Verify if an argument of `HELO' (`EHLO') command is -# valid. Arguments: -# -# ARG -# `HELO' (`EHLO') argument. Typically, the value of $s -# Sendmail macro; -# -# REMOTE_IP -# IP address of the remote clinet. Typically, the value of -# $client_addr Sendmail macro; -# -# LOCAL_IP -# IP address of this SMTP server; -# -# If ARG passes all tests, the function returns `0'. -# Otherwise it returns a numeric error code. Increasing error codes -# correspond to increased strictness level of the performed check, as -# shown in the table below: -# -# -# Code Meaning -# --------------------------------------------------------------------- -# 1 ARG is our IP address. -# 2 ARG is an IP, but it does not match the remote party IP address. -# 3 ARG is an IP, but it does not resolve. -# 4 ARG is in square brackets, but it is not an IP address. -# 5 ARG is not an IP address and does not resolve to one. -# 6 ARG resolves to our server IP. -# 7 ARG does not resolve to the remote client IP address, -# - #include_once "is_ip.mf" #include_once "dns.mf" @@ -63,7 +30,7 @@ const HELO_ARGINVALID 5 # ARG is not an IP address and does not resolve # to one. const HELO_MYSERVERIP 6 # ARG resolves to our server IP. const HELO_IPMISMATCH 7 # ARG does not resolve to the remote client - # IP address, + # IP address #pragma regex push +extended diff --git a/mflib/is_ip.mf b/mflib/is_ip.mf index 8c631c1b..fc639a4c 100644 --- a/mflib/is_ip.mf +++ b/mflib/is_ip.mf @@ -16,21 +16,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -# boolean is_ip (string STR) -# -# Returns `true' if STR is a valid IPv4 address. For -# example: -# -# is_ip("1.2.3.4") => 1 -# is_ip("1.2.3.x") => 0 -# is_ip("blah") => 0 -# is_ip("255.255.255.255") => 1 -# is_ip("0.0.0.0") => 1 -# #pragma regex push +extended + func is_ip(string ip) returns number do return %ip matches '^([0-9]{1,3}\.){3}[0-9]{1,3}$' done + #pragma regex pop diff --git a/mflib/match_cidr.mf b/mflib/match_cidr.mf index 42da56d3..92b7248a 100644 --- a/mflib/match_cidr.mf +++ b/mflib/match_cidr.mf @@ -33,3 +33,4 @@ do done #pragma regex pop + diff --git a/mflib/match_dnsbl.mf b/mflib/match_dnsbl.mf index 7a204882..a361e156 100644 --- a/mflib/match_dnsbl.mf +++ b/mflib/match_dnsbl.mf @@ -16,33 +16,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -# boolean match_dnsbl (string ADDRESS, string ZONE, string RANGE) -# -# This function looks up the ADDRESS in the DNS -# blacklist zone ZONE and checks if the return matches -# given RANGE of IP addresses. -# -# It is intended as a replacement for the Sendmail macros `dnsbl' and -# `enhdnsbl'. -# -# Arguments: -# -# ADDRESS -# IP address of the SMTP server to be tested. -# -# ZONE -# FQDN of the DNSbl zone to test against. -# -# RANGE -# The range of IP addresses in CIDR notation or -# the word `ANY', which stands for `127.0.0.0/8'. -# -# The function returns true if dns lookup for ADDRESS in -# the zone DNSBL yields an IP that falls within the range, -# specified by CIDR. Otherwise, it returns false. If -# any of ADDRESS or CIDR is invalid, match_dnsbl -# returns false. -# #include_once "dns.mf" #include_once "match_cidr.mf" diff --git a/mflib/match_rhsbl.mf b/mflib/match_rhsbl.mf index 0727915f..4bb855c9 100644 --- a/mflib/match_rhsbl.mf +++ b/mflib/match_rhsbl.mf @@ -16,29 +16,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -# boolean match_rhsbl (string EMAIL, string ZONE, string RANGE) -# -# This function checks if the IP address, corresponding to the domain -# part of EMAIL is listed in the RHS DNS blacklist zone -# ZONE, and if so, whether its record matches the given range of -# IP addresses RANGE. -# -# It is intended as a replacement for the Sendmail macro `rhsbl' -# by Derek J. Balling. -# -# Arguments: -# -# EMAIL -# E-mail address, whose domain name should be tested (usually, it is -# $f) -# -# ZONE -# Domain name of the RHS DNS blacklist zone. -# -# RANGE -# The range of IP addresses in CIDR notation. -# - #include_once "dns.mf" #include_once "match_cidr.mf" diff --git a/mflib/revip.mf b/mflib/revip.mf index 6ade6a12..260bbe3c 100644 --- a/mflib/revip.mf +++ b/mflib/revip.mf @@ -16,20 +16,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -# string revip (string IP) -# -# Reverses octets in IP. -# -# Example: -# -# revip("127.0.0.1") => "1.0.0.127" -# -#pragma regex push +extended func revip(string ip) returns string do - if %ip matches '([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)' - return "\4.\3.\2.\1" - fi - return %ip + return inet_ntoa(ntohl(inet_aton(%ip))) done -#pragma regex pop diff --git a/mflib/strip_domain_part.mf b/mflib/strip_domain_part.mf index 0171461c..c6f8f920 100644 --- a/mflib/strip_domain_part.mf +++ b/mflib/strip_domain_part.mf @@ -16,17 +16,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -# string strip_domain_part (string DOMAIN, number N) -# -# Returns at most N last components of the domain name DOMAIN. -# If N is 0 the function is equivalent to domainpart. -# -# Examples: -# -# strip_domain_part("puszcza.gnu.org.ua", 2) => "org.ua" -# strip_domain_part("puszcza.gnu.org.ua", 0) => "gnu.org.ua" -# - #pragma regex push +extended func strip_domain_part(string domain, number n) returns string |