Skip to content

Commit 86d8fa6

Browse files
authored
HDFS-17679 Use saslClient#hasInitialResponse() instead of heuristics in SaslParticipant#createFirstMessage() (#7201)
1 parent 2c2beb7 commit 86d8fa6

File tree

1 file changed

+7
-2
lines changed
  • hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl

1 file changed

+7
-2
lines changed

hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/SaslParticipant.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,13 @@ private SaslParticipant(SaslClient saslClient) {
127127
}
128128

129129
byte[] createFirstMessage() throws SaslException {
130-
return SaslMechanismFactory.isDefaultMechanism(MECHANISM_ARRAY[0]) ? EMPTY_BYTE_ARRAY
131-
: evaluateChallengeOrResponse(EMPTY_BYTE_ARRAY);
130+
if (saslClient != null) {
131+
return saslClient.hasInitialResponse()
132+
? saslClient.evaluateChallenge(EMPTY_BYTE_ARRAY)
133+
: EMPTY_BYTE_ARRAY;
134+
}
135+
throw new IllegalStateException(
136+
"createFirstMessage must only be called for clients");
132137
}
133138

134139
/**

0 commit comments

Comments
 (0)