Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: net/http/http_auth_handler_ntlm_portable.cc

Issue 448143008: Move StringToUpperASCII and LowerCaseEqualsASCII to the base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/http/http_auth_handler_ntlm.cc ('k') | net/http/http_auth_sspi_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 // 16-byte result buffer 254 // 16-byte result buffer
255 // 255 //
256 // Note: This function is not being used because our SendLM() function always 256 // Note: This function is not being used because our SendLM() function always
257 // returns false. 257 // returns false.
258 static void LM_Hash(const base::string16& password, uint8* hash) { 258 static void LM_Hash(const base::string16& password, uint8* hash) {
259 static const uint8 LM_MAGIC[] = "KGS!@#$%"; 259 static const uint8 LM_MAGIC[] = "KGS!@#$%";
260 260
261 // Convert password to OEM character set. We'll just use the native 261 // Convert password to OEM character set. We'll just use the native
262 // filesystem charset. 262 // filesystem charset.
263 std::string passbuf = base::SysWideToNativeMB(base::UTF16ToWide(password)); 263 std::string passbuf = base::SysWideToNativeMB(base::UTF16ToWide(password));
264 StringToUpperASCII(&passbuf); 264 base::StringToUpperASCII(&passbuf);
265 passbuf.resize(14, '\0'); 265 passbuf.resize(14, '\0');
266 266
267 uint8 k1[8], k2[8]; 267 uint8 k1[8], k2[8];
268 DESMakeKey(reinterpret_cast<const uint8*>(passbuf.data()) , k1); 268 DESMakeKey(reinterpret_cast<const uint8*>(passbuf.data()) , k1);
269 DESMakeKey(reinterpret_cast<const uint8*>(passbuf.data()) + 7, k2); 269 DESMakeKey(reinterpret_cast<const uint8*>(passbuf.data()) + 7, k2);
270 ZapString(&passbuf); 270 ZapString(&passbuf);
271 271
272 // Use password keys to hash LM magic string twice. 272 // Use password keys to hash LM magic string twice.
273 DESEncrypt(k1, LM_MAGIC, hash); 273 DESEncrypt(k1, LM_MAGIC, hash);
274 DESEncrypt(k2, LM_MAGIC, hash + 8); 274 DESEncrypt(k2, LM_MAGIC, hash + 8);
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « net/http/http_auth_handler_ntlm.cc ('k') | net/http/http_auth_sspi_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698