diff --git a/src/core/properties/boolean.c b/src/core/properties/boolean.c index 51525aa..ffe901b 100644 --- a/src/core/properties/boolean.c +++ b/src/core/properties/boolean.c @@ -45,6 +45,13 @@ return hSession->starting != 0; } + void lib3270_disable_crl_download(H3270 *hSession) + { +#ifdef SSL_ENABLE_CRL_CHECK + hSession->ssl.crl.download = 0; +#endif // SSL_ENABLE_CRL_CHECK + } + const LIB3270_INT_PROPERTY * lib3270_get_boolean_properties_list(void) { diff --git a/src/core/session.c b/src/core/session.c index 201536d..66c1db3 100644 --- a/src/core/session.c +++ b/src/core/session.c @@ -410,6 +410,10 @@ H3270 * lib3270_session_new(const char *model) hSession = lib3270_malloc(sizeof(H3270)); hSession->id = 0; +#ifdef SSL_ENABLE_CRL_CHECK + hSession->ssl.crl.download = 1; +#endif // SSL_ENABLE_CRL_CHECK + if(!default_session) default_session = hSession; diff --git a/src/include/internals.h b/src/include/internals.h index 013b806..af58e53 100644 --- a/src/include/internals.h +++ b/src/include/internals.h @@ -147,15 +147,6 @@ LIB3270_INTERNAL const char * build_rpq_revision; LIB3270_INTERNAL Boolean dbcs; #endif /*]*/ - -/** - * @brief toggle names - */ /* -struct toggle_name { - const char *name; - int index; -}; */ - /// @brief State macros #define PCONNECTED lib3270_pconnected(hSession) #define HALF_CONNECTED lib3270_half_connected(hSession) @@ -188,14 +179,6 @@ struct toggle_name { #define PN ((XtPointer) NULL) #define Replace(var, value) { lib3270_free(var); var = (value); }; -/// @brief Configuration change masks. -//#define NO_CHANGE 0x0000 /// @brief no change -// #define MODEL_CHANGE 0x0001 /// @brief screen dimensions changed -//#define FONT_CHANGE 0x0002 /// @brief emulator font changed -//#define COLOR_CHANGE 0x0004 /// @brief color scheme or 3278/9 mode changed -//#define SCROLL_CHANGE 0x0008 /// @brief scrollbar snapped on or off -//#define CHARSET_CHANGE 0x0010 /// @brief character set changed -// #define ALL_CHANGE 0xffff /// @brief everything changed /* Portability macros */ @@ -218,14 +201,6 @@ struct toggle_name { #define DFT_BUF (4 * 1024) #endif /*]*/ -/* DBCS Preedit Types */ /* -#if defined(X3270_DBCS) - #define PT_ROOT "Root" - #define PT_OVER_THE_SPOT "OverTheSpot" - #define PT_OFF_THE_SPOT "OffTheSpot" - #define PT_ON_THE_SPOT "OnTheSpot" -#endif */ - /** * @brief input key type */ @@ -690,6 +665,7 @@ struct _h3270 #ifdef SSL_ENABLE_CRL_CHECK struct { + char download; ///< @brief Non zero to download CRL. char * prefer; ///< @brief Prefered protocol for CRL. char * url; ///< @brief URL for CRL download. X509_CRL * cert; ///< @brief Loaded CRL (can be null). diff --git a/src/include/lib3270/properties.h b/src/include/lib3270/properties.h index 7a75c1e..8c8a047 100644 --- a/src/include/lib3270/properties.h +++ b/src/include/lib3270/properties.h @@ -212,6 +212,14 @@ */ LIB3270_EXPORT const LIB3270_UINT_PROPERTY * lib3270_unsigned_property_get_by_name(const char *name); + /** + * @brief Disable automatic download of the CRL. + * + * @param hSession Session handle. + * + */ + LIB3270_EXPORT void lib3270_disable_crl_download(H3270 *hSession); + #ifdef __cplusplus } #endif diff --git a/src/ssl/crl.c b/src/ssl/crl.c index 45054f2..2dc7235 100644 --- a/src/ssl/crl.c +++ b/src/ssl/crl.c @@ -247,32 +247,40 @@ int lib3270_crl_new_from_dist_points(H3270 *hSession, void *ssl_error, CRL_DIST_ hSession->ssl.crl.url = NULL; } - if(hSession->ssl.crl.prefer && *hSession->ssl.crl.prefer) + // + // Downloading CRLs + // + if(hSession->ssl.crl.download) { - size_t length = strlen(hSession->ssl.crl.prefer); - - for(ix = 0; ix < uris->length; ix++) + if(hSession->ssl.crl.prefer && *hSession->ssl.crl.prefer) { - if(!strncmp(uris->str[ix],hSession->ssl.crl.prefer,length)) + size_t length = strlen(hSession->ssl.crl.prefer); + + for(ix = 0; ix < uris->length; ix++) { - trace_ssl(hSession,"Trying preferred URL %s\n",uris->str[ix]); - if(lib3270_crl_new_from_url(hSession, ssl_error, uris->str[ix]) == 0) - return 0; + if(!strncmp(uris->str[ix],hSession->ssl.crl.prefer,length)) + { + trace_ssl(hSession,"Trying preferred URL %s\n",uris->str[ix]); + if(lib3270_crl_new_from_url(hSession, ssl_error, uris->str[ix]) == 0) + return 0; + } + } } - } + // Can't load, try all of them. + for(ix = 0; ix < uris->length; ix++) + { + trace_ssl(hSession,"Trying CRL from %s\n",uris->str[ix]); + if(lib3270_crl_new_from_url(hSession, ssl_error, uris->str[ix]) == 0) + return 0; + } - // Can't load, try all of them. - for(ix = 0; ix < uris->length; ix++) - { - trace_ssl(hSession,"Trying CRL from %s\n",uris->str[ix]); - if(lib3270_crl_new_from_url(hSession, ssl_error, uris->str[ix]) == 0) - return 0; + return -1; } - return -1; + return 0; } -- libgit2 0.21.2