From e6c186aa1c5462d05ecc0f7103447a3b25c1d71b Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Tue, 26 Nov 2019 09:12:33 -0300 Subject: [PATCH] Adjusting property names. --- src/core/properties/string.c | 34 +++++++++++++++++----------------- src/include/lib3270.h | 14 ++++++++++---- src/ssl/properties.c | 27 +++++++++++++++++++++++---- src/testprogram/testprogram.c | 6 +++--- 4 files changed, 53 insertions(+), 28 deletions(-) diff --git a/src/core/properties/string.c b/src/core/properties/string.c index 2a7aff0..06b102a 100644 --- a/src/core/properties/string.c +++ b/src/core/properties/string.c @@ -79,7 +79,7 @@ }, { - .name = "model", // Property name. + .name = "model_name", // Property name. .group = LIB3270_ACTION_GROUP_OFFLINE, // Property group. .description = N_( "Model name" ), // Property description. .get = lib3270_get_model_name, // Get value. @@ -132,33 +132,33 @@ }, { - .name = "revision", // Property name. - .description = N_( "lib3270 revision" ), // Property description. - .get = get_revision, // Get value. - .set = NULL // Set value. + .name = "revision", // Property name. + .description = N_( "lib3270 revision" ), // Property description. + .get = get_revision, // Get value. + .set = NULL // Set value. }, { - .name = "crlpath", // Property name. + .name = "crl_url", // Property name. .group = LIB3270_ACTION_GROUP_OFFLINE, // Property group. - .description = N_( "URL for the certificate revocation list" ), // Property description. - .get = lib3270_get_crl_url, // Get value. - .set = lib3270_set_crl_url, // Set value. + .description = N_( "URL for the certificate revocation list" ), // Property description. + .get = lib3270_crl_get_url, // Get value. + .set = lib3270_crl_set_url, // Set value. }, { - .name = "crlprefer", // Property name. + .name = "crl_preferred_protocol", // Property name. .group = LIB3270_ACTION_GROUP_OFFLINE, // Property group. - .description = N_( "Prefered protocol for CRL" ), // Property description. - .get = lib3270_get_crl_prefered_protocol, // Get value. - .set = lib3270_set_crl_prefered_protocol, // Set value. + .description = N_( "Preferred protocol for CRL download" ), // Property description. + .get = lib3270_crl_get_preferred_protocol, // Get value. + .set = lib3270_crl_set_preferred_protocol, // Set value. }, { - .name = "default_host", // Property name. - .description = N_( "Default host URL" ), // Property description. - .get = lib3270_get_default_host, // Get value. - .set = NULL // Set value. + .name = "default_host", // Property name. + .description = N_( "Default host URL" ), // Property description. + .get = lib3270_get_default_host, // Get value. + .set = NULL // Set value. }, { diff --git a/src/include/lib3270.h b/src/include/lib3270.h index b69d6ef..09f6ed0 100644 --- a/src/include/lib3270.h +++ b/src/include/lib3270.h @@ -524,11 +524,17 @@ * @return 0 on sucess, non zero on error (sets errno). * */ - LIB3270_EXPORT int lib3270_set_crl_url(H3270 *hSession, const char *crl); - LIB3270_EXPORT const char * lib3270_get_crl_url(const H3270 *hSession); + LIB3270_EXPORT int lib3270_crl_set_url(H3270 *hSession, const char *crl); + LIB3270_EXPORT const char * lib3270_crl_get_url(const H3270 *hSession); - LIB3270_EXPORT int lib3270_set_crl_prefered_protocol(H3270 *hSession, const char *protocol); - LIB3270_EXPORT const char * lib3270_get_crl_prefered_protocol(const H3270 *hSession); + LIB3270_EXPORT int lib3270_crl_set_preferred_protocol(H3270 *hSession, const char *protocol); + LIB3270_EXPORT const char * lib3270_crl_get_preferred_protocol(const H3270 *hSession); + + /** + * @brief Get the available protocols for CRL download. + * + */ + LIB3270_EXPORT const char ** lib3270_get_available_crl_protocols(void); /** * @brief Get hostname for the connect/reconnect operations. diff --git a/src/ssl/properties.c b/src/ssl/properties.c index 0967ad2..c3f49ac 100644 --- a/src/ssl/properties.c +++ b/src/ssl/properties.c @@ -118,7 +118,7 @@ LIB3270_EXPORT char * lib3270_get_ssl_peer_certificate_text(const H3270 *hSessio #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" - const char * lib3270_get_crl_url(const H3270 *hSession) + const char * lib3270_crl_get_url(const H3270 *hSession) { #ifdef SSL_ENABLE_CRL_CHECK if(hSession->ssl.crl.url) @@ -139,7 +139,7 @@ LIB3270_EXPORT char * lib3270_get_ssl_peer_certificate_text(const H3270 *hSessio #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" - int lib3270_set_crl_url(H3270 *hSession, const char *crl) + int lib3270_crl_set_url(H3270 *hSession, const char *crl) { FAIL_IF_ONLINE(hSession); @@ -174,9 +174,28 @@ LIB3270_EXPORT char * lib3270_get_ssl_peer_certificate_text(const H3270 *hSessio } #pragma GCC diagnostic pop + const char ** lib3270_crl_get_available_protocols(void) + { + static const char * protocols[] = + { +#ifdef HAVE_LDAP + "ldap", +#endif // HAVE_LDAP + +#if defined(_WIN32) || defined(HAVE_LIBCURL) + "http", +#endif // _WIN32 || LIBCURL + + NULL + }; + + return protocols; + } + + #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" - const char * lib3270_get_crl_prefered_protocol(const H3270 *hSession) + const char * lib3270_crl_get_preferred_protocol(const H3270 *hSession) { #ifdef SSL_ENABLE_CRL_CHECK if(hSession->ssl.crl.prefer) @@ -189,7 +208,7 @@ LIB3270_EXPORT char * lib3270_get_ssl_peer_certificate_text(const H3270 *hSessio #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" - int lib3270_set_crl_prefered_protocol(H3270 *hSession, const char *protocol) + int lib3270_crl_set_preferred_protocol(H3270 *hSession, const char *protocol) { FAIL_IF_ONLINE(hSession); diff --git a/src/testprogram/testprogram.c b/src/testprogram/testprogram.c index 4fd297e..01563a8 100644 --- a/src/testprogram/testprogram.c +++ b/src/testprogram/testprogram.c @@ -52,7 +52,7 @@ int main(int argc, char *argv[]) printf("3270 session %p created\n]",h); #ifdef HAVE_LDAP - lib3270_set_crl_prefered_protocol(h,"ldap"); + lib3270_crl_set_preferred_protocol(h,"ldap"); #endif // HAVE_LDAP lib3270_set_url(h,NULL); @@ -66,7 +66,7 @@ int main(int argc, char *argv[]) break; case 'C': - lib3270_set_crl_url(h,optarg); + lib3270_crl_set_url(h,optarg); break; case 't': @@ -77,7 +77,7 @@ int main(int argc, char *argv[]) } - printf("HOST URL: %s\tHOST CRL: %s\n",lib3270_get_url(h),lib3270_get_crl_url(h)); + printf("HOST URL: %s\tHOST CRL: %s\n",lib3270_get_url(h),lib3270_crl_get_url(h)); #ifdef _WIN32 { -- libgit2 0.21.2