Siyao Meng created HADOOP-20020:
-----------------------------------

             Summary: DNS.reverseDns throws NullPointerException when the 
answer has no PTR record
                 Key: HADOOP-20020
                 URL: https://issues.apache.org/jira/browse/HADOOP-20020
             Project: Hadoop Common
          Issue Type: Bug
            Reporter: Siyao Meng
            Assignee: Siyao Meng


{{DNS.reverseDns}} reads {{attribute.get("PTR").get()}} without a null check. 
When the DNS server answers the reverse query with NOERROR but no PTR record (a 
NODATA answer), JNDI returns no PTR attribute and {{reverseDns}} throws 
{{NullPointerException}}.

The callers, {{DNS.getHosts}} and {{DNSDomainNameResolver.getHostnameByIP}}, 
only catch {{NamingException}}, so the exception escapes instead of falling 
back. Through {{getHostnameByIP}} it reaches 
{{SecurityUtil.getServerPrincipal(String, InetAddress)}} and 
{{ServiceAuthorizationManager.authorize}}. A name that does not exist 
(NXDOMAIN) already fails with {{NameNotFoundException}} and is handled.

Throw {{NameNotFoundException}} when the answer has no PTR record. This applies 
to IPv4 and IPv6 addresses alike. It was seen with a resolver that answers 
NODATA for the {{ip6.arpa}} name of {{::}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to