| 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_MOCK_GSSAPI_LIBRARY_POSIX_H_ | 5 #ifndef NET_HTTP_MOCK_GSSAPI_LIBRARY_POSIX_H_ |
| 6 #define NET_HTTP_MOCK_GSSAPI_LIBRARY_POSIX_H_ | 6 #define NET_HTTP_MOCK_GSSAPI_LIBRARY_POSIX_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 std::string expected_package; | 67 std::string expected_package; |
| 68 OM_uint32 response_code; | 68 OM_uint32 response_code; |
| 69 OM_uint32 minor_response_code; | 69 OM_uint32 minor_response_code; |
| 70 test::GssContextMockImpl context_info; | 70 test::GssContextMockImpl context_info; |
| 71 gss_buffer_desc expected_input_token; | 71 gss_buffer_desc expected_input_token; |
| 72 gss_buffer_desc output_token; | 72 gss_buffer_desc output_token; |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 MockGSSAPILibrary(); | 75 MockGSSAPILibrary(); |
| 76 virtual ~MockGSSAPILibrary(); | 76 ~MockGSSAPILibrary() override; |
| 77 | 77 |
| 78 // Establishes an expectation for a |init_sec_context()| call. | 78 // Establishes an expectation for a |init_sec_context()| call. |
| 79 // | 79 // |
| 80 // Each expectation established by |ExpectSecurityContext()| must be | 80 // Each expectation established by |ExpectSecurityContext()| must be |
| 81 // matched by a call to |init_sec_context()| during the lifetime of | 81 // matched by a call to |init_sec_context()| during the lifetime of |
| 82 // the MockGSSAPILibrary. The |expected_package| argument must equal the | 82 // the MockGSSAPILibrary. The |expected_package| argument must equal the |
| 83 // value associated with the |target_name| argument to |init_sec_context()| | 83 // value associated with the |target_name| argument to |init_sec_context()| |
| 84 // for there to be a match. The expectations also establish an explicit | 84 // for there to be a match. The expectations also establish an explicit |
| 85 // ordering. | 85 // ordering. |
| 86 // | 86 // |
| (...skipping 28 matching lines...) Expand all Loading... |
| 115 OM_uint32 minor_response_code, | 115 OM_uint32 minor_response_code, |
| 116 const test::GssContextMockImpl& context_info, | 116 const test::GssContextMockImpl& context_info, |
| 117 const gss_buffer_desc& expected_input_token, | 117 const gss_buffer_desc& expected_input_token, |
| 118 const gss_buffer_desc& output_token); | 118 const gss_buffer_desc& output_token); |
| 119 | 119 |
| 120 // GSSAPILibrary methods: | 120 // GSSAPILibrary methods: |
| 121 | 121 |
| 122 // Initializes the library, including any necessary dynamic libraries. | 122 // Initializes the library, including any necessary dynamic libraries. |
| 123 // This is done separately from construction (which happens at startup time) | 123 // This is done separately from construction (which happens at startup time) |
| 124 // in order to delay work until the class is actually needed. | 124 // in order to delay work until the class is actually needed. |
| 125 virtual bool Init() override; | 125 bool Init() override; |
| 126 | 126 |
| 127 // These methods match the ones in the GSSAPI library. | 127 // These methods match the ones in the GSSAPI library. |
| 128 virtual OM_uint32 import_name( | 128 OM_uint32 import_name(OM_uint32* minor_status, |
| 129 OM_uint32* minor_status, | 129 const gss_buffer_t input_name_buffer, |
| 130 const gss_buffer_t input_name_buffer, | 130 const gss_OID input_name_type, |
| 131 const gss_OID input_name_type, | 131 gss_name_t* output_name) override; |
| 132 gss_name_t* output_name) override; | 132 OM_uint32 release_name(OM_uint32* minor_status, |
| 133 virtual OM_uint32 release_name( | 133 gss_name_t* input_name) override; |
| 134 OM_uint32* minor_status, | 134 OM_uint32 release_buffer(OM_uint32* minor_status, |
| 135 gss_name_t* input_name) override; | 135 gss_buffer_t buffer) override; |
| 136 virtual OM_uint32 release_buffer( | 136 OM_uint32 display_name(OM_uint32* minor_status, |
| 137 OM_uint32* minor_status, | 137 const gss_name_t input_name, |
| 138 gss_buffer_t buffer) override; | 138 gss_buffer_t output_name_buffer, |
| 139 virtual OM_uint32 display_name( | 139 gss_OID* output_name_type) override; |
| 140 OM_uint32* minor_status, | 140 OM_uint32 display_status(OM_uint32* minor_status, |
| 141 const gss_name_t input_name, | 141 OM_uint32 status_value, |
| 142 gss_buffer_t output_name_buffer, | 142 int status_type, |
| 143 gss_OID* output_name_type) override; | 143 const gss_OID mech_type, |
| 144 virtual OM_uint32 display_status( | 144 OM_uint32* message_contex, |
| 145 OM_uint32* minor_status, | 145 gss_buffer_t status_string) override; |
| 146 OM_uint32 status_value, | 146 OM_uint32 init_sec_context(OM_uint32* minor_status, |
| 147 int status_type, | 147 const gss_cred_id_t initiator_cred_handle, |
| 148 const gss_OID mech_type, | 148 gss_ctx_id_t* context_handle, |
| 149 OM_uint32* message_contex, | 149 const gss_name_t target_name, |
| 150 gss_buffer_t status_string) override; | 150 const gss_OID mech_type, |
| 151 virtual OM_uint32 init_sec_context( | 151 OM_uint32 req_flags, |
| 152 OM_uint32* minor_status, | 152 OM_uint32 time_req, |
| 153 const gss_cred_id_t initiator_cred_handle, | 153 const gss_channel_bindings_t input_chan_bindings, |
| 154 gss_ctx_id_t* context_handle, | 154 const gss_buffer_t input_token, |
| 155 const gss_name_t target_name, | 155 gss_OID* actual_mech_type, |
| 156 const gss_OID mech_type, | 156 gss_buffer_t output_token, |
| 157 OM_uint32 req_flags, | 157 OM_uint32* ret_flags, |
| 158 OM_uint32 time_req, | 158 OM_uint32* time_rec) override; |
| 159 const gss_channel_bindings_t input_chan_bindings, | 159 OM_uint32 wrap_size_limit(OM_uint32* minor_status, |
| 160 const gss_buffer_t input_token, | 160 const gss_ctx_id_t context_handle, |
| 161 gss_OID* actual_mech_type, | 161 int conf_req_flag, |
| 162 gss_buffer_t output_token, | 162 gss_qop_t qop_req, |
| 163 OM_uint32* ret_flags, | 163 OM_uint32 req_output_size, |
| 164 OM_uint32* time_rec) override; | 164 OM_uint32* max_input_size) override; |
| 165 virtual OM_uint32 wrap_size_limit( | 165 OM_uint32 delete_sec_context(OM_uint32* minor_status, |
| 166 OM_uint32* minor_status, | 166 gss_ctx_id_t* context_handle, |
| 167 const gss_ctx_id_t context_handle, | 167 gss_buffer_t output_token) override; |
| 168 int conf_req_flag, | 168 OM_uint32 inquire_context(OM_uint32* minor_status, |
| 169 gss_qop_t qop_req, | 169 const gss_ctx_id_t context_handle, |
| 170 OM_uint32 req_output_size, | 170 gss_name_t* src_name, |
| 171 OM_uint32* max_input_size) override; | 171 gss_name_t* targ_name, |
| 172 virtual OM_uint32 delete_sec_context( | 172 OM_uint32* lifetime_rec, |
| 173 OM_uint32* minor_status, | 173 gss_OID* mech_type, |
| 174 gss_ctx_id_t* context_handle, | 174 OM_uint32* ctx_flags, |
| 175 gss_buffer_t output_token) override; | 175 int* locally_initiated, |
| 176 virtual OM_uint32 inquire_context( | 176 int* open) override; |
| 177 OM_uint32* minor_status, | |
| 178 const gss_ctx_id_t context_handle, | |
| 179 gss_name_t* src_name, | |
| 180 gss_name_t* targ_name, | |
| 181 OM_uint32* lifetime_rec, | |
| 182 gss_OID* mech_type, | |
| 183 OM_uint32* ctx_flags, | |
| 184 int* locally_initiated, | |
| 185 int* open) override; | |
| 186 | 177 |
| 187 private: | 178 private: |
| 188 FRIEND_TEST_ALL_PREFIXES(HttpAuthGSSAPIPOSIXTest, GSSAPICycle); | 179 FRIEND_TEST_ALL_PREFIXES(HttpAuthGSSAPIPOSIXTest, GSSAPICycle); |
| 189 | 180 |
| 190 // |expected_security_queries| contains an ordered list of expected | 181 // |expected_security_queries| contains an ordered list of expected |
| 191 // |init_sec_context()| calls and the return values for those | 182 // |init_sec_context()| calls and the return values for those |
| 192 // calls. | 183 // calls. |
| 193 std::list<SecurityContextQuery> expected_security_queries_; | 184 std::list<SecurityContextQuery> expected_security_queries_; |
| 194 }; | 185 }; |
| 195 | 186 |
| 196 } // namespace test | 187 } // namespace test |
| 197 | 188 |
| 198 } // namespace net | 189 } // namespace net |
| 199 | 190 |
| 200 #endif // NET_HTTP_MOCK_GSSAPI_LIBRARY_POSIX_H_ | 191 #endif // NET_HTTP_MOCK_GSSAPI_LIBRARY_POSIX_H_ |
| 201 | 192 |
| OLD | NEW |