]> git.sur5r.net Git - openldap/commitdiff
Move ldap_start_tls_s() to tls.c
authorKurt Zeilenga <kurt@openldap.org>
Fri, 25 Aug 2000 02:16:15 +0000 (02:16 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 25 Aug 2000 02:16:15 +0000 (02:16 +0000)
libraries/libldap/open.c
libraries/libldap/tls.c

index 57eec85a359d0544a0b689181ac21875f73ac9c8..2ae39d4c0f8368b212bc70503dd1dc33b5634887 100644 (file)
@@ -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,
index 9aed9ebe083223c0480922ee2af8f70592d7e550..4f64d783fd78525404c8a8b7617c8f17e0992047 100644 (file)
@@ -8,8 +8,6 @@
 
 #include "portable.h"
 
-#ifdef HAVE_TLS
-
 #include <stdio.h>
 
 #include <ac/stdlib.h>
@@ -21,6 +19,8 @@
 
 #include "ldap-int.h"
 
+#ifdef HAVE_TLS
+
 #ifdef LDAP_R_COMPILE
 #include <ldap_pvt_thread.h>
 #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
+}
+