aa64344d541ad9a165fab4c92bae48561a1f27af
[gssweb.git] / json_gssapi / test / command_mocks / InitSecContextMock.cpp
1 /*
2  * Copyright (c) 2014 <copyright holder> <email>
3  * 
4  * For license details, see the LICENSE file in the root of this project.
5  * 
6  */
7
8 #include "InitSecContextMock.h"
9 #include <stdio.h>
10
11 OM_uint32 InitSecContextMock::retVal = 0;
12 OM_uint32 InitSecContextMock::minor_status = 0;
13 OM_uint32 InitSecContextMock::req_flags = 0;
14 OM_uint32 InitSecContextMock::time_req = 0;
15 OM_uint32 InitSecContextMock::ret_flags = 0;
16 OM_uint32 InitSecContextMock::time_rec = 0;
17
18 bool InitSecContextMock::visited = false;
19 bool InitSecContextMock::invalidContextHandle = false;
20
21 gss_cred_id_t InitSecContextMock::claimant_cred_handle = NULL;
22 gss_ctx_id_t  InitSecContextMock::context_handle = NULL;
23 gss_name_t    InitSecContextMock::target_name = NULL;
24 gss_OID       InitSecContextMock::mech_type = NULL;
25 gss_channel_bindings_t InitSecContextMock::input_chan_bindings = NULL;
26 gss_buffer_desc  InitSecContextMock::input_token;
27 gss_OID       InitSecContextMock::actual_mech_type = NULL;
28 gss_buffer_desc  InitSecContextMock::output_token;
29
30 void InitSecContextMock::reset()
31 {
32   retVal = 0;
33   minor_status = 0;
34   nullify(claimant_cred_handle);
35   nullify(context_handle);
36   nullify(target_name);
37   // Our current handling of OIDs means attempting to free one
38   // will often result in a double-free or an attempt to free
39   // a constant OID. For now, it is better to occasionally leak.
40   // We should revisit this -Kevin
41   mech_type = GSS_C_NO_OID;
42   req_flags = 0;
43   time_req = 0;
44   nullify(input_chan_bindings);
45   input_token.length = 0;
46   input_token.value = NULL;
47   actual_mech_type = GSS_C_NO_OID;
48   output_token.length = 0;
49   output_token.value = 0;
50   ret_flags = 0;
51   time_rec = 0;
52   visited = false;
53   invalidContextHandle = false;
54
55 }