Browse Source

HDFS-11069. Tighten the authorization of datanode RPC. Contributed by Kihwal Lee

(cherry picked from commit ae48c496dce8d0eae4571fc64e6850d602bae688)
Kihwal Lee 8 years ago
parent
commit
40dbf2a18d

+ 3 - 3
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java

@@ -982,7 +982,7 @@ public class DataNode extends ReconfigurableBase
 
 
     // Is this by the DN user itself?
     // Is this by the DN user itself?
     assert dnUserName != null;
     assert dnUserName != null;
-    if (callerUgi.getShortUserName().equals(dnUserName)) {
+    if (callerUgi.getUserName().equals(dnUserName)) {
       return;
       return;
     }
     }
 
 
@@ -1300,7 +1300,7 @@ public class DataNode extends ReconfigurableBase
     this.blockPoolTokenSecretManager = new BlockPoolTokenSecretManager();
     this.blockPoolTokenSecretManager = new BlockPoolTokenSecretManager();
 
 
     // Login is done by now. Set the DN user name.
     // Login is done by now. Set the DN user name.
-    dnUserName = UserGroupInformation.getCurrentUser().getShortUserName();
+    dnUserName = UserGroupInformation.getCurrentUser().getUserName();
     LOG.info("dnUserName = " + dnUserName);
     LOG.info("dnUserName = " + dnUserName);
     LOG.info("supergroup = " + supergroup);
     LOG.info("supergroup = " + supergroup);
     initIpcServer(conf);
     initIpcServer(conf);
@@ -3307,4 +3307,4 @@ public class DataNode extends ReconfigurableBase
   void setBlockScanner(BlockScanner blockScanner) {
   void setBlockScanner(BlockScanner blockScanner) {
     this.blockScanner = blockScanner;
     this.blockScanner = blockScanner;
   }
   }
-}
+}