| OLD | NEW |
| 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 #ifndef NET_HTTP_HTTP_AUTH_GSSAPI_POSIX_H_ | 5 #ifndef NET_HTTP_HTTP_AUTH_GSSAPI_POSIX_H_ |
| 6 #define NET_HTTP_HTTP_AUTH_GSSAPI_POSIX_H_ | 6 #define NET_HTTP_HTTP_AUTH_GSSAPI_POSIX_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <gssapi.h> | |
| 10 | |
| 11 #include <string> | 9 #include <string> |
| 12 | 10 |
| 13 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 14 #include "base/native_library.h" | 12 #include "base/native_library.h" |
| 15 #include "base/string16.h" | 13 #include "base/string16.h" |
| 16 #include "net/base/net_export.h" | 14 #include "net/base/net_export.h" |
| 17 #include "net/http/http_auth.h" | 15 #include "net/http/http_auth.h" |
| 18 | 16 |
| 17 #define GSS_USE_FUNCTION_POINTERS |
| 18 #include "net/third_party/gssapi/gssapi.h" |
| 19 |
| 19 namespace net { | 20 namespace net { |
| 20 | 21 |
| 21 NET_EXPORT_PRIVATE extern gss_OID CHROME_GSS_C_NT_HOSTBASED_SERVICE_X; | 22 NET_EXPORT_PRIVATE extern gss_OID CHROME_GSS_C_NT_HOSTBASED_SERVICE_X; |
| 22 NET_EXPORT_PRIVATE extern gss_OID CHROME_GSS_C_NT_HOSTBASED_SERVICE; | 23 NET_EXPORT_PRIVATE extern gss_OID CHROME_GSS_C_NT_HOSTBASED_SERVICE; |
| 23 NET_EXPORT_PRIVATE extern gss_OID CHROME_GSS_KRB5_MECH_OID_DESC; | 24 NET_EXPORT_PRIVATE extern gss_OID CHROME_GSS_KRB5_MECH_OID_DESC; |
| 24 | 25 |
| 25 // GSSAPILibrary is introduced so unit tests can mock the calls to the GSSAPI | 26 // GSSAPILibrary is introduced so unit tests can mock the calls to the GSSAPI |
| 26 // library. The default implementation attempts to load one of the standard | 27 // library. The default implementation attempts to load one of the standard |
| 27 // GSSAPI library implementations, then simply passes the arguments on to | 28 // GSSAPI library implementations, then simply passes the arguments on to |
| 28 // that implementation. | 29 // that implementation. |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 const gss_ctx_id_t context_handle, | 161 const gss_ctx_id_t context_handle, |
| 161 gss_name_t* src_name, | 162 gss_name_t* src_name, |
| 162 gss_name_t* targ_name, | 163 gss_name_t* targ_name, |
| 163 OM_uint32* lifetime_rec, | 164 OM_uint32* lifetime_rec, |
| 164 gss_OID* mech_type, | 165 gss_OID* mech_type, |
| 165 OM_uint32* ctx_flags, | 166 OM_uint32* ctx_flags, |
| 166 int* locally_initiated, | 167 int* locally_initiated, |
| 167 int* open); | 168 int* open); |
| 168 | 169 |
| 169 private: | 170 private: |
| 170 typedef typeof(&gss_import_name) gss_import_name_type; | |
| 171 typedef typeof(&gss_release_name) gss_release_name_type; | |
| 172 typedef typeof(&gss_release_buffer) gss_release_buffer_type; | |
| 173 typedef typeof(&gss_display_name) gss_display_name_type; | |
| 174 typedef typeof(&gss_display_status) gss_display_status_type; | |
| 175 typedef typeof(&gss_init_sec_context) gss_init_sec_context_type; | |
| 176 typedef typeof(&gss_wrap_size_limit) gss_wrap_size_limit_type; | |
| 177 typedef typeof(&gss_delete_sec_context) gss_delete_sec_context_type; | |
| 178 typedef typeof(&gss_inquire_context) gss_inquire_context_type; | |
| 179 | |
| 180 FRIEND_TEST_ALL_PREFIXES(HttpAuthGSSAPIPOSIXTest, GSSAPIStartup); | 171 FRIEND_TEST_ALL_PREFIXES(HttpAuthGSSAPIPOSIXTest, GSSAPIStartup); |
| 181 | 172 |
| 182 bool InitImpl(); | 173 bool InitImpl(); |
| 183 // Finds a usable dynamic library for GSSAPI and loads it. The criteria are: | 174 // Finds a usable dynamic library for GSSAPI and loads it. The criteria are: |
| 184 // 1. The library must exist. | 175 // 1. The library must exist. |
| 185 // 2. The library must export the functions we need. | 176 // 2. The library must export the functions we need. |
| 186 base::NativeLibrary LoadSharedLibrary(); | 177 base::NativeLibrary LoadSharedLibrary(); |
| 187 bool BindMethods(base::NativeLibrary lib); | 178 bool BindMethods(base::NativeLibrary lib); |
| 188 | 179 |
| 189 bool initialized_; | 180 bool initialized_; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 gss_OID gss_oid_; | 255 gss_OID gss_oid_; |
| 265 GSSAPILibrary* library_; | 256 GSSAPILibrary* library_; |
| 266 std::string decoded_server_auth_token_; | 257 std::string decoded_server_auth_token_; |
| 267 ScopedSecurityContext scoped_sec_context_; | 258 ScopedSecurityContext scoped_sec_context_; |
| 268 bool can_delegate_; | 259 bool can_delegate_; |
| 269 }; | 260 }; |
| 270 | 261 |
| 271 } // namespace net | 262 } // namespace net |
| 272 | 263 |
| 273 #endif // NET_HTTP_HTTP_AUTH_GSSAPI_POSIX_H_ | 264 #endif // NET_HTTP_HTTP_AUTH_GSSAPI_POSIX_H_ |
| OLD | NEW |