method to renew the tlsctx

This commit is contained in:
Ralf Haferkamp 2010-02-16 17:48:14 +00:00
parent d0f4f42350
commit b0075c970e
2 changed files with 15 additions and 1 deletions

View File

@ -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" ) );
}
}
}

View File

@ -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;
};