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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 dword = SWAP32(dword); | 188 dword = SWAP32(dword); |
189 #endif | 189 #endif |
190 return WriteBytes(buf, &dword, sizeof(dword)); | 190 return WriteBytes(buf, &dword, sizeof(dword)); |
191 } | 191 } |
192 | 192 |
193 static void* WriteSecBuf(void* buf, uint16 length, uint32 offset) { | 193 static void* WriteSecBuf(void* buf, uint16 length, uint32 offset) { |
194 #ifdef IS_BIG_ENDIAN | 194 #ifdef IS_BIG_ENDIAN |
195 length = SWAP16(length); | 195 length = SWAP16(length); |
196 offset = SWAP32(offset); | 196 offset = SWAP32(offset); |
197 #endif | 197 #endif |
| 198 // Len: 2 bytes. |
198 buf = WriteBytes(buf, &length, sizeof(length)); | 199 buf = WriteBytes(buf, &length, sizeof(length)); |
| 200 // MaxLen: 2 bytes. The sender should set it to the value of Len. The |
| 201 // recipient must ignore it. |
199 buf = WriteBytes(buf, &length, sizeof(length)); | 202 buf = WriteBytes(buf, &length, sizeof(length)); |
| 203 // BufferOffset: 4 bytes. |
200 buf = WriteBytes(buf, &offset, sizeof(offset)); | 204 buf = WriteBytes(buf, &offset, sizeof(offset)); |
201 return buf; | 205 return buf; |
202 } | 206 } |
203 | 207 |
204 #ifdef IS_BIG_ENDIAN | 208 #ifdef IS_BIG_ENDIAN |
205 /** | 209 /** |
206 * WriteUnicodeLE copies a unicode string from one buffer to another. The | 210 * WriteUnicodeLE copies a unicode string from one buffer to another. The |
207 * resulting unicode string is in little-endian format. The input string is | 211 * resulting unicode string is in little-endian format. The input string is |
208 * assumed to be in the native endianness of the local machine. It is safe | 212 * assumed to be in the native endianness of the local machine. It is safe |
209 * to pass the same buffer as both input and output, which is a handy way to | 213 * to pass the same buffer as both input and output, which is a handy way to |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 // NOTE: Default credentials are not supported for the portable implementation | 725 // NOTE: Default credentials are not supported for the portable implementation |
722 // of NTLM. | 726 // of NTLM. |
723 scoped_ptr<HttpAuthHandler> tmp_handler(new HttpAuthHandlerNTLM); | 727 scoped_ptr<HttpAuthHandler> tmp_handler(new HttpAuthHandlerNTLM); |
724 if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) | 728 if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) |
725 return ERR_INVALID_RESPONSE; | 729 return ERR_INVALID_RESPONSE; |
726 handler->swap(tmp_handler); | 730 handler->swap(tmp_handler); |
727 return OK; | 731 return OK; |
728 } | 732 } |
729 | 733 |
730 } // namespace net | 734 } // namespace net |
OLD | NEW |