mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-03 02:41:24 +08:00
method to renew the tlsctx
This commit is contained in:
parent
d0f4f42350
commit
b0075c970e
@ -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" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user