@@ -60,129 +60,121 @@ create_cert_id (long serial)
60
60
static void
61
61
test_mongoc_cache_insert (void )
62
62
{
63
- ASN1_GENERALIZEDTIME * this_update , * next_update ;
63
+ ASN1_GENERALIZEDTIME * this_update_in , * next_update_in ;
64
+ ASN1_GENERALIZEDTIME * this_update_out , * next_update_out ;
64
65
int i , size = 5 , status = V_OCSP_CERTSTATUS_GOOD ,
65
66
reason = OCSP_REVOKED_STATUS_NOSTATUS ;
66
67
67
68
CLEAR_CACHE ;
68
69
69
- next_update = ASN1_GENERALIZEDTIME_set (NULL , time (NULL ) + 999 );
70
- this_update = ASN1_GENERALIZEDTIME_set (NULL , time (NULL ));
70
+ next_update_in = ASN1_GENERALIZEDTIME_set (NULL , time (NULL ) + 999 );
71
+ this_update_in = ASN1_GENERALIZEDTIME_set (NULL , time (NULL ));
71
72
for (i = 0 ; i < size ; i ++ ) {
72
- ASN1_GENERALIZEDTIME * thisupd , * nextupd ;
73
73
int s , r ;
74
74
OCSP_CERTID * id = create_cert_id (i );
75
75
76
- BSON_ASSERT (
77
- ! _mongoc_ocsp_cache_get_status ( id , & s , & r , & thisupd , & nextupd ));
76
+ BSON_ASSERT (! _mongoc_ocsp_cache_get_status (
77
+ id , & s , & r , & this_update_out , & next_update_out ));
78
78
_mongoc_ocsp_cache_set_resp (
79
- id , status , reason , this_update , next_update );
79
+ id , status , reason , this_update_in , next_update_in );
80
80
81
81
OCSP_CERTID_free (id );
82
82
}
83
83
84
84
BSON_ASSERT (_mongoc_ocsp_cache_length () == size );
85
85
86
86
for (i = 0 ; i < size ; i ++ ) {
87
- ASN1_GENERALIZEDTIME * thisupd , * nextupd ;
88
87
OCSP_CERTID * id = create_cert_id (i );
89
88
int s , r ;
90
89
91
- BSON_ASSERT (
92
- _mongoc_ocsp_cache_get_status ( id , & s , & r , & thisupd , & nextupd ));
90
+ BSON_ASSERT (_mongoc_ocsp_cache_get_status (
91
+ id , & s , & r , & this_update_out , & next_update_out ));
93
92
94
93
BSON_ASSERT (status == s );
95
94
BSON_ASSERT (reason == r );
96
- ASSERT_TIME_EQUAL (next_update , nextupd );
97
- ASSERT_TIME_EQUAL (this_update , thisupd );
95
+ ASSERT_TIME_EQUAL (next_update_in , next_update_out );
96
+ ASSERT_TIME_EQUAL (this_update_in , this_update_out );
98
97
99
- ASN1_GENERALIZEDTIME_free (thisupd );
100
- ASN1_GENERALIZEDTIME_free (nextupd );
101
98
OCSP_CERTID_free (id );
102
99
}
103
100
104
- ASN1_GENERALIZEDTIME_free (next_update );
105
- ASN1_GENERALIZEDTIME_free (this_update );
106
101
CLEAR_CACHE ;
102
+ ASN1_GENERALIZEDTIME_free (this_update_in );
103
+ ASN1_GENERALIZEDTIME_free (next_update_in );
107
104
}
108
105
109
106
static void
110
107
test_mongoc_cache_update (void )
111
108
{
112
109
OCSP_CERTID * id ;
113
- ASN1_GENERALIZEDTIME * next_update , * nextupd , * thisupd ;
110
+ ASN1_GENERALIZEDTIME * next_update_in , * next_update_out , * this_update_out ;
114
111
int status , reason ;
115
112
116
113
CLEAR_CACHE ;
117
114
118
- next_update = ASN1_GENERALIZEDTIME_set (NULL , time (NULL ));
115
+ next_update_in = ASN1_GENERALIZEDTIME_set (NULL , time (NULL ));
119
116
id = create_cert_id (1 );
120
117
121
118
_mongoc_ocsp_cache_set_resp (
122
- id , V_OCSP_CERTSTATUS_GOOD , 0 , NULL , next_update );
119
+ id , V_OCSP_CERTSTATUS_GOOD , 0 , NULL , next_update_in );
123
120
BSON_ASSERT (_mongoc_ocsp_cache_length () == 1 );
124
121
125
- BSON_ASSERT (
126
- _mongoc_ocsp_cache_get_status ( id , & status , & reason , & thisupd , & nextupd ));
122
+ BSON_ASSERT (_mongoc_ocsp_cache_get_status (
123
+ id , & status , & reason , & this_update_out , & next_update_out ));
127
124
BSON_ASSERT (status == V_OCSP_CERTSTATUS_GOOD );
128
125
129
- ASN1_GENERALIZEDTIME_free (next_update );
130
- next_update = ASN1_GENERALIZEDTIME_set (
126
+ ASN1_GENERALIZEDTIME_free (next_update_in );
127
+ next_update_in = ASN1_GENERALIZEDTIME_set (
131
128
NULL , time (NULL ) + 999 /* some time in the future */ );
132
129
133
130
_mongoc_ocsp_cache_set_resp (
134
- id , V_OCSP_CERTSTATUS_REVOKED , 0 , NULL , next_update );
131
+ id , V_OCSP_CERTSTATUS_REVOKED , 0 , NULL , next_update_in );
135
132
BSON_ASSERT (_mongoc_ocsp_cache_length () == 1 );
136
133
137
- ASN1_GENERALIZEDTIME_free (nextupd );
138
- ASN1_GENERALIZEDTIME_free (thisupd );
139
- BSON_ASSERT (
140
- _mongoc_ocsp_cache_get_status (id , & status , & reason , & thisupd , & nextupd ));
134
+ BSON_ASSERT (_mongoc_ocsp_cache_get_status (
135
+ id , & status , & reason , & this_update_out , & next_update_out ));
141
136
BSON_ASSERT (status == V_OCSP_CERTSTATUS_REVOKED );
142
137
143
- ASN1_GENERALIZEDTIME_free (next_update );
144
- next_update = ASN1_GENERALIZEDTIME_set (
138
+ ASN1_GENERALIZEDTIME_free (next_update_in );
139
+ next_update_in = ASN1_GENERALIZEDTIME_set (
145
140
NULL , time (NULL ) - 999 /* some time in the past */ );
146
141
147
142
_mongoc_ocsp_cache_set_resp (
148
- id , V_OCSP_CERTSTATUS_GOOD , 0 , NULL , next_update );
143
+ id , V_OCSP_CERTSTATUS_GOOD , 0 , NULL , next_update_in );
149
144
BSON_ASSERT (_mongoc_ocsp_cache_length () == 1 );
150
145
151
- ASN1_GENERALIZEDTIME_free (nextupd );
152
- ASN1_GENERALIZEDTIME_free (thisupd );
153
- BSON_ASSERT (
154
- _mongoc_ocsp_cache_get_status (id , & status , & reason , & thisupd , & nextupd ));
146
+ BSON_ASSERT (_mongoc_ocsp_cache_get_status (
147
+ id , & status , & reason , & this_update_out , & next_update_out ));
155
148
BSON_ASSERT (status == V_OCSP_CERTSTATUS_REVOKED );
156
149
157
150
CLEAR_CACHE ;
158
151
159
- ASN1_GENERALIZEDTIME_free (nextupd );
160
- ASN1_GENERALIZEDTIME_free (thisupd );
161
- ASN1_GENERALIZEDTIME_free (next_update );
152
+ ASN1_GENERALIZEDTIME_free (next_update_in );
162
153
OCSP_CERTID_free (id );
163
154
}
164
155
165
156
static void
166
157
test_mongoc_cache_remove_expired_cert (void )
167
158
{
168
- ASN1_GENERALIZEDTIME * this_update , * next_update ;
159
+ ASN1_GENERALIZEDTIME * this_update_in , * next_update_in ;
169
160
int status = V_OCSP_CERTSTATUS_GOOD , reason = OCSP_REVOKED_STATUS_NOSTATUS ;
170
161
OCSP_CERTID * id = create_cert_id (1 );
171
162
172
163
CLEAR_CACHE ;
173
164
174
- next_update = ASN1_GENERALIZEDTIME_set (NULL , time (NULL ) - 1 );
175
- this_update = ASN1_GENERALIZEDTIME_set (NULL , time (NULL ) - 999 );
165
+ next_update_in = ASN1_GENERALIZEDTIME_set (NULL , time (NULL ) - 1 );
166
+ this_update_in = ASN1_GENERALIZEDTIME_set (NULL , time (NULL ) - 999 );
176
167
177
- _mongoc_ocsp_cache_set_resp (id , status , reason , this_update , next_update );
168
+ _mongoc_ocsp_cache_set_resp (
169
+ id , status , reason , this_update_in , next_update_in );
178
170
179
171
BSON_ASSERT (_mongoc_ocsp_cache_length () == 1 );
180
172
BSON_ASSERT (!_mongoc_ocsp_cache_get_status (id , NULL , NULL , NULL , NULL ));
181
173
BSON_ASSERT (_mongoc_ocsp_cache_length () == 0 );
182
174
183
175
OCSP_CERTID_free (id );
184
- ASN1_GENERALIZEDTIME_free (next_update );
185
- ASN1_GENERALIZEDTIME_free (this_update );
176
+ ASN1_GENERALIZEDTIME_free (next_update_in );
177
+ ASN1_GENERALIZEDTIME_free (this_update_in );
186
178
187
179
CLEAR_CACHE ;
188
180
}
0 commit comments