OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/mock_gssapi_library_posix.h" | 5 #include "net/http/mock_gssapi_library_posix.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 if (!src) | 49 if (!src) |
50 return; | 50 return; |
51 SetOid(dest, src->elements, src->length); | 51 SetOid(dest, src->elements, src->length); |
52 } | 52 } |
53 | 53 |
54 // gss_buffer_t helpers. | 54 // gss_buffer_t helpers. |
55 void ClearBuffer(gss_buffer_t dest) { | 55 void ClearBuffer(gss_buffer_t dest) { |
56 if (!dest) | 56 if (!dest) |
57 return; | 57 return; |
58 dest->length = 0; | 58 dest->length = 0; |
59 delete [] reinterpret_cast<char*>(dest->value); | 59 delete[] reinterpret_cast<char*>(dest->value); |
60 dest->value = NULL; | 60 dest->value = NULL; |
61 } | 61 } |
62 | 62 |
63 void SetBuffer(gss_buffer_t dest, const void* src, size_t length) { | 63 void SetBuffer(gss_buffer_t dest, const void* src, size_t length) { |
64 if (!dest) | 64 if (!dest) |
65 return; | 65 return; |
66 ClearBuffer(dest); | 66 ClearBuffer(dest); |
67 if (!src) | 67 if (!src) |
68 return; | 68 return; |
69 dest->length = length; | 69 dest->length = length; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 if (!src) | 113 if (!src) |
114 return; | 114 return; |
115 test::GssNameMockImpl* name = reinterpret_cast<test::GssNameMockImpl*>(dest); | 115 test::GssNameMockImpl* name = reinterpret_cast<test::GssNameMockImpl*>(dest); |
116 name->name.assign(reinterpret_cast<const char*>(src), length); | 116 name->name.assign(reinterpret_cast<const char*>(src), length); |
117 } | 117 } |
118 | 118 |
119 std::string NameToString(const gss_name_t& src) { | 119 std::string NameToString(const gss_name_t& src) { |
120 std::string dest; | 120 std::string dest; |
121 if (!src) | 121 if (!src) |
122 return dest; | 122 return dest; |
123 test::GssNameMockImpl* string = | 123 test::GssNameMockImpl* string = reinterpret_cast<test::GssNameMockImpl*>(src); |
124 reinterpret_cast<test::GssNameMockImpl*>(src); | |
125 dest = string->name; | 124 dest = string->name; |
126 return dest; | 125 return dest; |
127 } | 126 } |
128 | 127 |
129 void NameFromString(const std::string& src, gss_name_t dest) { | 128 void NameFromString(const std::string& src, gss_name_t dest) { |
130 if (!dest) | 129 if (!dest) |
131 return; | 130 return; |
132 SetName(dest, src.c_str(), src.length()); | 131 SetName(dest, src.c_str(), src.length()); |
133 } | 132 } |
134 | 133 |
135 } // namespace | 134 } // namespace |
136 | 135 |
137 namespace test { | 136 namespace test { |
138 | 137 |
139 GssContextMockImpl::GssContextMockImpl() | 138 GssContextMockImpl::GssContextMockImpl() |
140 : lifetime_rec(0), | 139 : lifetime_rec(0), ctx_flags(0), locally_initiated(0), open(0) { |
141 ctx_flags(0), | |
142 locally_initiated(0), | |
143 open(0) { | |
144 ClearOid(&mech_type); | 140 ClearOid(&mech_type); |
145 } | 141 } |
146 | 142 |
147 GssContextMockImpl::GssContextMockImpl(const GssContextMockImpl& other) | 143 GssContextMockImpl::GssContextMockImpl(const GssContextMockImpl& other) |
148 : src_name(other.src_name), | 144 : src_name(other.src_name), |
149 targ_name(other.targ_name), | 145 targ_name(other.targ_name), |
150 lifetime_rec(other.lifetime_rec), | 146 lifetime_rec(other.lifetime_rec), |
151 ctx_flags(other.ctx_flags), | 147 ctx_flags(other.ctx_flags), |
152 locally_initiated(other.locally_initiated), | 148 locally_initiated(other.locally_initiated), |
153 open(other.open) { | 149 open(other.open) { |
154 CopyOid(&mech_type, &other.mech_type); | 150 CopyOid(&mech_type, &other.mech_type); |
155 } | 151 } |
156 | 152 |
157 GssContextMockImpl::GssContextMockImpl(const char* src_name_in, | 153 GssContextMockImpl::GssContextMockImpl(const char* src_name_in, |
158 const char* targ_name_in, | 154 const char* targ_name_in, |
159 OM_uint32 lifetime_rec_in, | 155 OM_uint32 lifetime_rec_in, |
160 const gss_OID_desc& mech_type_in, | 156 const gss_OID_desc& mech_type_in, |
161 OM_uint32 ctx_flags_in, | 157 OM_uint32 ctx_flags_in, |
162 int locally_initiated_in, | 158 int locally_initiated_in, |
163 int open_in) | 159 int open_in) |
164 : src_name(src_name_in ? src_name_in : ""), | 160 : src_name(src_name_in ? src_name_in : ""), |
165 targ_name(targ_name_in ? targ_name_in : ""), | 161 targ_name(targ_name_in ? targ_name_in : ""), |
166 lifetime_rec(lifetime_rec_in), | 162 lifetime_rec(lifetime_rec_in), |
167 ctx_flags(ctx_flags_in), | 163 ctx_flags(ctx_flags_in), |
168 locally_initiated(locally_initiated_in), | 164 locally_initiated(locally_initiated_in), |
169 open(open_in) { | 165 open(open_in) { |
170 CopyOid(&mech_type, &mech_type_in); | 166 CopyOid(&mech_type, &mech_type_in); |
171 } | 167 } |
172 | 168 |
173 GssContextMockImpl::~GssContextMockImpl() { | 169 GssContextMockImpl::~GssContextMockImpl() { |
174 ClearOid(&mech_type); | 170 ClearOid(&mech_type); |
175 } | 171 } |
176 | 172 |
177 void GssContextMockImpl::Assign( | 173 void GssContextMockImpl::Assign(const GssContextMockImpl& other) { |
178 const GssContextMockImpl& other) { | |
179 if (&other == this) | 174 if (&other == this) |
180 return; | 175 return; |
181 src_name = other.src_name; | 176 src_name = other.src_name; |
182 targ_name = other.targ_name; | 177 targ_name = other.targ_name; |
183 lifetime_rec = other.lifetime_rec; | 178 lifetime_rec = other.lifetime_rec; |
184 CopyOid(&mech_type, &other.mech_type); | 179 CopyOid(&mech_type, &other.mech_type); |
185 ctx_flags = other.ctx_flags; | 180 ctx_flags = other.ctx_flags; |
186 locally_initiated = other.locally_initiated; | 181 locally_initiated = other.locally_initiated; |
187 open = other.open; | 182 open = other.open; |
188 } | 183 } |
(...skipping 30 matching lines...) Expand all Loading... |
219 | 214 |
220 if (in_output_token) { | 215 if (in_output_token) { |
221 output_token.length = strlen(in_output_token); | 216 output_token.length = strlen(in_output_token); |
222 output_token.value = const_cast<char*>(in_output_token); | 217 output_token.value = const_cast<char*>(in_output_token); |
223 } else { | 218 } else { |
224 output_token.length = 0; | 219 output_token.length = 0; |
225 output_token.value = NULL; | 220 output_token.value = NULL; |
226 } | 221 } |
227 } | 222 } |
228 | 223 |
229 MockGSSAPILibrary::SecurityContextQuery::~SecurityContextQuery() {} | 224 MockGSSAPILibrary::SecurityContextQuery::~SecurityContextQuery() { |
| 225 } |
230 | 226 |
231 MockGSSAPILibrary::MockGSSAPILibrary() { | 227 MockGSSAPILibrary::MockGSSAPILibrary() { |
232 } | 228 } |
233 | 229 |
234 MockGSSAPILibrary::~MockGSSAPILibrary() { | 230 MockGSSAPILibrary::~MockGSSAPILibrary() { |
235 } | 231 } |
236 | 232 |
237 void MockGSSAPILibrary::ExpectSecurityContext( | 233 void MockGSSAPILibrary::ExpectSecurityContext( |
238 const std::string& expected_package, | 234 const std::string& expected_package, |
239 OM_uint32 response_code, | 235 OM_uint32 response_code, |
240 OM_uint32 minor_response_code, | 236 OM_uint32 minor_response_code, |
241 const GssContextMockImpl& context_info, | 237 const GssContextMockImpl& context_info, |
242 const gss_buffer_desc& expected_input_token, | 238 const gss_buffer_desc& expected_input_token, |
243 const gss_buffer_desc& output_token) { | 239 const gss_buffer_desc& output_token) { |
244 SecurityContextQuery security_query; | 240 SecurityContextQuery security_query; |
245 security_query.expected_package = expected_package; | 241 security_query.expected_package = expected_package; |
246 security_query.response_code = response_code; | 242 security_query.response_code = response_code; |
247 security_query.minor_response_code = minor_response_code; | 243 security_query.minor_response_code = minor_response_code; |
248 security_query.context_info.Assign(context_info); | 244 security_query.context_info.Assign(context_info); |
249 security_query.expected_input_token = expected_input_token; | 245 security_query.expected_input_token = expected_input_token; |
250 security_query.output_token = output_token; | 246 security_query.output_token = output_token; |
251 expected_security_queries_.push_back(security_query); | 247 expected_security_queries_.push_back(security_query); |
252 } | 248 } |
253 | 249 |
254 bool MockGSSAPILibrary::Init() { | 250 bool MockGSSAPILibrary::Init() { |
255 return true; | 251 return true; |
256 } | 252 } |
257 | 253 |
258 // These methods match the ones in the GSSAPI library. | 254 // These methods match the ones in the GSSAPI library. |
259 OM_uint32 MockGSSAPILibrary::import_name( | 255 OM_uint32 MockGSSAPILibrary::import_name(OM_uint32* minor_status, |
260 OM_uint32* minor_status, | 256 const gss_buffer_t input_name_buffer, |
261 const gss_buffer_t input_name_buffer, | 257 const gss_OID input_name_type, |
262 const gss_OID input_name_type, | 258 gss_name_t* output_name) { |
263 gss_name_t* output_name) { | |
264 if (minor_status) | 259 if (minor_status) |
265 *minor_status = 0; | 260 *minor_status = 0; |
266 if (!output_name) | 261 if (!output_name) |
267 return GSS_S_BAD_NAME; | 262 return GSS_S_BAD_NAME; |
268 if (!input_name_buffer) | 263 if (!input_name_buffer) |
269 return GSS_S_CALL_BAD_STRUCTURE; | 264 return GSS_S_CALL_BAD_STRUCTURE; |
270 if (!input_name_type) | 265 if (!input_name_type) |
271 return GSS_S_BAD_NAMETYPE; | 266 return GSS_S_BAD_NAMETYPE; |
272 GssNameMockImpl* output = new GssNameMockImpl; | 267 GssNameMockImpl* output = new GssNameMockImpl; |
273 if (output == NULL) | 268 if (output == NULL) |
274 return GSS_S_FAILURE; | 269 return GSS_S_FAILURE; |
275 output->name_type.length = 0; | 270 output->name_type.length = 0; |
276 output->name_type.elements = NULL; | 271 output->name_type.elements = NULL; |
277 | 272 |
278 // Save the data. | 273 // Save the data. |
279 output->name = BufferToString(input_name_buffer); | 274 output->name = BufferToString(input_name_buffer); |
280 CopyOid(&output->name_type, input_name_type); | 275 CopyOid(&output->name_type, input_name_type); |
281 *output_name = reinterpret_cast<gss_name_t>(output); | 276 *output_name = reinterpret_cast<gss_name_t>(output); |
282 | 277 |
283 return GSS_S_COMPLETE; | 278 return GSS_S_COMPLETE; |
284 } | 279 } |
285 | 280 |
286 OM_uint32 MockGSSAPILibrary::release_name( | 281 OM_uint32 MockGSSAPILibrary::release_name(OM_uint32* minor_status, |
287 OM_uint32* minor_status, | 282 gss_name_t* input_name) { |
288 gss_name_t* input_name) { | |
289 if (minor_status) | 283 if (minor_status) |
290 *minor_status = 0; | 284 *minor_status = 0; |
291 if (!input_name) | 285 if (!input_name) |
292 return GSS_S_BAD_NAME; | 286 return GSS_S_BAD_NAME; |
293 if (!*input_name) | 287 if (!*input_name) |
294 return GSS_S_COMPLETE; | 288 return GSS_S_COMPLETE; |
295 GssNameMockImpl* name = *reinterpret_cast<GssNameMockImpl**>(input_name); | 289 GssNameMockImpl* name = *reinterpret_cast<GssNameMockImpl**>(input_name); |
296 ClearName(*input_name); | 290 ClearName(*input_name); |
297 delete name; | 291 delete name; |
298 *input_name = NULL; | 292 *input_name = NULL; |
299 return GSS_S_COMPLETE; | 293 return GSS_S_COMPLETE; |
300 } | 294 } |
301 | 295 |
302 OM_uint32 MockGSSAPILibrary::release_buffer( | 296 OM_uint32 MockGSSAPILibrary::release_buffer(OM_uint32* minor_status, |
303 OM_uint32* minor_status, | 297 gss_buffer_t buffer) { |
304 gss_buffer_t buffer) { | |
305 if (minor_status) | 298 if (minor_status) |
306 *minor_status = 0; | 299 *minor_status = 0; |
307 if (!buffer) | 300 if (!buffer) |
308 return GSS_S_BAD_NAME; | 301 return GSS_S_BAD_NAME; |
309 ClearBuffer(buffer); | 302 ClearBuffer(buffer); |
310 return GSS_S_COMPLETE; | 303 return GSS_S_COMPLETE; |
311 } | 304 } |
312 | 305 |
313 OM_uint32 MockGSSAPILibrary::display_name( | 306 OM_uint32 MockGSSAPILibrary::display_name(OM_uint32* minor_status, |
314 OM_uint32* minor_status, | 307 const gss_name_t input_name, |
315 const gss_name_t input_name, | 308 gss_buffer_t output_name_buffer, |
316 gss_buffer_t output_name_buffer, | 309 gss_OID* output_name_type) { |
317 gss_OID* output_name_type) { | |
318 if (minor_status) | 310 if (minor_status) |
319 *minor_status = 0; | 311 *minor_status = 0; |
320 if (!input_name) | 312 if (!input_name) |
321 return GSS_S_BAD_NAME; | 313 return GSS_S_BAD_NAME; |
322 if (!output_name_buffer) | 314 if (!output_name_buffer) |
323 return GSS_S_CALL_BAD_STRUCTURE; | 315 return GSS_S_CALL_BAD_STRUCTURE; |
324 if (!output_name_type) | 316 if (!output_name_type) |
325 return GSS_S_CALL_BAD_STRUCTURE; | 317 return GSS_S_CALL_BAD_STRUCTURE; |
326 std::string name(NameToString(input_name)); | 318 std::string name(NameToString(input_name)); |
327 BufferFromString(name, output_name_buffer); | 319 BufferFromString(name, output_name_buffer); |
328 GssNameMockImpl* internal_name = | 320 GssNameMockImpl* internal_name = |
329 *reinterpret_cast<GssNameMockImpl**>(input_name); | 321 *reinterpret_cast<GssNameMockImpl**>(input_name); |
330 if (output_name_type) | 322 if (output_name_type) |
331 *output_name_type = internal_name ? &internal_name->name_type : NULL; | 323 *output_name_type = internal_name ? &internal_name->name_type : NULL; |
332 return GSS_S_COMPLETE; | 324 return GSS_S_COMPLETE; |
333 } | 325 } |
334 | 326 |
335 OM_uint32 MockGSSAPILibrary::display_status( | 327 OM_uint32 MockGSSAPILibrary::display_status(OM_uint32* minor_status, |
336 OM_uint32* minor_status, | 328 OM_uint32 status_value, |
337 OM_uint32 status_value, | 329 int status_type, |
338 int status_type, | 330 const gss_OID mech_type, |
339 const gss_OID mech_type, | 331 OM_uint32* message_context, |
340 OM_uint32* message_context, | 332 gss_buffer_t status_string) { |
341 gss_buffer_t status_string) { | |
342 if (minor_status) | 333 if (minor_status) |
343 *minor_status = 0; | 334 *minor_status = 0; |
344 std::string msg = base::StringPrintf("Value: %u, Type %u", | 335 std::string msg = |
345 status_value, | 336 base::StringPrintf("Value: %u, Type %u", status_value, status_type); |
346 status_type); | |
347 if (message_context) | 337 if (message_context) |
348 *message_context = 0; | 338 *message_context = 0; |
349 BufferFromString(msg, status_string); | 339 BufferFromString(msg, status_string); |
350 return GSS_S_COMPLETE; | 340 return GSS_S_COMPLETE; |
351 } | 341 } |
352 | 342 |
353 OM_uint32 MockGSSAPILibrary::init_sec_context( | 343 OM_uint32 MockGSSAPILibrary::init_sec_context( |
354 OM_uint32* minor_status, | 344 OM_uint32* minor_status, |
355 const gss_cred_id_t initiator_cred_handle, | 345 const gss_cred_id_t initiator_cred_handle, |
356 gss_ctx_id_t* context_handle, | 346 gss_ctx_id_t* context_handle, |
357 const gss_name_t target_name, | 347 const gss_name_t target_name, |
358 const gss_OID mech_type, | 348 const gss_OID mech_type, |
359 OM_uint32 req_flags, | 349 OM_uint32 req_flags, |
360 OM_uint32 time_req, | 350 OM_uint32 time_req, |
361 const gss_channel_bindings_t input_chan_bindings, | 351 const gss_channel_bindings_t input_chan_bindings, |
362 const gss_buffer_t input_token, | 352 const gss_buffer_t input_token, |
363 gss_OID* actual_mech_type, | 353 gss_OID* actual_mech_type, |
364 gss_buffer_t output_token, | 354 gss_buffer_t output_token, |
365 OM_uint32* ret_flags, | 355 OM_uint32* ret_flags, |
366 OM_uint32* time_rec) { | 356 OM_uint32* time_rec) { |
367 if (minor_status) | 357 if (minor_status) |
368 *minor_status = 0; | 358 *minor_status = 0; |
369 if (!context_handle) | 359 if (!context_handle) |
370 return GSS_S_CALL_BAD_STRUCTURE; | 360 return GSS_S_CALL_BAD_STRUCTURE; |
371 GssContextMockImpl** internal_context_handle = | 361 GssContextMockImpl** internal_context_handle = |
372 reinterpret_cast<test::GssContextMockImpl**>(context_handle); | 362 reinterpret_cast<test::GssContextMockImpl**>(context_handle); |
373 // Create it if necessary. | 363 // Create it if necessary. |
374 if (!*internal_context_handle) { | 364 if (!*internal_context_handle) { |
375 *internal_context_handle = new GssContextMockImpl; | 365 *internal_context_handle = new GssContextMockImpl; |
376 } | 366 } |
(...skipping 13 matching lines...) Expand all Loading... |
390 context.lifetime_rec = security_query.context_info.lifetime_rec; | 380 context.lifetime_rec = security_query.context_info.lifetime_rec; |
391 CopyOid(&context.mech_type, &security_query.context_info.mech_type); | 381 CopyOid(&context.mech_type, &security_query.context_info.mech_type); |
392 context.ctx_flags = security_query.context_info.ctx_flags; | 382 context.ctx_flags = security_query.context_info.ctx_flags; |
393 context.locally_initiated = security_query.context_info.locally_initiated; | 383 context.locally_initiated = security_query.context_info.locally_initiated; |
394 context.open = security_query.context_info.open; | 384 context.open = security_query.context_info.open; |
395 if (!input_token) { | 385 if (!input_token) { |
396 EXPECT_FALSE(security_query.expected_input_token.length); | 386 EXPECT_FALSE(security_query.expected_input_token.length); |
397 } else { | 387 } else { |
398 EXPECT_EQ(input_token->length, security_query.expected_input_token.length); | 388 EXPECT_EQ(input_token->length, security_query.expected_input_token.length); |
399 if (input_token->length) { | 389 if (input_token->length) { |
400 EXPECT_EQ(0, memcmp(input_token->value, | 390 EXPECT_EQ(0, |
401 security_query.expected_input_token.value, | 391 memcmp(input_token->value, |
402 input_token->length)); | 392 security_query.expected_input_token.value, |
| 393 input_token->length)); |
403 } | 394 } |
404 } | 395 } |
405 CopyBuffer(output_token, &security_query.output_token); | 396 CopyBuffer(output_token, &security_query.output_token); |
406 if (actual_mech_type) | 397 if (actual_mech_type) |
407 CopyOid(*actual_mech_type, mech_type); | 398 CopyOid(*actual_mech_type, mech_type); |
408 if (ret_flags) | 399 if (ret_flags) |
409 *ret_flags = req_flags; | 400 *ret_flags = req_flags; |
410 return major_status; | 401 return major_status; |
411 } | 402 } |
412 | 403 |
413 OM_uint32 MockGSSAPILibrary::wrap_size_limit( | 404 OM_uint32 MockGSSAPILibrary::wrap_size_limit(OM_uint32* minor_status, |
414 OM_uint32* minor_status, | 405 const gss_ctx_id_t context_handle, |
415 const gss_ctx_id_t context_handle, | 406 int conf_req_flag, |
416 int conf_req_flag, | 407 gss_qop_t qop_req, |
417 gss_qop_t qop_req, | 408 OM_uint32 req_output_size, |
418 OM_uint32 req_output_size, | 409 OM_uint32* max_input_size) { |
419 OM_uint32* max_input_size) { | |
420 if (minor_status) | 410 if (minor_status) |
421 *minor_status = 0; | 411 *minor_status = 0; |
422 ADD_FAILURE(); | 412 ADD_FAILURE(); |
423 return GSS_S_UNAVAILABLE; | 413 return GSS_S_UNAVAILABLE; |
424 } | 414 } |
425 | 415 |
426 OM_uint32 MockGSSAPILibrary::delete_sec_context( | 416 OM_uint32 MockGSSAPILibrary::delete_sec_context(OM_uint32* minor_status, |
427 OM_uint32* minor_status, | 417 gss_ctx_id_t* context_handle, |
428 gss_ctx_id_t* context_handle, | 418 gss_buffer_t output_token) { |
429 gss_buffer_t output_token) { | |
430 if (minor_status) | 419 if (minor_status) |
431 *minor_status = 0; | 420 *minor_status = 0; |
432 if (!context_handle) | 421 if (!context_handle) |
433 return GSS_S_CALL_BAD_STRUCTURE; | 422 return GSS_S_CALL_BAD_STRUCTURE; |
434 GssContextMockImpl** internal_context_handle = | 423 GssContextMockImpl** internal_context_handle = |
435 reinterpret_cast<GssContextMockImpl**>(context_handle); | 424 reinterpret_cast<GssContextMockImpl**>(context_handle); |
436 if (*internal_context_handle) { | 425 if (*internal_context_handle) { |
437 delete *internal_context_handle; | 426 delete *internal_context_handle; |
438 *internal_context_handle = NULL; | 427 *internal_context_handle = NULL; |
439 } | 428 } |
440 return GSS_S_COMPLETE; | 429 return GSS_S_COMPLETE; |
441 } | 430 } |
442 | 431 |
443 OM_uint32 MockGSSAPILibrary::inquire_context( | 432 OM_uint32 MockGSSAPILibrary::inquire_context(OM_uint32* minor_status, |
444 OM_uint32* minor_status, | 433 const gss_ctx_id_t context_handle, |
445 const gss_ctx_id_t context_handle, | 434 gss_name_t* src_name, |
446 gss_name_t* src_name, | 435 gss_name_t* targ_name, |
447 gss_name_t* targ_name, | 436 OM_uint32* lifetime_rec, |
448 OM_uint32* lifetime_rec, | 437 gss_OID* mech_type, |
449 gss_OID* mech_type, | 438 OM_uint32* ctx_flags, |
450 OM_uint32* ctx_flags, | 439 int* locally_initiated, |
451 int* locally_initiated, | 440 int* open) { |
452 int* open) { | |
453 if (minor_status) | 441 if (minor_status) |
454 *minor_status = 0; | 442 *minor_status = 0; |
455 if (!context_handle) | 443 if (!context_handle) |
456 return GSS_S_CALL_BAD_STRUCTURE; | 444 return GSS_S_CALL_BAD_STRUCTURE; |
457 GssContextMockImpl* internal_context_ptr = | 445 GssContextMockImpl* internal_context_ptr = |
458 reinterpret_cast<GssContextMockImpl*>(context_handle); | 446 reinterpret_cast<GssContextMockImpl*>(context_handle); |
459 GssContextMockImpl& context = *internal_context_ptr; | 447 GssContextMockImpl& context = *internal_context_ptr; |
460 if (src_name) | 448 if (src_name) |
461 NameFromString(context.src_name, *src_name); | 449 NameFromString(context.src_name, *src_name); |
462 if (targ_name) | 450 if (targ_name) |
463 NameFromString(context.targ_name, *targ_name); | 451 NameFromString(context.targ_name, *targ_name); |
464 if (lifetime_rec) | 452 if (lifetime_rec) |
465 *lifetime_rec = context.lifetime_rec; | 453 *lifetime_rec = context.lifetime_rec; |
466 if (mech_type) | 454 if (mech_type) |
467 CopyOid(*mech_type, &context.mech_type); | 455 CopyOid(*mech_type, &context.mech_type); |
468 if (ctx_flags) | 456 if (ctx_flags) |
469 *ctx_flags = context.ctx_flags; | 457 *ctx_flags = context.ctx_flags; |
470 if (locally_initiated) | 458 if (locally_initiated) |
471 *locally_initiated = context.locally_initiated; | 459 *locally_initiated = context.locally_initiated; |
472 if (open) | 460 if (open) |
473 *open = context.open; | 461 *open = context.open; |
474 return GSS_S_COMPLETE; | 462 return GSS_S_COMPLETE; |
475 } | 463 } |
476 | 464 |
477 } // namespace test | 465 } // namespace test |
478 | 466 |
479 } // namespace net | 467 } // namespace net |
480 | |
OLD | NEW |