OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/http/http_auth_handler_ntlm.h" | 5 #include "net/http/http_auth_handler_ntlm.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 // For gethostname | 8 // For gethostname |
9 #if defined(OS_POSIX) | 9 #if defined(OS_POSIX) |
10 #include <unistd.h> | 10 #include <unistd.h> |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 uint8 temp[16]; | 554 uint8 temp[16]; |
555 | 555 |
556 memcpy(lm_resp, rand_8_bytes, 8); | 556 memcpy(lm_resp, rand_8_bytes, 8); |
557 memset(lm_resp + 8, 0, LM_RESP_LEN - 8); | 557 memset(lm_resp + 8, 0, LM_RESP_LEN - 8); |
558 | 558 |
559 memcpy(temp, msg.challenge, 8); | 559 memcpy(temp, msg.challenge, 8); |
560 memcpy(temp + 8, lm_resp, 8); | 560 memcpy(temp + 8, lm_resp, 8); |
561 base::MD5Sum(temp, 16, &session_hash); | 561 base::MD5Sum(temp, 16, &session_hash); |
562 | 562 |
563 NTLM_Hash(password, ntlm_hash); | 563 NTLM_Hash(password, ntlm_hash); |
564 LM_Response(ntlm_hash, session_hash.a, ntlm_resp); | 564 LM_Response(ntlm_hash, session_hash, ntlm_resp); |
565 } else { | 565 } else { |
566 NTLM_Hash(password, ntlm_hash); | 566 NTLM_Hash(password, ntlm_hash); |
567 LM_Response(ntlm_hash, msg.challenge, ntlm_resp); | 567 LM_Response(ntlm_hash, msg.challenge, ntlm_resp); |
568 | 568 |
569 if (SendLM()) { | 569 if (SendLM()) { |
570 uint8 lm_hash[LM_HASH_LEN]; | 570 uint8 lm_hash[LM_HASH_LEN]; |
571 LM_Hash(password, lm_hash); | 571 LM_Hash(password, lm_hash); |
572 LM_Response(lm_hash, msg.challenge, lm_resp); | 572 LM_Response(lm_hash, msg.challenge, lm_resp); |
573 } else { | 573 } else { |
574 // According to http://davenport.sourceforge.net/ntlm.html#ntlmVersion2, | 574 // According to http://davenport.sourceforge.net/ntlm.html#ntlmVersion2, |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 // NOTE: Default credentials are not supported for the portable implementation | 725 // NOTE: Default credentials are not supported for the portable implementation |
726 // of NTLM. | 726 // of NTLM. |
727 scoped_ptr<HttpAuthHandler> tmp_handler(new HttpAuthHandlerNTLM); | 727 scoped_ptr<HttpAuthHandler> tmp_handler(new HttpAuthHandlerNTLM); |
728 if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) | 728 if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) |
729 return ERR_INVALID_RESPONSE; | 729 return ERR_INVALID_RESPONSE; |
730 handler->swap(tmp_handler); | 730 handler->swap(tmp_handler); |
731 return OK; | 731 return OK; |
732 } | 732 } |
733 | 733 |
734 } // namespace net | 734 } // namespace net |
OLD | NEW |