@@ -204,9 +204,17 @@ public function encode(
204204 );
205205 }
206206
207- if (null !== $ lm_hash && $ calculate_lm_response || null !== $ client_challenge ) {
207+ // If we have a client challenge, extended session security must be negotiated
208+ if (null !== $ client_challenge ) {
209+ // Set the LM challenge response to the client challenge, null-padded to the expected length
210+ $ lm_challenge_response = str_pad (
211+ $ client_challenge ,
212+ static ::LM_RESPONSE_LENGTH ,
213+ static ::NULL_PAD_CHARACTER
214+ );
215+ } elseif (null !== $ lm_hash && $ calculate_lm_response ) {
208216 $ lm_challenge_response = $ this ->calculateLmResponse (
209- $ lm_hash ?: $ nt_hash ,
217+ $ lm_hash ,
210218 $ client_challenge ,
211219 $ server_challenge_nonce
212220 );
@@ -246,19 +254,7 @@ public function calculateLmResponse(
246254 $ client_challenge = null ,
247255 $ server_challenge_nonce = null
248256 ) {
249- // If we have a client challenge, extended session security must be negotiated
250- if (null !== $ client_challenge ) {
251- // Set the LM challenge response to the client challenge, null-padded to the expected length
252- $ lm_challenge_response = str_pad (
253- $ client_challenge ,
254- static ::LM_RESPONSE_LENGTH ,
255- static ::NULL_PAD_CHARACTER
256- );
257- } else {
258- $ lm_challenge_response = $ this ->calculateChallengeResponseData ($ hash_credential , $ server_challenge_nonce );
259- }
260-
261- return $ lm_challenge_response ;
257+ return $ this ->calculateChallengeResponseData ($ hash_credential , $ server_challenge_nonce );
262258 }
263259
264260 /**
0 commit comments