hadoop-hdfs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Arpit Agarwal (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HDFS-5275) Target port chosen by Hftp/Hsftp for getting delegation token may be incorrect
Date Sat, 28 Sep 2013 01:19:02 GMT
Arpit Agarwal created HDFS-5275:

             Summary: Target port chosen by Hftp/Hsftp for getting delegation token may be
                 Key: HDFS-5275
                 URL: https://issues.apache.org/jira/browse/HDFS-5275
             Project: Hadoop HDFS
          Issue Type: Bug
          Components: security
    Affects Versions: 3.0.0
            Reporter: Arpit Agarwal

The port selection to get the delegation token is confusing. Also the code documentation and
tests appear to conflict.

The comment in {{HftpFileSystem#getCanonicalServiceName}} seems to indicate that the configured
secure port should be chosen, ignoring the port from the URI.
  public String getCanonicalServiceName() {
    // unlike other filesystems, hftp's service is the secure port, not the
    // actual port in the uri
    return SecurityUtil.buildTokenService(nnSecureUri).toString();

However {{TestHftpFileSystem#testHsftpCustomUriPortWithCustomDefaultPorts}} tests that the
returned port is the one from the URI.
public void testHsftpCustomUriPortWithCustomDefaultPorts() throws IOException {
  conf.setInt(DFSConfigKeys.DFS_NAMENODE_HTTPS_PORT_KEY, 456);

  URI uri = URI.create("hsftp://localhost:789");
  HsftpFileSystem fs = (HsftpFileSystem) FileSystem.get(uri, conf);

  assertEquals(456, fs.getDefaultPort());
  assertEquals(456, fs.getDefaultSecurePort());

  assertEquals(uri, fs.getUri());

The test still passes because of a confusing overload of getNamenodeSecureAddr by HsftpFileSystem.

Either the code needs to be fixed or we should document the behavior.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

View raw message