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