From b0075c970e50efed2731de387598ac9348224a4c Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Tue, 16 Feb 2010 17:48:14 +0000 Subject: [PATCH] method to renew the tlsctx --- contrib/ldapc++/src/TlsOptions.cpp | 14 ++++++++++++++ contrib/ldapc++/src/TlsOptions.h | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/contrib/ldapc++/src/TlsOptions.cpp b/contrib/ldapc++/src/TlsOptions.cpp index 8f95815b83..05e2a90882 100644 --- a/contrib/ldapc++/src/TlsOptions.cpp +++ b/contrib/ldapc++/src/TlsOptions.cpp @@ -70,6 +70,9 @@ void TlsOptions::setOption( tls_option opt, void *value ) const { throw( LDAPException( LDAP_PARAM_ERROR, "error while setting TLS option" ) ); } } + if ( m_ld ){ + this->newCtx(); + } } void TlsOptions::getOption( tls_option opt, void* value ) const { @@ -104,3 +107,14 @@ std::string TlsOptions::getStringOption( tls_option opt ) const { return strval; } +void TlsOptions::newCtx() const { + int ret = ldap_set_option( m_ld, LDAP_OPT_X_TLS_NEWCTX, LDAP_OPT_ON); + if ( ret != LDAP_OPT_SUCCESS ) + { + if ( ret != LDAP_OPT_ERROR ){ + throw( LDAPException( ret )); + } else { + throw( LDAPException( LDAP_LOCAL_ERROR, "error while renewing TLS context" ) ); + } + } +} diff --git a/contrib/ldapc++/src/TlsOptions.h b/contrib/ldapc++/src/TlsOptions.h index a4cb0b44db..c572c412e3 100644 --- a/contrib/ldapc++/src/TlsOptions.h +++ b/contrib/ldapc++/src/TlsOptions.h @@ -21,7 +21,6 @@ class TlsOptions { RANDOM_FILE, CRLCHECK, DHFILE, - NEWCTX, LASTOPT /* dummy */ }; @@ -49,6 +48,7 @@ class TlsOptions { }; private: + void newCtx() const; LDAP *m_ld; }; -- 2.39.5