This is an automated email from the ASF dual-hosted git repository.

szetszwo pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new e48cd0e987d Revert "HDFS-17575. SaslDataTransferClient should use 
SaslParticipant to create messages. (#6933)"
e48cd0e987d is described below

commit e48cd0e987dfb6ef60341f0ff25a501582b7177c
Author: Tsz-Wo Nicholas Sze <szets...@apache.org>
AuthorDate: Sun Jul 21 19:07:19 2024 +0800

    Revert "HDFS-17575. SaslDataTransferClient should use SaslParticipant to 
create messages. (#6933)"
    
    This reverts commit 7638b4727e702725bcbfeb4addf3fc80078924b8.
---
 .../datatransfer/sasl/SaslDataTransferClient.java        | 16 ++++------------
 .../hdfs/protocol/datatransfer/sasl/SaslParticipant.java | 10 ++--------
 2 files changed, 6 insertions(+), 20 deletions(-)

diff --git 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/SaslDataTransferClient.java
 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/SaslDataTransferClient.java
index 960a5221dd1..043439130d5 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/SaslDataTransferClient.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/SaslDataTransferClient.java
@@ -63,7 +63,6 @@ import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.security.token.SecretManager;
 import org.apache.hadoop.security.token.Token;
 import org.apache.hadoop.util.Lists;
-import org.apache.hadoop.util.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -85,8 +84,6 @@ public class SaslDataTransferClient {
   private static final Logger LOG = LoggerFactory.getLogger(
       SaslDataTransferClient.class);
 
-  private static final byte[] EMPTY_BYTE_ARRAY = {};
-
   private final Configuration conf;
   private final AtomicBoolean fallbackToSimpleAuth;
   private final SaslPropertiesResolver saslPropsResolver;
@@ -522,29 +519,25 @@ public class SaslDataTransferClient {
       // In which case there will be no encrypted secret sent from NN.
       BlockTokenIdentifier blockTokenIdentifier =
           accessToken.decodeIdentifier();
-      final byte[] first = sasl.evaluateChallengeOrResponse(EMPTY_BYTE_ARRAY);
-      if (LOG.isDebugEnabled()) {
-        LOG.info("first: {}", first == null ? null : first.length == 0 ? 
"<empty>"
-            : StringUtils.byteToHexString(first));
-      }
       if (blockTokenIdentifier != null) {
         byte[] handshakeSecret =
             accessToken.decodeIdentifier().getHandshakeMsg();
         if (handshakeSecret == null || handshakeSecret.length == 0) {
           LOG.debug("Handshake secret is null, "
               + "sending without handshake secret.");
-          sendSaslMessage(out, first);
+          sendSaslMessage(out, new byte[0]);
         } else {
           LOG.debug("Sending handshake secret.");
           BlockTokenIdentifier identifier = new BlockTokenIdentifier();
           identifier.readFields(new DataInputStream(
               new ByteArrayInputStream(accessToken.getIdentifier())));
           String bpid = identifier.getBlockPoolId();
-          sendSaslMessageHandshakeSecret(out, first, handshakeSecret, bpid);
+          sendSaslMessageHandshakeSecret(out, new byte[0],
+              handshakeSecret, bpid);
         }
       } else {
         LOG.debug("Block token id is null, sending without handshake secret.");
-        sendSaslMessage(out, first);
+        sendSaslMessage(out, new byte[0]);
       }
 
       // step 1
@@ -572,7 +565,6 @@ public class SaslDataTransferClient {
           cipherOptions.add(option);
         }
       }
-      LOG.debug("{}: cipherOptions={}", sasl, cipherOptions);
       sendSaslMessageAndNegotiationCipherOptions(out, localResponse,
           cipherOptions);
 
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/SaslParticipant.java
 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/SaslParticipant.java
index ee8760d688a..e32f76a8ebd 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/SaslParticipant.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/SaslParticipant.java
@@ -20,7 +20,6 @@ package org.apache.hadoop.hdfs.protocol.datatransfer.sasl;
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.util.Map;
-import java.util.Objects;
 import javax.security.auth.callback.CallbackHandler;
 import javax.security.sasl.Sasl;
 import javax.security.sasl.SaslClient;
@@ -111,7 +110,7 @@ class SaslParticipant {
    * @param saslServer to wrap
    */
   private SaslParticipant(SaslServer saslServer) {
-    this.saslServer = Objects.requireNonNull(saslServer, "saslServer == null");
+    this.saslServer = saslServer;
     this.saslClient = null;
   }
 
@@ -122,7 +121,7 @@ class SaslParticipant {
    */
   private SaslParticipant(SaslClient saslClient) {
     this.saslServer = null;
-    this.saslClient = Objects.requireNonNull(saslClient, "saslClient == null");
+    this.saslClient = saslClient;
   }
 
   /**
@@ -229,9 +228,4 @@ class SaslParticipant {
           new SaslOutputStream(out, saslServer));
     }
   }
-
-  @Override
-  public String toString() {
-    return "Sasl" + (saslServer != null? "Server" : "Client");
-  }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to