| 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 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 &principal_name); | 839 &principal_name); |
| 840 int rv = MapImportNameStatusToError(major_status); | 840 int rv = MapImportNameStatusToError(major_status); |
| 841 if (rv != OK) { | 841 if (rv != OK) { |
| 842 LOG(ERROR) << "Problem importing name from " | 842 LOG(ERROR) << "Problem importing name from " |
| 843 << "spn \"" << spn_principal << "\"\n" | 843 << "spn \"" << spn_principal << "\"\n" |
| 844 << DisplayExtendedStatus(library_, major_status, minor_status); | 844 << DisplayExtendedStatus(library_, major_status, minor_status); |
| 845 return rv; | 845 return rv; |
| 846 } | 846 } |
| 847 ScopedName scoped_name(principal_name, library_); | 847 ScopedName scoped_name(principal_name, library_); |
| 848 | 848 |
| 849 std::vector<char> channel_bindings_data; | |
| 850 std::unique_ptr<gss_channel_bindings_struct> gss_channel_bindings; | |
| 851 if (!channel_bindings.empty()) { | |
| 852 gss_channel_bindings.reset(new gss_channel_bindings_struct); | |
| 853 memset(gss_channel_bindings.get(), 0, sizeof(gss_channel_bindings_struct)); | |
| 854 channel_bindings_data.assign(channel_bindings.begin(), | |
| 855 channel_bindings.end()); | |
| 856 gss_channel_bindings->application_data.value = channel_bindings_data.data(); | |
| 857 gss_channel_bindings->application_data.length = | |
| 858 channel_bindings_data.size(); | |
| 859 } | |
| 860 | |
| 861 // Continue creating a security context. | 849 // Continue creating a security context. |
| 862 OM_uint32 req_flags = 0; | 850 OM_uint32 req_flags = 0; |
| 863 if (can_delegate_) | 851 if (can_delegate_) |
| 864 req_flags |= GSS_C_DELEG_FLAG; | 852 req_flags |= GSS_C_DELEG_FLAG; |
| 865 major_status = library_->init_sec_context( | 853 major_status = library_->init_sec_context( |
| 866 &minor_status, GSS_C_NO_CREDENTIAL, scoped_sec_context_.receive(), | 854 &minor_status, GSS_C_NO_CREDENTIAL, scoped_sec_context_.receive(), |
| 867 principal_name, gss_oid_, req_flags, GSS_C_INDEFINITE, | 855 principal_name, gss_oid_, req_flags, GSS_C_INDEFINITE, |
| 868 gss_channel_bindings ? gss_channel_bindings.get() | 856 GSS_C_NO_CHANNEL_BINDINGS, in_token, |
| 869 : GSS_C_NO_CHANNEL_BINDINGS, | |
| 870 in_token, | |
| 871 nullptr, // actual_mech_type | 857 nullptr, // actual_mech_type |
| 872 out_token, | 858 out_token, |
| 873 nullptr, // ret flags | 859 nullptr, // ret flags |
| 874 nullptr); | 860 nullptr); |
| 875 rv = MapInitSecContextStatusToError(major_status); | 861 rv = MapInitSecContextStatusToError(major_status); |
| 876 if (rv != OK) { | 862 if (rv != OK) { |
| 877 LOG(ERROR) << "Problem initializing context. \n" | 863 LOG(ERROR) << "Problem initializing context. \n" |
| 878 << DisplayExtendedStatus(library_, major_status, minor_status) | 864 << DisplayExtendedStatus(library_, major_status, minor_status) |
| 879 << '\n' | 865 << '\n' |
| 880 << DescribeContext(library_, scoped_sec_context_.get()); | 866 << DescribeContext(library_, scoped_sec_context_.get()); |
| 881 } | 867 } |
| 882 return rv; | 868 return rv; |
| 883 } | 869 } |
| 884 | 870 |
| 885 } // namespace net | 871 } // namespace net |
| OLD | NEW |