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

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

Issue 3150033: Fail rather than crash if username+password are unspecified for NTLM on Linux+OSX. (Closed)
Patch Set: Using MISSING_AUTH_CREDENTIALS Created 10 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
« no previous file with comments | « no previous file | no next file » | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #if !defined(NTLM_SSPI) 7 #if !defined(NTLM_SSPI)
8 #include "base/base64.h" 8 #include "base/base64.h"
9 #endif 9 #endif
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 10 matching lines...) Expand all
21 const HttpRequestInfo* request, 21 const HttpRequestInfo* request,
22 CompletionCallback* callback, 22 CompletionCallback* callback,
23 std::string* auth_token) { 23 std::string* auth_token) {
24 #if defined(NTLM_SSPI) 24 #if defined(NTLM_SSPI)
25 return auth_sspi_.GenerateAuthToken( 25 return auth_sspi_.GenerateAuthToken(
26 username, 26 username,
27 password, 27 password,
28 CreateSPN(origin_), 28 CreateSPN(origin_),
29 auth_token); 29 auth_token);
30 #else // !defined(NTLM_SSPI) 30 #else // !defined(NTLM_SSPI)
31 // TODO(cbentzel): Shouldn't be hitting this case.
32 if (!username || !password) {
33 LOG(ERROR) << "Username and password are expected to be non-NULL.";
34 return ERR_MISSING_AUTH_CREDENTIALS;
35 }
31 // TODO(wtc): See if we can use char* instead of void* for in_buf and 36 // TODO(wtc): See if we can use char* instead of void* for in_buf and
32 // out_buf. This change will need to propagate to GetNextToken, 37 // out_buf. This change will need to propagate to GetNextToken,
33 // GenerateType1Msg, and GenerateType3Msg, and perhaps further. 38 // GenerateType1Msg, and GenerateType3Msg, and perhaps further.
34 const void* in_buf; 39 const void* in_buf;
35 void* out_buf; 40 void* out_buf;
36 uint32 in_buf_len, out_buf_len; 41 uint32 in_buf_len, out_buf_len;
37 std::string decoded_auth_data; 42 std::string decoded_auth_data;
38 43
39 // |username| may be in the form "DOMAIN\user". Parse it into the two 44 // |username| may be in the form "DOMAIN\user". Parse it into the two
40 // components. 45 // components.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // static 119 // static
115 std::wstring HttpAuthHandlerNTLM::CreateSPN(const GURL& origin) { 120 std::wstring HttpAuthHandlerNTLM::CreateSPN(const GURL& origin) {
116 // The service principal name of the destination server. See 121 // The service principal name of the destination server. See
117 // http://msdn.microsoft.com/en-us/library/ms677949%28VS.85%29.aspx 122 // http://msdn.microsoft.com/en-us/library/ms677949%28VS.85%29.aspx
118 std::wstring target(L"HTTP/"); 123 std::wstring target(L"HTTP/");
119 target.append(ASCIIToWide(GetHostAndPort(origin))); 124 target.append(ASCIIToWide(GetHostAndPort(origin)));
120 return target; 125 return target;
121 } 126 }
122 127
123 } // namespace net 128 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698