From: Kurt Zeilenga Date: Tue, 1 Feb 2005 23:53:17 +0000 (+0000) Subject: Add ldap_start_tls() and ldap_install_tls() to provide async version X-Git-Tag: OPENLDAP_REL_ENG_2_3_BP~194 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=542f3634aae810130c9b003af82c573adb665a13;p=openldap Add ldap_start_tls() and ldap_install_tls() to provide async version of ldap_start_tls_s(). --- diff --git a/include/ldap.h b/include/ldap.h index dda9db93df..45b8dfb189 100644 --- a/include/ldap.h +++ b/include/ldap.h @@ -1304,6 +1304,21 @@ ldap_initialize LDAP_P(( LDAP **ldp, LDAP_CONST char *url )); +/* + * in tls.c + */ + +LDAP_F( int ) +ldap_start_tls LDAP_P(( + LDAP *ld, + LDAPControl **serverctrls, + LDAPControl **clientctrls, + int *msgidp )); + +LDAP_F( int ) +ldap_install_tls LDAP_P(( + LDAP *ld )); + LDAP_F( int ) ldap_start_tls_s LDAP_P(( LDAP *ld, diff --git a/libraries/libldap/tls.c b/libraries/libldap/tls.c index 8a12a89545..6775238aa9 100644 --- a/libraries/libldap/tls.c +++ b/libraries/libldap/tls.c @@ -1651,14 +1651,39 @@ ldap_pvt_tls_get_my_dn( void *s, struct berval *dn, LDAPDN_rewrite_dummy *func, #endif } +int +ldap_start_tls( LDAP *ld, + LDAPControl **serverctrls, + LDAPControl **clientctrls, + int *msgidp ) +{ + return ldap_extended_operation( ld, LDAP_EXOP_START_TLS, + NULL, serverctrls, clientctrls, msgidp ); +} + +int +ldap_install_tls( LDAP *ld ) +{ +#ifndef HAVE_TLS + return LDAP_NOT_SUPPORTED; +#else + if ( ld->ld_sb != NULL && ldap_pvt_tls_inplace( ld->ld_sb ) != 0 ) { + return LDAP_LOCAL_ERROR; + } + + return ldap_int_tls_start( ld, ld->ld_defconn, NULL ); +#endif +} + int ldap_start_tls_s ( LDAP *ld, LDAPControl **serverctrls, LDAPControl **clientctrls ) { +#ifndef HAVE_TLS + return LDAP_NOT_SUPPORTED; +#else int rc; - -#ifdef HAVE_TLS char *rspoid = NULL; struct berval *rspdata = NULL; @@ -1683,9 +1708,7 @@ ldap_start_tls_s ( LDAP *ld, rc = ldap_int_tls_start( ld, ld->ld_defconn, NULL ); } -#else - rc = LDAP_NOT_SUPPORTED; -#endif return rc; +#endif }