Commit 492f22abc1c8f0f708f177ec6bfe0bcb7447449f
1 parent
2d72ed5d
Exists in
master
and in
3 other branches
Adding option to disable automatic download of the CRL.
Showing
5 changed files
with
44 additions
and
41 deletions
Show diff stats
src/core/properties/boolean.c
... | ... | @@ -45,6 +45,13 @@ |
45 | 45 | return hSession->starting != 0; |
46 | 46 | } |
47 | 47 | |
48 | + void lib3270_disable_crl_download(H3270 *hSession) | |
49 | + { | |
50 | +#ifdef SSL_ENABLE_CRL_CHECK | |
51 | + hSession->ssl.crl.download = 0; | |
52 | +#endif // SSL_ENABLE_CRL_CHECK | |
53 | + } | |
54 | + | |
48 | 55 | const LIB3270_INT_PROPERTY * lib3270_get_boolean_properties_list(void) |
49 | 56 | { |
50 | 57 | ... | ... |
src/core/session.c
... | ... | @@ -410,6 +410,10 @@ H3270 * lib3270_session_new(const char *model) |
410 | 410 | hSession = lib3270_malloc(sizeof(H3270)); |
411 | 411 | hSession->id = 0; |
412 | 412 | |
413 | +#ifdef SSL_ENABLE_CRL_CHECK | |
414 | + hSession->ssl.crl.download = 1; | |
415 | +#endif // SSL_ENABLE_CRL_CHECK | |
416 | + | |
413 | 417 | if(!default_session) |
414 | 418 | default_session = hSession; |
415 | 419 | ... | ... |
src/include/internals.h
... | ... | @@ -147,15 +147,6 @@ LIB3270_INTERNAL const char * build_rpq_revision; |
147 | 147 | LIB3270_INTERNAL Boolean dbcs; |
148 | 148 | #endif /*]*/ |
149 | 149 | |
150 | - | |
151 | -/** | |
152 | - * @brief toggle names | |
153 | - */ /* | |
154 | -struct toggle_name { | |
155 | - const char *name; | |
156 | - int index; | |
157 | -}; */ | |
158 | - | |
159 | 150 | /// @brief State macros |
160 | 151 | #define PCONNECTED lib3270_pconnected(hSession) |
161 | 152 | #define HALF_CONNECTED lib3270_half_connected(hSession) |
... | ... | @@ -188,14 +179,6 @@ struct toggle_name { |
188 | 179 | #define PN ((XtPointer) NULL) |
189 | 180 | #define Replace(var, value) { lib3270_free(var); var = (value); }; |
190 | 181 | |
191 | -/// @brief Configuration change masks. | |
192 | -//#define NO_CHANGE 0x0000 /// @brief no change | |
193 | -// #define MODEL_CHANGE 0x0001 /// @brief screen dimensions changed | |
194 | -//#define FONT_CHANGE 0x0002 /// @brief emulator font changed | |
195 | -//#define COLOR_CHANGE 0x0004 /// @brief color scheme or 3278/9 mode changed | |
196 | -//#define SCROLL_CHANGE 0x0008 /// @brief scrollbar snapped on or off | |
197 | -//#define CHARSET_CHANGE 0x0010 /// @brief character set changed | |
198 | -// #define ALL_CHANGE 0xffff /// @brief everything changed | |
199 | 182 | |
200 | 183 | /* Portability macros */ |
201 | 184 | |
... | ... | @@ -218,14 +201,6 @@ struct toggle_name { |
218 | 201 | #define DFT_BUF (4 * 1024) |
219 | 202 | #endif /*]*/ |
220 | 203 | |
221 | -/* DBCS Preedit Types */ /* | |
222 | -#if defined(X3270_DBCS) | |
223 | - #define PT_ROOT "Root" | |
224 | - #define PT_OVER_THE_SPOT "OverTheSpot" | |
225 | - #define PT_OFF_THE_SPOT "OffTheSpot" | |
226 | - #define PT_ON_THE_SPOT "OnTheSpot" | |
227 | -#endif */ | |
228 | - | |
229 | 204 | /** |
230 | 205 | * @brief input key type |
231 | 206 | */ |
... | ... | @@ -690,6 +665,7 @@ struct _h3270 |
690 | 665 | #ifdef SSL_ENABLE_CRL_CHECK |
691 | 666 | struct |
692 | 667 | { |
668 | + char download; ///< @brief Non zero to download CRL. | |
693 | 669 | char * prefer; ///< @brief Prefered protocol for CRL. |
694 | 670 | char * url; ///< @brief URL for CRL download. |
695 | 671 | X509_CRL * cert; ///< @brief Loaded CRL (can be null). | ... | ... |
src/include/lib3270/properties.h
... | ... | @@ -212,6 +212,14 @@ |
212 | 212 | */ |
213 | 213 | LIB3270_EXPORT const LIB3270_UINT_PROPERTY * lib3270_unsigned_property_get_by_name(const char *name); |
214 | 214 | |
215 | + /** | |
216 | + * @brief Disable automatic download of the CRL. | |
217 | + * | |
218 | + * @param hSession Session handle. | |
219 | + * | |
220 | + */ | |
221 | + LIB3270_EXPORT void lib3270_disable_crl_download(H3270 *hSession); | |
222 | + | |
215 | 223 | #ifdef __cplusplus |
216 | 224 | } |
217 | 225 | #endif | ... | ... |
src/ssl/crl.c
... | ... | @@ -247,32 +247,40 @@ int lib3270_crl_new_from_dist_points(H3270 *hSession, void *ssl_error, CRL_DIST_ |
247 | 247 | hSession->ssl.crl.url = NULL; |
248 | 248 | } |
249 | 249 | |
250 | - if(hSession->ssl.crl.prefer && *hSession->ssl.crl.prefer) | |
250 | + // | |
251 | + // Downloading CRLs | |
252 | + // | |
253 | + if(hSession->ssl.crl.download) | |
251 | 254 | { |
252 | - size_t length = strlen(hSession->ssl.crl.prefer); | |
253 | - | |
254 | - for(ix = 0; ix < uris->length; ix++) | |
255 | + if(hSession->ssl.crl.prefer && *hSession->ssl.crl.prefer) | |
255 | 256 | { |
256 | - if(!strncmp(uris->str[ix],hSession->ssl.crl.prefer,length)) | |
257 | + size_t length = strlen(hSession->ssl.crl.prefer); | |
258 | + | |
259 | + for(ix = 0; ix < uris->length; ix++) | |
257 | 260 | { |
258 | - trace_ssl(hSession,"Trying preferred URL %s\n",uris->str[ix]); | |
259 | - if(lib3270_crl_new_from_url(hSession, ssl_error, uris->str[ix]) == 0) | |
260 | - return 0; | |
261 | + if(!strncmp(uris->str[ix],hSession->ssl.crl.prefer,length)) | |
262 | + { | |
263 | + trace_ssl(hSession,"Trying preferred URL %s\n",uris->str[ix]); | |
264 | + if(lib3270_crl_new_from_url(hSession, ssl_error, uris->str[ix]) == 0) | |
265 | + return 0; | |
266 | + } | |
267 | + | |
261 | 268 | } |
262 | 269 | |
263 | 270 | } |
264 | 271 | |
265 | - } | |
272 | + // Can't load, try all of them. | |
273 | + for(ix = 0; ix < uris->length; ix++) | |
274 | + { | |
275 | + trace_ssl(hSession,"Trying CRL from %s\n",uris->str[ix]); | |
276 | + if(lib3270_crl_new_from_url(hSession, ssl_error, uris->str[ix]) == 0) | |
277 | + return 0; | |
278 | + } | |
266 | 279 | |
267 | - // Can't load, try all of them. | |
268 | - for(ix = 0; ix < uris->length; ix++) | |
269 | - { | |
270 | - trace_ssl(hSession,"Trying CRL from %s\n",uris->str[ix]); | |
271 | - if(lib3270_crl_new_from_url(hSession, ssl_error, uris->str[ix]) == 0) | |
272 | - return 0; | |
280 | + return -1; | |
273 | 281 | } |
274 | 282 | |
275 | - return -1; | |
283 | + return 0; | |
276 | 284 | |
277 | 285 | } |
278 | 286 | ... | ... |