com php-src: Merge branch 'PHP-5.6': ext/ldap/ldap.c

From: Date: Tue, 18 Aug 2015 15:26:46 +0000
Subject: com php-src: Merge branch 'PHP-5.6': ext/ldap/ldap.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-88593@lists.php.net to get a copy of this message
Commit: 8acda9cad515d3b899bccf35762c38c36d5535ed Author: Côme Bernigaud <mcmic@php.net> Tue, 18 Aug 2015 17:26:46 +0200 Parents: af8b6ac310fa86e4ae2b31bdc463b26c26f4400f 54bd91175dd5deeed278f2b45daaab70759a3544 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8acda9cad515d3b899bccf35762c38c36d5535ed Log: Merge branch 'PHP-5.6' * PHP-5.6: Patch from Rainer Jung to provide Solaris LDAP support Conflicts: ext/ldap/ldap.c Changed paths: MM ext/ldap/ldap.c Diff: diff --cc ext/ldap/ldap.c index dbcd2d4,bc1c7bc..80ed496 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@@ -80,8 -87,8 +87,8 @@@ void ldap_memvfree(void **v typedef struct { LDAP *link; - #if defined(HAVE_3ARG_SETREBINDPROC) + #if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC) - zval *rebindproc; + zval rebindproc; #endif } ldap_linkdata; @@@ -104,11 -111,13 +111,9 @@@ static void _close_ldap_link(zend_resou { ldap_linkdata *ld = (ldap_linkdata *)rsrc->ptr; - /* ldap_unbind_s() is deprecated; - * the distinction between ldap_unbind() and ldap_unbind_s() is moot */ ldap_unbind_ext(ld->link, NULL, NULL); - #ifdef HAVE_3ARG_SETREBINDPROC + #if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC) - - if (ld->rebindproc != NULL) { - zval_dtor(ld->rebindproc); - FREE_ZVAL(ld->rebindproc); - } + zval_ptr_dtor(&ld->rebindproc); #endif efree(ld); @@@ -363,7 -369,21 +365,21 @@@ PHP_FUNCTION(ldap_connect snprintf( url, urllen, "ldap://%s:%ld", host ? host : "", port ); } + #ifdef LDAP_API_FEATURE_X_OPENLDAP + /* ldap_init() is deprecated, use ldap_initialize() instead. + */ rc = ldap_initialize(&ldap, url); + #else /* ! LDAP_API_FEATURE_X_OPENLDAP */ + /* ldap_init does not support URLs. + * We must try the original host and port information. + */ + ldap = ldap_init(host, port); + if (ldap == NULL) { + efree(ld); - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not create session handle"); ++ php_error_docref(NULL, E_WARNING, "Could not create session handle"); + RETURN_FALSE; + } + #endif /* ! LDAP_API_FEATURE_X_OPENLDAP */ if (url != host) { efree(url); } @@@ -471,9 -491,12 +489,12 @@@ PHP_FUNCTION(ldap_bind rc = ldap_sasl_bind_s(ld->link, ldap_bind_dn, LDAP_SASL_SIMPLE, &cred, NULL, NULL, /* no controls right now */ NULL); /* we don't care about the server's credentials */ + #else /* ! LDAP_API_FEATURE_X_OPENLDAP */ + rc = ldap_simple_bind_s(ld->link, ldap_bind_dn, ldap_bind_pw); + #endif /* ! LDAP_API_FEATURE_X_OPENLDAP */ } if ( rc != LDAP_SUCCESS) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to bind to server: %s", ldap_err2string(rc)); + php_error_docref(NULL, E_WARNING, "Unable to bind to server: %s", ldap_err2string(rc)); RETURN_FALSE; } else { RETURN_TRUE; @@@ -1344,10 -1322,9 +1365,9 @@@ PHP_FUNCTION(ldap_explode_dn add_assoc_long(return_value, "count", count); for (i = 0; i<count; i++) { - add_index_string(return_value, i, ldap_value[i], 1); + add_index_string(return_value, i, ldap_value[i]); } - /* ldap_value_free() is deprecated */ ldap_memvfree((void **)ldap_value); } /* }}} */

« previous php.cvs (#88593) next »