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

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

Issue 86913002: Make base::Base64Encode() return void (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: One more chromeos-specific fix. Created 7 years 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 | « net/http/http_auth_handler_basic.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 in_buf = decoded_auth_data.data(); 82 in_buf = decoded_auth_data.data();
83 } 83 }
84 84
85 int rv = GetNextToken(in_buf, in_buf_len, &out_buf, &out_buf_len); 85 int rv = GetNextToken(in_buf, in_buf_len, &out_buf, &out_buf_len);
86 if (rv != OK) 86 if (rv != OK)
87 return rv; 87 return rv;
88 88
89 // Base64 encode data in output buffer and prepend "NTLM ". 89 // Base64 encode data in output buffer and prepend "NTLM ".
90 std::string encode_input(static_cast<char*>(out_buf), out_buf_len); 90 std::string encode_input(static_cast<char*>(out_buf), out_buf_len);
91 std::string encode_output; 91 std::string encode_output;
92 bool base64_rv = base::Base64Encode(encode_input, &encode_output); 92 base::Base64Encode(encode_input, &encode_output);
93 // OK, we are done with |out_buf| 93 // OK, we are done with |out_buf|
94 free(out_buf); 94 free(out_buf);
95 if (!base64_rv) {
96 LOG(ERROR) << "Unexpected problem Base64 encoding.";
97 return ERR_UNEXPECTED;
98 }
99 *auth_token = std::string("NTLM ") + encode_output; 95 *auth_token = std::string("NTLM ") + encode_output;
100 return OK; 96 return OK;
101 #endif 97 #endif
102 } 98 }
103 99
104 // The NTLM challenge header looks like: 100 // The NTLM challenge header looks like:
105 // WWW-Authenticate: NTLM auth-data 101 // WWW-Authenticate: NTLM auth-data
106 HttpAuth::AuthorizationResult HttpAuthHandlerNTLM::ParseChallenge( 102 HttpAuth::AuthorizationResult HttpAuthHandlerNTLM::ParseChallenge(
107 HttpAuth::ChallengeTokenizer* tok, bool initial_challenge) { 103 HttpAuth::ChallengeTokenizer* tok, bool initial_challenge) {
108 #if defined(NTLM_SSPI) 104 #if defined(NTLM_SSPI)
(...skipping 29 matching lines...) Expand all
138 // static 134 // static
139 std::string HttpAuthHandlerNTLM::CreateSPN(const GURL& origin) { 135 std::string HttpAuthHandlerNTLM::CreateSPN(const GURL& origin) {
140 // The service principal name of the destination server. See 136 // The service principal name of the destination server. See
141 // http://msdn.microsoft.com/en-us/library/ms677949%28VS.85%29.aspx 137 // http://msdn.microsoft.com/en-us/library/ms677949%28VS.85%29.aspx
142 std::string target("HTTP/"); 138 std::string target("HTTP/");
143 target.append(GetHostAndPort(origin)); 139 target.append(GetHostAndPort(origin));
144 return target; 140 return target;
145 } 141 }
146 142
147 } // namespace net 143 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_handler_basic.cc ('k') | net/http/http_auth_sspi_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698