]> git.sur5r.net Git - openldap/commitdiff
ITS#889 fix
authorKurt Zeilenga <kurt@openldap.org>
Wed, 22 Nov 2000 20:27:30 +0000 (20:27 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Wed, 22 Nov 2000 20:27:30 +0000 (20:27 +0000)
libraries/libldap/open.c

index 9df35ac8885c5066500130ee374c0aa11f9dfc07..904fb0af087478e275a370a040f07fe70ed5fdc3 100644 (file)
@@ -329,9 +329,16 @@ ldap_int_open_connection(
        if (ld->ld_options.ldo_tls_mode == LDAP_OPT_X_TLS_HARD ||
                strcmp( srv->lud_scheme, "ldaps" ) == 0 )
        {
+               LDAPConn        *savedefconn = ld->ld_defconn;
+               ++conn->lconn_refcnt;   /* avoid premature free */
+               ld->ld_defconn = conn;
+
                rc = ldap_pvt_tls_start( ld, conn->lconn_sb,
                        ld->ld_options.ldo_tls_ctx );
 
+               ld->ld_defconn = savedefconn;
+               --conn->lconn_refcnt;
+
                if (rc != LDAP_SUCCESS) {
                        return -1;
                }