]> git.sur5r.net Git - openldap/commitdiff
essentially address 3791 with a reworked patch
authorPierangelo Masarati <ando@openldap.org>
Thu, 11 Aug 2005 15:13:29 +0000 (15:13 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 11 Aug 2005 15:13:29 +0000 (15:13 +0000)
libraries/libldap/tls.c

index 4f7a08b9e6b580464314138595b14fa2c3acf778..5e43f8aeb6ae26c1267b066588b04e6a9518d041 100644 (file)
@@ -831,10 +831,14 @@ int
 ldap_tls_inplace( LDAP *ld )
 {
        Sockbuf         *sb = NULL;
-       int             rc;
 
-       rc = ldap_get_option( ld, LDAP_OPT_SOCKBUF, (void *)&sb );
-       if ( rc != LDAP_SUCCESS || sb == NULL ) {
+       if ( ld->ld_defconn && ld->ld_defconn->lconn_sb ) {
+               sb = ld->ld_defconn->lconn_sb;
+
+       } else if ( ld->ld_sb ) {
+               sb = ld->ld_sb;
+
+       } else {
                return 0;
        }
 
@@ -1681,7 +1685,7 @@ 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 ) {
+       if ( ldap_tls_inplace( ld ) ) {
                return LDAP_LOCAL_ERROR;
        }
 
@@ -1703,7 +1707,7 @@ ldap_start_tls_s ( LDAP *ld,
 
        /* XXYYZ: this initiates operation only on default connection! */
 
-       if ( ld->ld_sb != NULL && ldap_pvt_tls_inplace( ld->ld_sb ) != 0 ) {
+       if ( ldap_tls_inplace( ld ) ) {
                return LDAP_LOCAL_ERROR;
        }