Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-14176

Replace incorrect use of system property user.name

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.3.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      Kerberized

      Description

      Looking at the Hadoop source code, there are a few places where the code assumes the user name can be acquired from Java's system property user.name.

      For example,

      FileSystem
      /** Return the current user's home directory in this FileSystem.
         * The default implementation returns {@code "/user/$USER/"}.
         */
        public Path getHomeDirectory() {
          return this.makeQualified(
              new Path(USER_HOME_PREFIX + "/" + System.getProperty("user.name")));
        }
      

      This is incorrect, as in a Kerberized environment, a user may login as a user principal different from its system login account.

      It would be better to use UserGroupInformation.getCurrentUser().getShortUserName(), similar to HDFS-12485.

      Unfortunately, I am seeing this improper use in Yarn, HDFS federation SFTPFilesystem and Ozone code (tests are ignored)

      The impact should be small, since it only affects the case where system is Kerberized and that the user principal is different from system login account.

        Attachments

        1. HDFS-14176.01.patch
          3 kB
          Dinesh Chitlangia
        2. HDFS-14176.02.patch
          3 kB
          Dinesh Chitlangia
        3. HDFS-14176.03.patch
          3 kB
          Dinesh Chitlangia
        4. HDFS-14176.04.patch
          3 kB
          Dinesh Chitlangia

          Issue Links

            Activity

              People

              • Assignee:
                dineshchitlangia Dinesh Chitlangia
                Reporter:
                weichiu Wei-Chiu Chuang
              • Votes:
                2 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: