@@ -3698,7 +3698,7 @@ PHP_FUNCTION(ldap_start_tls)
3698
3698
{
3699
3699
zval * link ;
3700
3700
ldap_linkdata * ld ;
3701
- int rc , protocol = LDAP_VERSION3 ;
3701
+ int rc , protocol = LDAP_VERSION3 , val = 0 ;
3702
3702
3703
3703
if (zend_parse_parameters (ZEND_NUM_ARGS (), "O" , & link , ldap_link_ce ) != SUCCESS ) {
3704
3704
RETURN_THROWS ();
@@ -3707,18 +3707,10 @@ PHP_FUNCTION(ldap_start_tls)
3707
3707
ld = Z_LDAP_LINK_P (link );
3708
3708
VERIFY_LDAP_LINK_CONNECTED (ld );
3709
3709
3710
+ if (((rc = ldap_set_option (ld -> link , LDAP_OPT_PROTOCOL_VERSION , & protocol )) != LDAP_SUCCESS ) ||
3710
3711
#ifdef LDAP_OPT_X_TLS_NEWCTX
3711
- {
3712
- int val = 0 ;
3713
-
3714
- /* ensure all pending TLS options are applied in a new context */
3715
- if (ldap_set_option (ld -> link , LDAP_OPT_X_TLS_NEWCTX , & val ) != LDAP_OPT_SUCCESS ) {
3716
- php_error_docref (NULL , E_WARNING , "Could not create new security context" );
3717
- }
3718
- }
3712
+ ((rc = ldap_set_option (ld -> link , LDAP_OPT_X_TLS_NEWCTX , & val )) != LDAP_OPT_SUCCESS ) ||
3719
3713
#endif
3720
-
3721
- if (((rc = ldap_set_option (ld -> link , LDAP_OPT_PROTOCOL_VERSION , & protocol )) != LDAP_SUCCESS ) ||
3722
3714
((rc = ldap_start_tls_s (ld -> link , NULL , NULL )) != LDAP_SUCCESS )
3723
3715
) {
3724
3716
php_error_docref (NULL , E_WARNING ,"Unable to start TLS: %s" , ldap_err2string (rc ));
0 commit comments