| 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_gssapi_posix.h" | 5 #include "net/http/http_auth_gssapi_posix.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER; | 727 gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER; |
| 728 ScopedBuffer scoped_output_token(&output_token, library_); | 728 ScopedBuffer scoped_output_token(&output_token, library_); |
| 729 int rv = GetNextSecurityToken(spn, &input_token, &output_token); | 729 int rv = GetNextSecurityToken(spn, &input_token, &output_token); |
| 730 if (rv != OK) | 730 if (rv != OK) |
| 731 return rv; | 731 return rv; |
| 732 | 732 |
| 733 // Base64 encode data in output buffer and prepend the scheme. | 733 // Base64 encode data in output buffer and prepend the scheme. |
| 734 std::string encode_input(static_cast<char*>(output_token.value), | 734 std::string encode_input(static_cast<char*>(output_token.value), |
| 735 output_token.length); | 735 output_token.length); |
| 736 std::string encode_output; | 736 std::string encode_output; |
| 737 bool base64_rv = base::Base64Encode(encode_input, &encode_output); | 737 base::Base64Encode(encode_input, &encode_output); |
| 738 if (!base64_rv) { | |
| 739 LOG(ERROR) << "Base64 encoding of auth token failed."; | |
| 740 return ERR_ENCODING_CONVERSION_FAILED; | |
| 741 } | |
| 742 *auth_token = scheme_ + " " + encode_output; | 738 *auth_token = scheme_ + " " + encode_output; |
| 743 return OK; | 739 return OK; |
| 744 } | 740 } |
| 745 | 741 |
| 746 | 742 |
| 747 namespace { | 743 namespace { |
| 748 | 744 |
| 749 // GSSAPI status codes consist of a calling error (essentially, a programmer | 745 // GSSAPI status codes consist of a calling error (essentially, a programmer |
| 750 // bug), a routine error (defined by the RFC), and supplementary information, | 746 // bug), a routine error (defined by the RFC), and supplementary information, |
| 751 // all bitwise-or'ed together in different regions of the 32 bit return value. | 747 // all bitwise-or'ed together in different regions of the 32 bit return value. |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 if (rv != OK) { | 880 if (rv != OK) { |
| 885 LOG(ERROR) << "Problem initializing context. \n" | 881 LOG(ERROR) << "Problem initializing context. \n" |
| 886 << DisplayExtendedStatus(library_, major_status, minor_status) | 882 << DisplayExtendedStatus(library_, major_status, minor_status) |
| 887 << '\n' | 883 << '\n' |
| 888 << DescribeContext(library_, scoped_sec_context_.get()); | 884 << DescribeContext(library_, scoped_sec_context_.get()); |
| 889 } | 885 } |
| 890 return rv; | 886 return rv; |
| 891 } | 887 } |
| 892 | 888 |
| 893 } // namespace net | 889 } // namespace net |
| OLD | NEW |