summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
097807e)
A common error is to specify an IP address as the result of an MX
lookup. The RFCs (974, 1035, 2181...) state that the result should be
a "domain name," which in this context, means "host name." This commit
adds a check on "hostname" fields that rejects a dotted-quad contained
therein. In particular, it catches the aforementioned MX record error.
1008 => 'integer out of bounds',
1009 => 'must have at least three labels to be valid as mail address',
1010 => 'must not be 2(NS), 5(CNAME), 6(SOA), 12(PTR), 15(MX) or 252(AXFR)',
1008 => 'integer out of bounds',
1009 => 'must have at least three labels to be valid as mail address',
1010 => 'must not be 2(NS), 5(CNAME), 6(SOA), 12(PTR), 15(MX) or 252(AXFR)',
+ 1011 => 'IP address found where hostname expected'
);
# NOTE : ONLY translate the right-hand part
);
# NOTE : ONLY translate the right-hand part
'x' => [ 5, sub {
my ($type, $s) = @_;
my $result = 0;
'x' => [ 5, sub {
my ($type, $s) = @_;
my $result = 0;
+
+ # Check to see if someone put an IP address in a hostname
+ # field. The motivation for this was MX records where many
+ # people expect an IP address to be a valid response, but I
+ # see no harm in enforcing it elsewhere.
+ return 1011 if $s =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\.?$/;
+
# check all parts
for (split /\./, $s)
{
# check all parts
for (split /\./, $s)
{