From: Kurt Zeilenga Date: Fri, 25 Aug 2000 02:16:15 +0000 (+0000) Subject: Move ldap_start_tls_s() to tls.c X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~2182 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a2afb207be22ff08d97d53829e377269f5cd9e35;p=openldap Move ldap_start_tls_s() to tls.c --- diff --git a/libraries/libldap/open.c b/libraries/libldap/open.c index 57eec85a35..2ae39d4c0f 100644 --- a/libraries/libldap/open.c +++ b/libraries/libldap/open.c @@ -240,47 +240,6 @@ ldap_initialize( LDAP **ldp, LDAP_CONST char *url ) return LDAP_SUCCESS; } -int -ldap_start_tls_s ( LDAP *ld, - LDAPControl **serverctrls, - LDAPControl **clientctrls ) -{ -#ifdef HAVE_TLS - LDAPConn *lc; - int rc; - char *rspoid = NULL; - struct berval *rspdata = NULL; - - if (ld->ld_conns == NULL) { - rc = ldap_open_defconn( ld ); - if (rc != LDAP_SUCCESS) - return(rc); - } - - for (lc = ld->ld_conns; lc != NULL; lc = lc->lconn_next) { - if (ldap_pvt_tls_inplace(lc->lconn_sb) != 0) - return LDAP_OPERATIONS_ERROR; - - /* XXYYZ: this initiates operaton only on default connection! */ - rc = ldap_extended_operation_s(ld, LDAP_EXOP_START_TLS, - NULL, serverctrls, clientctrls, &rspoid, &rspdata); - - if (rc != LDAP_SUCCESS) - return rc; - if (rspoid != NULL) - LDAP_FREE(rspoid); - if (rspdata != NULL) - ber_bvfree(rspdata); - rc = ldap_pvt_tls_start( ld, lc->lconn_sb, ld->ld_options.ldo_tls_ctx ); - if (rc != LDAP_SUCCESS) - return rc; - } - return LDAP_SUCCESS; -#else - return LDAP_NOT_SUPPORTED; -#endif -} - int ldap_int_open_connection( LDAP *ld, diff --git a/libraries/libldap/tls.c b/libraries/libldap/tls.c index 9aed9ebe08..4f64d783fd 100644 --- a/libraries/libldap/tls.c +++ b/libraries/libldap/tls.c @@ -8,8 +8,6 @@ #include "portable.h" -#ifdef HAVE_TLS - #include #include @@ -21,6 +19,8 @@ #include "ldap-int.h" +#ifdef HAVE_TLS + #ifdef LDAP_R_COMPILE #include #endif @@ -1033,7 +1033,46 @@ tls_tmp_dh_cb( SSL *ssl, int is_export, int key_length ) return NULL; } #endif +#endif + +int +ldap_start_tls_s ( LDAP *ld, + LDAPControl **serverctrls, + LDAPControl **clientctrls ) +{ +#ifdef HAVE_TLS + LDAPConn *lc; + int rc; + char *rspoid = NULL; + struct berval *rspdata = NULL; + + if (ld->ld_conns == NULL) { + rc = ldap_open_defconn( ld ); + if (rc != LDAP_SUCCESS) + return(rc); + } + for (lc = ld->ld_conns; lc != NULL; lc = lc->lconn_next) { + if (ldap_pvt_tls_inplace(lc->lconn_sb) != 0) + return LDAP_OPERATIONS_ERROR; + + /* XXYYZ: this initiates operaton only on default connection! */ + rc = ldap_extended_operation_s(ld, LDAP_EXOP_START_TLS, + NULL, serverctrls, clientctrls, &rspoid, &rspdata); + + if (rc != LDAP_SUCCESS) + return rc; + if (rspoid != NULL) + LDAP_FREE(rspoid); + if (rspdata != NULL) + ber_bvfree(rspdata); + rc = ldap_pvt_tls_start( ld, lc->lconn_sb, ld->ld_options.ldo_tls_ctx ); + if (rc != LDAP_SUCCESS) + return rc; + } + return LDAP_SUCCESS; #else -static int dummy; + return LDAP_NOT_SUPPORTED; #endif +} +