Site administrators often do not wish to accept mail from hosts that
do not have a proper reverse delegation in the Domain Name System.
In the previous section we introduced the library function
hostname
, that looks up in the DNS the name corresponding to
the IP address specified as its argument. If there is no
corresponding name, the function returns its argument unchanged. This
can be used to test if the IP was resolved, as illustrated in the
example below:
require 'dns' prog envfrom do if hostname($client_addr) = $client_addr reject fi done
The #require dns
statement loads the module dns.mf,
after which the definition of hostname
becomes available.
A similar function, resolve
, which resolves the symbolic
name to the corresponding IP address is provided in the same
dns.mf module.
This document was generated on August 13, 2022 using makeinfo.
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.