[PHP-CVS] cvs: php-src /ext/ldap ldap.c
patrickallaert Sun Jun 28 22:40:38 2009 UTC Modified files: /php-src/ext/ldap ldap.c Log: forgotten some credits :) http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.205&r2=1.206&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.205 php-src/ext/ldap/ldap.c:1.206 --- php-src/ext/ldap/ldap.c:1.205 Sun Jun 28 22:38:22 2009 +++ php-src/ext/ldap/ldap.c Sun Jun 28 22:40:38 2009 @@ -19,11 +19,12 @@ | Jani Taskinen| | Stig Venaas | | Doug Goldstein | + | Patrick Allaert | | PHP 4.0 updates: Zeev Suraski| +--+ */ -/* $Id: ldap.c,v 1.205 2009/06/28 22:38:22 patrickallaert Exp $ */ +/* $Id: ldap.c,v 1.206 2009/06/28 22:40:38 patrickallaert Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -235,7 +236,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.205 2009/06/28 22:38:22 patrickallaert Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.206 2009/06/28 22:40:38 patrickallaert Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c /ext/ldap/tests bug48441.phpt
patrickallaert Sun Jun 28 22:38:23 2009 UTC Modified files: /php-src/ext/ldap ldap.c /php-src/ext/ldap/tests bug48441.phpt Log: unicode support in ext/ldap http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.204&r2=1.205&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.204 php-src/ext/ldap/ldap.c:1.205 --- php-src/ext/ldap/ldap.c:1.204 Thu Jun 25 14:48:53 2009 +++ php-src/ext/ldap/ldap.c Sun Jun 28 22:38:22 2009 @@ -23,7 +23,7 @@ +--+ */ -/* $Id: ldap.c,v 1.204 2009/06/25 14:48:53 felipe Exp $ */ +/* $Id: ldap.c,v 1.205 2009/06/28 22:38:22 patrickallaert Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -235,7 +235,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.204 2009/06/25 14:48:53 felipe Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.205 2009/06/28 22:38:22 patrickallaert Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -286,7 +286,7 @@ } /* }}} */ -/* {{{ proto resource ldap_connect([string host [, int port [, string wallet [, string wallet_passwd [, int authmode]) +/* {{{ proto resource ldap_connect([string host [, int port [, string wallet [, string wallet_passwd [, int authmode]) U Connect to an LDAP server */ PHP_FUNCTION(ldap_connect) { @@ -307,7 +307,7 @@ WRONG_PARAM_COUNT; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|slssl", &host, &hostlen, &port, &wallet, &walletlen, &walletpasswd, &walletpasswdlen, &authmode) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s&ls&s&l", &host, &hostlen, UG(utf8_conv), &port, &wallet, &walletlen, UG(utf8_conv), &walletpasswd, &walletpasswdlen, UG(utf8_conv), &authmode) != SUCCESS) { RETURN_FALSE; } @@ -385,7 +385,7 @@ } /* }}} */ -/* {{{ proto bool ldap_bind(resource link [, string dn [, string password]]) +/* {{{ proto bool ldap_bind(resource link [, string dn [, string password]]) U Bind to LDAP directory */ PHP_FUNCTION(ldap_bind) { @@ -395,7 +395,7 @@ ldap_linkdata *ld; int rc; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ss", &link, &ldap_bind_dn, &ldap_bind_dnlen, &ldap_bind_pw, &ldap_bind_pwlen) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|s&s&", &link, &ldap_bind_dn, &ldap_bind_dnlen, UG(utf8_conv), &ldap_bind_pw, &ldap_bind_pwlen, UG(utf8_conv)) != SUCCESS) { RETURN_FALSE; } @@ -495,7 +495,7 @@ } /* }}} */ -/* {{{ proto bool ldap_sasl_bind(resource link [, string binddn [, string password [, string sasl_mech [, string sasl_realm [, string sasl_authc_id [, string sasl_authz_id [, string props]]]) +/* {{{ proto bool ldap_sasl_bind(resource link [, string binddn [, string password [, string sasl_mech [, string sasl_realm [, string sasl_authc_id [, string sasl_authz_id [, string props]]]) U Bind to LDAP directory using SASL */ PHP_FUNCTION(ldap_sasl_bind) { @@ -511,7 +511,7 @@ int rc, dn_len, passwd_len, mech_len, realm_len, authc_id_len, authz_id_len, props_len; php_ldap_bictx *ctx; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|sss", &link, &binddn, &dn_len, &passwd, &passwd_len, &sasl_mech, &mech_len, &sasl_realm, &realm_len, &sasl_authc_id, &authc_id_len, &sasl_authz_id, &authz_id_len, &props, &props_len) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|s&s&s&s&s&s&s&", &link, &binddn, &dn_len, UG(utf8_conv), &passwd, &passwd_len, UG(utf8_conv), &sasl_mech, &mech_len, UG(utf8_conv), &sasl_realm, &realm_len, UG(utf8_conv), &sasl_authc_id, &authc_id_len, UG(utf8_conv), &sasl_authz_id, &authz_id_len, UG(utf8_conv), &props, &props_len, UG(utf8_conv)) != SUCCESS) { RETURN_FALSE; } @@ -535,7 +535,7 @@ /* }}} */ #endif /* HAVE_LDAP_SASL */ -/* {{{ proto bool ldap_unbind(resource link) +/* {{{ proto bool ldap_unbind(resource link) U Unbind from LDAP directory */ PHP_FUNCTION(ldap_unbind) { @@ -612,6 +612,7 @@ int num_attribs = 0; int i, errno; int myargcount = ZEND_NUM_ARGS(); + int free_base_dn = 0; int ret = 1; if (zend_parse_parameters(myargcount TSRMLS_CC, "ZZZ|Z", &link, &base_dn, &filter, &attrs, &attrsonly, @@ -695,6 +696,11 @@ /* If anything else than string is passed, ldap_base_dn = NULL */ if (Z_TYPE_PP(base_dn) == IS_STRING) { ldap_base_dn = Z_STRVAL_PP(base_dn); + } else if(Z_TYPE_PP(base_dn) == IS_UNICODE){ +
[PHP-CVS] cvs: php-src /ext/ldap ldap.c /ext/ldap/tests bug48696.phpt
felipe Thu Jun 25 14:48:53 2009 UTC Added files: /php-src/ext/ldap/tests bug48696.phpt Modified files: /php-src/ext/ldap ldap.c Log: - Fixed bug #48696 (ldap_read() segfaults with invalid parameters) http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.203&r2=1.204&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.203 php-src/ext/ldap/ldap.c:1.204 --- php-src/ext/ldap/ldap.c:1.203 Mon Jun 15 15:18:12 2009 +++ php-src/ext/ldap/ldap.c Thu Jun 25 14:48:53 2009 @@ -23,7 +23,7 @@ +--+ */ -/* $Id: ldap.c,v 1.203 2009/06/15 15:18:12 patrickallaert Exp $ */ +/* $Id: ldap.c,v 1.204 2009/06/25 14:48:53 felipe Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -235,7 +235,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.203 2009/06/15 15:18:12 patrickallaert Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.204 2009/06/25 14:48:53 felipe Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -600,7 +600,7 @@ char *ldap_base_dn = NULL; char *ldap_filter = NULL; char **ldap_attrs = NULL; - ldap_linkdata *ld; + ldap_linkdata *ld = NULL; LDAPMessage *ldap_res; int ldap_attrsonly = 0; int ldap_sizelimit = -1; @@ -817,8 +817,10 @@ } cleanup: - // Restoring previous options - php_set_opts(ld->link, old_ldap_sizelimit, old_ldap_timelimit, old_ldap_deref, &ldap_sizelimit, &ldap_timelimit, &ldap_deref); + if (ld) { + /* Restoring previous options */ + php_set_opts(ld->link, old_ldap_sizelimit, old_ldap_timelimit, old_ldap_deref, &ldap_sizelimit, &ldap_timelimit, &ldap_deref); + } if (ldap_attrs != NULL) { efree(ldap_attrs); } http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/tests/bug48696.phpt?view=markup&rev=1.1 Index: php-src/ext/ldap/tests/bug48696.phpt +++ php-src/ext/ldap/tests/bug48696.phpt --TEST-- Bug #48696 (ldap_read() segfaults with invalid parameters) --FILE-- --EXPECTF-- Warning: ldap_read(): supplied argument is not a valid ldap link resource in %s on line %d -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c /ext/ldap/tests bug48441.phpt connect.inc skipifbindfailure.inc
patrickallaert Mon Jun 15 15:18:13 2009 UTC Added files: /php-src/ext/ldap/tests connect.inc skipifbindfailure.inc bug48441.phpt Modified files: /php-src/ext/ldap ldap.c Log: Fixing #48441 (ldap_search() with sizelimit/timelimit/deref options makes those options persistent) http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.202&r2=1.203&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.202 php-src/ext/ldap/ldap.c:1.203 --- php-src/ext/ldap/ldap.c:1.202 Mon Jun 15 15:03:31 2009 +++ php-src/ext/ldap/ldap.c Mon Jun 15 15:18:12 2009 @@ -23,7 +23,7 @@ +--+ */ -/* $Id: ldap.c,v 1.202 2009/06/15 15:03:31 patrickallaert Exp $ */ +/* $Id: ldap.c,v 1.203 2009/06/15 15:18:12 patrickallaert Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -235,7 +235,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.202 2009/06/15 15:03:31 patrickallaert Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.203 2009/06/15 15:18:12 patrickallaert Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -555,13 +555,15 @@ /* {{{ php_set_opts */ -static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref) +static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, int *old_sizelimit, int *old_timelimit, int *old_deref) { /* sizelimit */ if (sizelimit > -1) { #if (LDAP_API_VERSION >= 2004) || HAVE_NSLDAP || HAVE_ORALDAP_10 + ldap_get_option(ldap, LDAP_OPT_SIZELIMIT, old_sizelimit); ldap_set_option(ldap, LDAP_OPT_SIZELIMIT, &sizelimit); #else + *old_sizelimit = ldap->ld_sizelimit; ldap->ld_sizelimit = sizelimit; #endif } @@ -569,8 +571,10 @@ /* timelimit */ if (timelimit > -1) { #if (LDAP_API_VERSION >= 2004) || HAVE_NSLDAP || HAVE_ORALDAP_10 + ldap_get_option(ldap, LDAP_OPT_SIZELIMIT, old_timelimit); ldap_set_option(ldap, LDAP_OPT_TIMELIMIT, &timelimit); #else + *old_timelimit = ldap->ld_timelimit; ldap->ld_timelimit = timelimit; #endif } @@ -578,8 +582,10 @@ /* deref */ if (deref > -1) { #if (LDAP_API_VERSION >= 2004) || HAVE_NSLDAP || HAVE_ORALDAP_10 + ldap_get_option(ldap, LDAP_OPT_SIZELIMIT, old_deref); ldap_set_option(ldap, LDAP_OPT_DEREF, &deref); #else + *old_deref = ldap->ld_deref; ldap->ld_deref = deref; #endif } @@ -600,6 +606,9 @@ int ldap_sizelimit = -1; int ldap_timelimit = -1; int ldap_deref = -1; + int old_ldap_sizelimit = -1; + int old_ldap_timelimit = -1; + int old_ldap_deref = -1; int num_attribs = 0; int i, errno; int myargcount = ZEND_NUM_ARGS(); @@ -735,7 +744,7 @@ ldap_filter = Z_STRVAL_PP(entry); } - php_set_opts(ld->link, ldap_sizelimit, ldap_timelimit, ldap_deref); + php_set_opts(ld->link, ldap_sizelimit, ldap_timelimit, ldap_deref, &old_ldap_sizelimit, &old_ldap_timelimit, &old_ldap_deref); /* Run the actual search */ rcs[i] = ldap_search(ld->link, ldap_base_dn, scope, ldap_filter, ldap_attrs, ldap_attrsonly); @@ -777,7 +786,7 @@ goto cleanup; } - php_set_opts(ld->link, ldap_sizelimit, ldap_timelimit, ldap_deref); + php_set_opts(ld->link, ldap_sizelimit, ldap_timelimit, ldap_deref, &old_ldap_sizelimit, &old_ldap_timelimit, &old_ldap_deref); /* Run the actual search */ errno = ldap_search_s(ld->link, ldap_base_dn, scope, ldap_filter, ldap_attrs, ldap_attrsonly, &ldap_res); @@ -808,6 +817,8 @@ } cleanup: + // Restoring previous options + php_set_opts(ld->link, old_ldap_sizelimit, old_ldap_timelimit, old_ldap_deref, &ldap_sizelimit, &ldap_timelimit, &ldap_deref); if (ldap_attrs != NULL) { efree(ldap_attrs); } http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/tests/connect.inc?view=markup&rev=1.1 Index: php-src/ext/ldap/tests/connect.inc +++ php-src/ext/ldap/tests/connect.inc array( "top", "dcObject", "organization"), "dc"=> "my-domain", "o" => "my-domain", )); ldap_add($link, "cn=userA,dc=my-domain,
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
patrickallaert Mon Jun 15 15:03:31 2009 UTC Modified files: /php-src/ext/ldap ldap.c Log: Refactoring that will help fixing #48441 http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.201&r2=1.202&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.201 php-src/ext/ldap/ldap.c:1.202 --- php-src/ext/ldap/ldap.c:1.201 Sun Jun 7 21:26:45 2009 +++ php-src/ext/ldap/ldap.c Mon Jun 15 15:03:31 2009 @@ -23,7 +23,7 @@ +--+ */ -/* $Id: ldap.c,v 1.201 2009/06/07 21:26:45 patrickallaert Exp $ */ +/* $Id: ldap.c,v 1.202 2009/06/15 15:03:31 patrickallaert Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -235,7 +235,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.201 2009/06/07 21:26:45 patrickallaert Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.202 2009/06/15 15:03:31 patrickallaert Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -603,6 +603,7 @@ int num_attribs = 0; int i, errno; int myargcount = ZEND_NUM_ARGS(); + int ret = 1; if (zend_parse_parameters(myargcount TSRMLS_CC, "ZZZ|Z", &link, &base_dn, &filter, &attrs, &attrsonly, &sizelimit, &timelimit, &deref) == FAILURE) { @@ -630,7 +631,8 @@ case 4 : if (Z_TYPE_PP(attrs) != IS_ARRAY) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected Array as last element"); - RETURN_FALSE; + ret = 0; + goto cleanup; } num_attribs = zend_hash_num_elements(Z_ARRVAL_PP(attrs)); @@ -639,8 +641,8 @@ for (i = 0; ilink, ldap_sizelimit, ldap_timelimit, ldap_deref); - /* Run the actual search */ - errno = ldap_search_s(ld->link, ldap_base_dn, scope, ldap_filter, ldap_attrs, ldap_attrsonly, &ldap_res); + ld = (ldap_linkdata *) zend_fetch_resource(link TSRMLS_CC, -1, "ldap link", NULL, 1, le_link); + if (ld == NULL) { + ret = 0; + goto cleanup; + } - if (ldap_attrs != NULL) { - efree(ldap_attrs); - } + php_set_opts(ld->link, ldap_sizelimit, ldap_timelimit, ldap_deref); - if (errno != LDAP_SUCCESS - && errno != LDAP_SIZELIMIT_EXCEEDED + /* Run the actual search */ + errno = ldap_search_s(ld->link, ldap_base_dn, scope, ldap_filter, ldap_attrs, ldap_attrsonly, &ldap_res); + + if (errno != LDAP_SUCCESS + && errno != LDAP_SIZELIMIT_EXCEEDED #ifdef LDAP_ADMINLIMIT_EXCEEDED - && errno != LDAP_ADMINLIMIT_EXCEEDED + && errno != LDAP_ADMINLIMIT_EXCEEDED #endif #ifdef LDAP_REFERRAL - && errno != LDAP_REFERRAL + && errno != LDAP_REFERRAL #endif - ) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Search: %s", ldap_err2string(errno)); - RETVAL_FALSE; - } else { - if (errno == LDAP_SIZELIMIT_EXCEEDED) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Partial search results returned: Sizelimit exceeded"); - } + ) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Search: %s", ldap_err2string(errno)); + ret = 0; + } else { + if (errno == LDAP_SIZELIMIT_EXCEEDED) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Partial search results returned: Sizelimit exceeded"); + } #ifdef LDAP_ADMINLIMIT_EXCEEDED - else if (errno == LDAP_ADMINLIMIT_EXCEEDED) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Partial search results returned: Adminlimit exceeded"); - } + else if (errno == LDAP_ADMINLIMIT_EXCEEDED) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Partial search results returned: Adminlimit exceeded"); + } #endif - - ZEND_REGISTER_RESOURCE(return_value, ldap_res, le_result); + + ZEND_REGISTER_RESOURCE(return_value, ldap_res, le_result); + } + } + +cleanup: + if (ldap_attrs != NULL) { + efree(ldap_attrs); + } + if (!ret) { + RETVAL_BOOL(ret); } } /* }}} */ -- PHP CVS Mailing List (htt
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
patrickallaert Sun Jun 7 21:26:45 2009 UTC Modified files: /php-src/ext/ldap ldap.c Log: Removed credit http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.200&r2=1.201&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.200 php-src/ext/ldap/ldap.c:1.201 --- php-src/ext/ldap/ldap.c:1.200 Sun Jun 7 20:00:32 2009 +++ php-src/ext/ldap/ldap.c Sun Jun 7 21:26:45 2009 @@ -19,12 +19,11 @@ | Jani Taskinen| | Stig Venaas | | Doug Goldstein | - | Patrick Allaert | | PHP 4.0 updates: Zeev Suraski| +--+ */ -/* $Id: ldap.c,v 1.200 2009/06/07 20:00:32 patrickallaert Exp $ */ +/* $Id: ldap.c,v 1.201 2009/06/07 21:26:45 patrickallaert Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -236,7 +235,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.200 2009/06/07 20:00:32 patrickallaert Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.201 2009/06/07 21:26:45 patrickallaert Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
patrickallaert Sun Jun 7 20:00:32 2009 UTC Modified files: /php-src/ext/ldap ldap.c Log: Fixed ldap_(first|next)_attribute() function producing 2 warning messages in case wrong parameters given http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.199&r2=1.200&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.199 php-src/ext/ldap/ldap.c:1.200 --- php-src/ext/ldap/ldap.c:1.199 Sun Jun 7 13:06:03 2009 +++ php-src/ext/ldap/ldap.c Sun Jun 7 20:00:32 2009 @@ -24,7 +24,7 @@ +--+ */ -/* $Id: ldap.c,v 1.199 2009/06/07 13:06:03 patrickallaert Exp $ */ +/* $Id: ldap.c,v 1.200 2009/06/07 20:00:32 patrickallaert Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -236,7 +236,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.199 2009/06/07 13:06:03 patrickallaert Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.200 2009/06/07 20:00:32 patrickallaert Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -1051,8 +1051,8 @@ ldap_resultentry *resultentry; char *attribute; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr", &link, &result_entry) == FAILURE) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr", &link, &result_entry) != SUCCESS) { + return; } ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link); @@ -1078,8 +1078,8 @@ ldap_resultentry *resultentry; char *attribute; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr", &link, &result_entry) == FAILURE) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr", &link, &result_entry) != SUCCESS) { + return; } ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/ldap ldap.c
Yes, indead, but I have several patchs to commit, bug #48441 and #42060 are assigned to me. Those patch will change the code a lot more. But no problem :) I can remove my name from the authors, I think it was best practice to mention who touched the file... Cheers, Patrick 2009/6/7 Hannes Magnusson : > On Sun, Jun 7, 2009 at 15:06, Patrick Allaert wrote: >> patrickallaert Sun Jun 7 13:06:04 2009 UTC >> >> Modified files: >> /php-src/ext/ldap ldap.c >> Log: >> Fixed bug #48469 (ldap_get_entries() memory leaks on empty search results) >> >> http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.198&r2=1.199&diff_format=u >> Index: php-src/ext/ldap/ldap.c >> diff -u php-src/ext/ldap/ldap.c:1.198 php-src/ext/ldap/ldap.c:1.199 >> --- php-src/ext/ldap/ldap.c:1.198 Tue Apr 21 18:07:42 2009 >> +++ php-src/ext/ldap/ldap.c Sun Jun 7 13:06:03 2009 >> @@ -19,11 +19,12 @@ >> | Jani Taskinen | >> | Stig Venaas | >> | Doug Goldstein | >> + | Patrick Allaert | > > Heh? You barely touched the file. > > -Hannes > -- Patrick Allaert --- http://code.google.com/p/peclapm/ - Alternative PHP Monitor -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/ldap ldap.c
On Sun, Jun 7, 2009 at 15:06, Patrick Allaert wrote: > patrickallaert Sun Jun 7 13:06:04 2009 UTC > > Modified files: > /php-src/ext/ldap ldap.c > Log: > Fixed bug #48469 (ldap_get_entries() memory leaks on empty search results) > > http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.198&r2=1.199&diff_format=u > Index: php-src/ext/ldap/ldap.c > diff -u php-src/ext/ldap/ldap.c:1.198 php-src/ext/ldap/ldap.c:1.199 > --- php-src/ext/ldap/ldap.c:1.198 Tue Apr 21 18:07:42 2009 > +++ php-src/ext/ldap/ldap.c Sun Jun 7 13:06:03 2009 > @@ -19,11 +19,12 @@ > | Jani Taskinen | > | Stig Venaas | > | Doug Goldstein | > + | Patrick Allaert | Heh? You barely touched the file. -Hannes -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
patrickallaert Sun Jun 7 13:06:04 2009 UTC Modified files: /php-src/ext/ldap ldap.c Log: Fixed bug #48469 (ldap_get_entries() memory leaks on empty search results) http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.198&r2=1.199&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.198 php-src/ext/ldap/ldap.c:1.199 --- php-src/ext/ldap/ldap.c:1.198 Tue Apr 21 18:07:42 2009 +++ php-src/ext/ldap/ldap.c Sun Jun 7 13:06:03 2009 @@ -19,11 +19,12 @@ | Jani Taskinen| | Stig Venaas | | Doug Goldstein | + | Patrick Allaert | | PHP 4.0 updates: Zeev Suraski| +--+ */ -/* $Id: ldap.c,v 1.198 2009/04/21 18:07:42 bjori Exp $ */ +/* $Id: ldap.c,v 1.199 2009/06/07 13:06:03 patrickallaert Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -235,7 +236,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.198 2009/04/21 18:07:42 bjori Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.199 2009/06/07 13:06:03 patrickallaert Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -972,9 +973,6 @@ ldap = ld->link; num_entries = ldap_count_entries(ldap, ldap_result); - array_init(return_value); - add_assoc_long(return_value, "count", num_entries); - if (num_entries == 0) { RETURN_NULL(); } @@ -985,6 +983,9 @@ RETURN_FALSE; } + array_init(return_value); + add_assoc_long(return_value, "count", num_entries); + while (ldap_result_entry != NULL) { MAKE_STD_ZVAL(tmp1); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
bjori Tue Apr 21 18:07:42 2009 UTC Modified files: /php-src/ext/ldap ldap.c Log: Adjust reflection info http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.197&r2=1.198&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.197 php-src/ext/ldap/ldap.c:1.198 --- php-src/ext/ldap/ldap.c:1.197 Tue Apr 21 12:26:33 2009 +++ php-src/ext/ldap/ldap.c Tue Apr 21 18:07:42 2009 @@ -23,7 +23,7 @@ +--+ */ -/* $Id: ldap.c,v 1.197 2009/04/21 12:26:33 iliaa Exp $ */ +/* $Id: ldap.c,v 1.198 2009/04/21 18:07:42 bjori Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -235,7 +235,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.197 2009/04/21 12:26:33 iliaa Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.198 2009/04/21 18:07:42 bjori Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -2251,6 +2251,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_connect, 0, 0, 0) ZEND_ARG_INFO(0, hostname) ZEND_ARG_INFO(0, port) +#ifdef HAVE_ORALDAP + ZEND_ARG_INFO(0, wallet) + ZEND_ARG_INFO(0, wallet_passwd) + ZEND_ARG_INFO(0, authmode) +#endif ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_resource, 0, 0, 1) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
iliaa Tue Apr 21 12:26:33 2009 UTC Modified files: /php-src/ext/ldap ldap.c Log: MFB: Adjusted prototype http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.196&r2=1.197&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.196 php-src/ext/ldap/ldap.c:1.197 --- php-src/ext/ldap/ldap.c:1.196 Sun Mar 29 18:44:45 2009 +++ php-src/ext/ldap/ldap.c Tue Apr 21 12:26:33 2009 @@ -23,7 +23,7 @@ +--+ */ -/* $Id: ldap.c,v 1.196 2009/03/29 18:44:45 venaas Exp $ */ +/* $Id: ldap.c,v 1.197 2009/04/21 12:26:33 iliaa Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -235,7 +235,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.196 2009/03/29 18:44:45 venaas Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.197 2009/04/21 12:26:33 iliaa Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -286,7 +286,7 @@ } /* }}} */ -/* {{{ proto resource ldap_connect([string host [, int port]]) +/* {{{ proto resource ldap_connect([string host [, int port [, string wallet [, string wallet_passwd [, int authmode]) Connect to an LDAP server */ PHP_FUNCTION(ldap_connect) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
venaas Sun Mar 29 18:44:45 2009 UTC Modified files: /php-src/ext/ldap ldap.c Log: added OpenLDAP TLS options to ldap_get_option/ldap_set_option http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.195&r2=1.196&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.195 php-src/ext/ldap/ldap.c:1.196 --- php-src/ext/ldap/ldap.c:1.195 Tue Mar 10 23:39:26 2009 +++ php-src/ext/ldap/ldap.c Sun Mar 29 18:44:45 2009 @@ -23,7 +23,7 @@ +--+ */ -/* $Id: ldap.c,v 1.195 2009/03/10 23:39:26 helly Exp $ */ +/* $Id: ldap.c,v 1.196 2009/03/29 18:44:45 venaas Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -187,6 +187,17 @@ REGISTER_LONG_CONSTANT("LDAP_OPT_X_SASL_AUTHZID", LDAP_OPT_X_SASL_AUTHZID, CONST_PERSISTENT | CONST_CS); #endif +#ifdef LDAP_OPT_X_TLS + REGISTER_LONG_CONSTANT("LDAP_OPT_X_TLS_CACERTFILE", LDAP_OPT_X_TLS_CACERTFILE, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_OPT_X_TLS_CACERTDIR", LDAP_OPT_X_TLS_CACERTDIR, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_OPT_X_TLS_CERTFILE", LDAP_OPT_X_TLS_CERTFILE, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_OPT_X_TLS_KEYFILE", LDAP_OPT_X_TLS_KEYFILE, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_OPT_X_TLS_REQUIRE_CERT", LDAP_OPT_X_TLS_REQUIRE_CERT, CONST_PERSISTENT | CONST_CS); +#ifdef LDAP_OPT_X_TLS_CRLCHECK + REGISTER_LONG_CONSTANT("LDAP_OPT_X_TLS_CRLCHECK", LDAP_OPT_X_TLS_CRLCHECK, CONST_PERSISTENT | CONST_CS); +#endif +#endif + #ifdef ORALDAP REGISTER_LONG_CONSTANT("GSLC_SSL_NO_AUTH", GSLC_SSL_NO_AUTH, CONST_PERSISTENT | CONST_CS); REGISTER_LONG_CONSTANT("GSLC_SSL_ONEWAY_AUTH", GSLC_SSL_ONEWAY_AUTH, CONST_PERSISTENT | CONST_CS); @@ -224,7 +235,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.195 2009/03/10 23:39:26 helly Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.196 2009/03/29 18:44:45 venaas Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -1604,6 +1615,12 @@ #ifdef LDAP_OPT_RESTART case LDAP_OPT_RESTART: #endif +#ifdef LDAP_OPT_X_TLS + case LDAP_OPT_X_TLS_REQUIRE_CERT: +#ifdef LDAP_OPT_X_TLS_CRLCHECK + case LDAP_OPT_X_TLS_CRLCHECK: +#endif +#endif { int val; @@ -1651,6 +1668,12 @@ case LDAP_OPT_X_SASL_AUTHCID: case LDAP_OPT_X_SASL_AUTHZID: #endif +#ifdef LDAP_OPT_X_TLS + case LDAP_OPT_X_TLS_CACERTFILE: + case LDAP_OPT_X_TLS_CACERTDIR: + case LDAP_OPT_X_TLS_CERTFILE: + case LDAP_OPT_X_TLS_KEYFILE: +#endif #ifdef LDAP_OPT_MATCHED_DN case LDAP_OPT_MATCHED_DN: #endif @@ -1710,6 +1733,12 @@ #ifdef LDAP_OPT_DEBUG_LEVEL case LDAP_OPT_DEBUG_LEVEL: #endif +#ifdef LDAP_OPT_X_TLS + case LDAP_OPT_X_TLS_REQUIRE_CERT: +#ifdef LDAP_OPT_X_TLS_CRLCHECK + case LDAP_OPT_X_TLS_CRLCHECK: +#endif +#endif { int val; @@ -1754,6 +1783,12 @@ case LDAP_OPT_X_SASL_AUTHCID: case LDAP_OPT_X_SASL_AUTHZID: #endif +#ifdef LDAP_OPT_X_TLS + case LDAP_OPT_X_TLS_CACERTFILE: + case LDAP_OPT_X_TLS_CACERTDIR: + case LDAP_OPT_X_TLS_CERTFILE: + case LDAP_OPT_X_TLS_KEYFILE: +#endif #ifdef LDAP_OPT_MATCHED_DN case LDAP_OPT_MATCHED_DN: #endif -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
felipe Wed Jul 16 13:42:51 2008 UTC Modified files: /php-src/ext/ldap ldap.c Log: - MFB: Fix typo http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.187&r2=1.188&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.187 php-src/ext/ldap/ldap.c:1.188 --- php-src/ext/ldap/ldap.c:1.187 Tue Jul 1 08:12:42 2008 +++ php-src/ext/ldap/ldap.c Wed Jul 16 13:42:51 2008 @@ -23,7 +23,7 @@ +--+ */ -/* $Id: ldap.c,v 1.187 2008/07/01 08:12:42 tony2001 Exp $ */ +/* $Id: ldap.c,v 1.188 2008/07/16 13:42:51 felipe Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -224,7 +224,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.187 2008/07/01 08:12:42 tony2001 Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.188 2008/07/16 13:42:51 felipe Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -2434,7 +2434,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_set_option, 0, 0, 3) ZEND_ARG_INFO(0, link_identifier) ZEND_ARG_INFO(0, option) - ZEND_ARG_INFO(1, newval) + ZEND_ARG_INFO(0, newval) ZEND_END_ARG_INFO() static -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
tony2001Tue Jul 1 08:12:42 2008 UTC Modified files: /php-src/ext/ldap ldap.c Log: MF53 http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.186&r2=1.187&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.186 php-src/ext/ldap/ldap.c:1.187 --- php-src/ext/ldap/ldap.c:1.186 Mon Jun 30 13:47:22 2008 +++ php-src/ext/ldap/ldap.c Tue Jul 1 08:12:42 2008 @@ -23,7 +23,7 @@ +--+ */ -/* $Id: ldap.c,v 1.186 2008/06/30 13:47:22 felipe Exp $ */ +/* $Id: ldap.c,v 1.187 2008/07/01 08:12:42 tony2001 Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -224,7 +224,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.186 2008/06/30 13:47:22 felipe Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.187 2008/07/01 08:12:42 tony2001 Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -1584,7 +1584,7 @@ { zval *link, *retval; ldap_linkdata *ld; - int option; + long option; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz", &link, &option, &retval) != SUCCESS) { return; @@ -1686,7 +1686,7 @@ zval *link, **newval; ldap_linkdata *ld; LDAP *ldap; - int option; + long option; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zlZ", &link, &option, &newval) != SUCCESS) { return; @@ -2019,7 +2019,7 @@ int dn_len, newrdn_len, newparent_len; zend_bool deleteoldrdn; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssb", &link, &dn, &dn_len, &newrdn, &newrdn_len, &newparent, &newparent_len, &deleteoldrdn) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsssb", &link, &dn, &dn_len, &newrdn, &newrdn_len, &newparent, &newparent_len, &deleteoldrdn) != SUCCESS) { return; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c /ext/pcre php_pcre.c /ext/sysvmsg sysvmsg.c /ext/xmlrpc xmlrpc-epi-php.c
felipe Mon Jun 30 13:47:22 2008 UTC Modified files: /php-src/ext/ldap ldap.c /php-src/ext/pcre php_pcre.c /php-src/ext/sysvmsgsysvmsg.c /php-src/ext/xmlrpc xmlrpc-epi-php.c Log: - MFB: zend_arg_defs.c is unnecessary now http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.185&r2=1.186&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.185 php-src/ext/ldap/ldap.c:1.186 --- php-src/ext/ldap/ldap.c:1.185 Sun Jun 29 14:34:39 2008 +++ php-src/ext/ldap/ldap.c Mon Jun 30 13:47:22 2008 @@ -23,7 +23,7 @@ +--+ */ -/* $Id: ldap.c,v 1.185 2008/06/29 14:34:39 felipe Exp $ */ +/* $Id: ldap.c,v 1.186 2008/06/30 13:47:22 felipe Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -86,9 +86,6 @@ #ifdef COMPILE_DL_LDAP ZEND_GET_MODULE(ldap) -# ifdef PHP_WIN32 -# include "zend_arg_defs.c" -# endif #endif static void _close_ldap_link(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{ */ @@ -227,7 +224,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.185 2008/06/29 14:34:39 felipe Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.186 2008/06/30 13:47:22 felipe Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); http://cvs.php.net/viewvc.cgi/php-src/ext/pcre/php_pcre.c?r1=1.234&r2=1.235&diff_format=u Index: php-src/ext/pcre/php_pcre.c diff -u php-src/ext/pcre/php_pcre.c:1.234 php-src/ext/pcre/php_pcre.c:1.235 --- php-src/ext/pcre/php_pcre.c:1.234 Sun Jun 1 18:50:00 2008 +++ php-src/ext/pcre/php_pcre.c Mon Jun 30 13:47:22 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_pcre.c,v 1.234 2008/06/01 18:50:00 bjori Exp $ */ +/* $Id: php_pcre.c,v 1.235 2008/06/30 13:47:22 felipe Exp $ */ /* TODO * php_pcre_replace_impl(): @@ -2142,9 +2142,6 @@ #ifdef COMPILE_DL_PCRE ZEND_GET_MODULE(pcre) -# ifdef PHP_WIN32 -# include "zend_arg_defs.c" -# endif #endif /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/sysvmsg/sysvmsg.c?r1=1.35&r2=1.36&diff_format=u Index: php-src/ext/sysvmsg/sysvmsg.c diff -u php-src/ext/sysvmsg/sysvmsg.c:1.35 php-src/ext/sysvmsg/sysvmsg.c:1.36 --- php-src/ext/sysvmsg/sysvmsg.c:1.35 Wed May 21 12:01:55 2008 +++ php-src/ext/sysvmsg/sysvmsg.c Mon Jun 30 13:47:22 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: sysvmsg.c,v 1.35 2008/05/21 12:01:55 tony2001 Exp $ */ +/* $Id: sysvmsg.c,v 1.36 2008/06/30 13:47:22 felipe Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -96,9 +96,6 @@ #ifdef COMPILE_DL_SYSVMSG ZEND_GET_MODULE(sysvmsg) -# ifdef PHP_WIN32 -# include "zend_arg_defs.c" -# endif #endif /* {{{ PHP_INI @@ -137,7 +134,7 @@ { php_info_print_table_start(); php_info_print_table_row(2, "sysvmsg support", "enabled"); - php_info_print_table_row(2, "Revision", "$Revision: 1.35 $"); + php_info_print_table_row(2, "Revision", "$Revision: 1.36 $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/xmlrpc/xmlrpc-epi-php.c?r1=1.56&r2=1.57&diff_format=u Index: php-src/ext/xmlrpc/xmlrpc-epi-php.c diff -u php-src/ext/xmlrpc/xmlrpc-epi-php.c:1.56 php-src/ext/xmlrpc/xmlrpc-epi-php.c:1.57 --- php-src/ext/xmlrpc/xmlrpc-epi-php.c:1.56Sat Jun 28 22:19:24 2008 +++ php-src/ext/xmlrpc/xmlrpc-epi-php.c Mon Jun 30 13:47:22 2008 @@ -51,7 +51,7 @@ +--+ */ -/* $Id: xmlrpc-epi-php.c,v 1.56 2008/06/28 22:19:24 felipe Exp $ */ +/* $Id: xmlrpc-epi-php.c,v 1.57 2008/06/30 13:47:22 felipe Exp $ */ /** * BUGS: * @@ -187,9 +187,6 @@ #ifdef COMPILE_DL_XMLRPC ZEND_GET_MODULE(xmlrpc) -# ifdef PHP_WIN32 -# include "zend_arg_defs.c" -# endif #endif /*** -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
felipe Sun Jun 29 14:34:39 2008 UTC Modified files: /php-src/ext/ldap ldap.c Log: MFB: - New parameter parsing API - Added arginfo http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.184&r2=1.185&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.184 php-src/ext/ldap/ldap.c:1.185 --- php-src/ext/ldap/ldap.c:1.184 Sun May 4 21:16:22 2008 +++ php-src/ext/ldap/ldap.c Sun Jun 29 14:34:39 2008 @@ -23,7 +23,7 @@ +--+ */ -/* $Id: ldap.c,v 1.184 2008/05/04 21:16:22 colder Exp $ */ +/* $Id: ldap.c,v 1.185 2008/06/29 14:34:39 felipe Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -82,16 +82,6 @@ ZEND_DECLARE_MODULE_GLOBALS(ldap) static PHP_GINIT_FUNCTION(ldap); -static - ZEND_BEGIN_ARG_INFO(arg3to6of6_force_ref, 0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(1) - ZEND_ARG_PASS_INFO(1) - ZEND_ARG_PASS_INFO(1) - ZEND_ARG_PASS_INFO(1) - ZEND_END_ARG_INFO(); - static int le_link, le_result, le_result_entry; #ifdef COMPILE_DL_LDAP @@ -237,7 +227,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.184 2008/05/04 21:16:22 colder Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.185 2008/06/29 14:34:39 felipe Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -605,8 +595,9 @@ int i, errno; int myargcount = ZEND_NUM_ARGS(); - if (myargcount < 3 || myargcount > 8 || zend_get_parameters_ex(myargcount, &link, &base_dn, &filter, &attrs, &attrsonly, &sizelimit, &timelimit, &deref) != SUCCESS) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters(myargcount TSRMLS_CC, "ZZZ|Z", &link, &base_dn, &filter, &attrs, &attrsonly, + &sizelimit, &timelimit, &deref) == FAILURE) { + return; } /* Reverse -> fall through */ @@ -2223,6 +2214,288 @@ /* }}} */ #endif +/* {{{ arginfo */ +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_connect, 0, 0, 0) + ZEND_ARG_INFO(0, hostname) + ZEND_ARG_INFO(0, port) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_resource, 0, 0, 1) + ZEND_ARG_INFO(0, link_identifier) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_bind, 0, 0, 1) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_INFO(0, bind_rdn) + ZEND_ARG_INFO(0, bind_password) +ZEND_END_ARG_INFO() + +#ifdef HAVE_LDAP_SASL +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_sasl_bind, 0, 0, 1) + ZEND_ARG_INFO(0, link) + ZEND_ARG_INFO(0, binddn) + ZEND_ARG_INFO(0, password) + ZEND_ARG_INFO(0, sasl_mech) + ZEND_ARG_INFO(0, sasl_realm) + ZEND_ARG_INFO(0, sasl_authz_id) + ZEND_ARG_INFO(0, props) +ZEND_END_ARG_INFO() +#endif + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_read, 0, 0, 3) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_INFO(0, base_dn) + ZEND_ARG_INFO(0, filter) + ZEND_ARG_INFO(0, attributes) + ZEND_ARG_INFO(0, attrsonly) + ZEND_ARG_INFO(0, sizelimit) + ZEND_ARG_INFO(0, timelimit) + ZEND_ARG_INFO(0, deref) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_list, 0, 0, 3) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_INFO(0, base_dn) + ZEND_ARG_INFO(0, filter) + ZEND_ARG_INFO(0, attributes) + ZEND_ARG_INFO(0, attrsonly) + ZEND_ARG_INFO(0, sizelimit) + ZEND_ARG_INFO(0, timelimit) + ZEND_ARG_INFO(0, deref) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_search, 0, 0, 3) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_INFO(0, base_dn) + ZEND_ARG_INFO(0, filter) + ZEND_ARG_INFO(0, attributes) + ZEND_ARG_INFO(0, attrsonly) + ZEND_ARG_INFO(0, sizelimit) + ZEND_ARG_INFO(0, timelimit) + ZEND_ARG_INFO(0, deref) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_count_entries, 0, 0, 2) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_INFO(0, result_identifier) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_first_entry, 0, 0, 2) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_INFO(0, result_identifier) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_next_entry, 0, 0, 2) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_INFO(0, result_identifier) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_get_entries, 0, 0, 2) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_INFO(0, result_identifier) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arg
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
tony2001Wed Apr 16 13:19:31 2008 UTC Modified files: /php-src/ext/ldap ldap.c Log: always initialize mod_type http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.182&r2=1.183&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.182 php-src/ext/ldap/ldap.c:1.183 --- php-src/ext/ldap/ldap.c:1.182 Wed Apr 16 13:17:44 2008 +++ php-src/ext/ldap/ldap.c Wed Apr 16 13:19:31 2008 @@ -23,7 +23,7 @@ +--+ */ -/* $Id: ldap.c,v 1.182 2008/04/16 13:17:44 tony2001 Exp $ */ +/* $Id: ldap.c,v 1.183 2008/04/16 13:19:31 tony2001 Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -237,7 +237,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.182 2008/04/16 13:17:44 tony2001 Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.183 2008/04/16 13:19:31 tony2001 Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -1322,6 +1322,7 @@ for (i = 0; i < num_attribs; i++) { ldap_mods[i] = emalloc(sizeof(LDAPMod)); ldap_mods[i]->mod_op = oper | LDAP_MOD_BVALUES; + ldap_mods[i]->mod_type = NULL; res = zend_hash_get_current_key_ex(Z_ARRVAL_P(entry), &attribute, &attribute_len, &index, 0, NULL); if (res == HASH_KEY_IS_STRING) { @@ -1331,7 +1332,6 @@ if (tmp) { ldap_mods[i]->mod_type = estrdup(tmp); } else { - ldap_mods[i]->mod_type = NULL; goto error_out; } } else { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
tony2001Wed Apr 16 13:17:44 2008 UTC Modified files: /php-src/ext/ldap ldap.c Log: unicode support and minor leak fix http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.181&r2=1.182&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.181 php-src/ext/ldap/ldap.c:1.182 --- php-src/ext/ldap/ldap.c:1.181 Wed Apr 16 13:02:26 2008 +++ php-src/ext/ldap/ldap.c Wed Apr 16 13:17:44 2008 @@ -23,7 +23,7 @@ +--+ */ -/* $Id: ldap.c,v 1.181 2008/04/16 13:02:26 tony2001 Exp $ */ +/* $Id: ldap.c,v 1.182 2008/04/16 13:17:44 tony2001 Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -237,7 +237,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.181 2008/04/16 13:02:26 tony2001 Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.182 2008/04/16 13:17:44 tony2001 Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -1294,9 +1294,10 @@ ldap_linkdata *ld; char *dn; LDAPMod **ldap_mods; - int i, j, num_attribs, num_values, dn_len; + int i, j, num_attribs, num_values, dn_len, res; + unsigned int attribute_len; int *num_berval; - char *attribute; + zstr attribute; ulong index; int is_full_add=0; /* flag for full add operation so ldap_mod_add can be put back into oper, gerrit THomson */ @@ -1322,13 +1323,27 @@ ldap_mods[i] = emalloc(sizeof(LDAPMod)); ldap_mods[i]->mod_op = oper | LDAP_MOD_BVALUES; - if (zend_hash_get_current_key(Z_ARRVAL_P(entry), &attribute, &index, 0) == HASH_KEY_IS_STRING) { - ldap_mods[i]->mod_type = estrdup(attribute); + res = zend_hash_get_current_key_ex(Z_ARRVAL_P(entry), &attribute, &attribute_len, &index, 0, NULL); + if (res == HASH_KEY_IS_STRING) { + ldap_mods[i]->mod_type = estrndup(attribute.s, attribute_len - 1); + } else if (res == HASH_KEY_IS_UNICODE) { + char *tmp = zend_unicode_to_ascii(attribute.u, attribute_len - 1 TSRMLS_CC); + if (tmp) { + ldap_mods[i]->mod_type = estrdup(tmp); + } else { + ldap_mods[i]->mod_type = NULL; + goto error_out; + } } else { +error_out: php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown attribute in the data"); /* Free allocated memory */ while (i >= 0) { - efree(ldap_mods[i--]); + if (ldap_mods[i]->mod_type) { + efree(ldap_mods[i]->mod_type); + } + efree(ldap_mods[i]); + i--; } efree(num_berval); efree(ldap_mods); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c php_ldap.h
tony2001Wed Apr 16 13:02:26 2008 UTC Modified files: /php-src/ext/ldap ldap.c php_ldap.h Log: convert ext/ldap to use new parameter parsing API also restructure the extension to get rid of some garbage http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.180&r2=1.181&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.180 php-src/ext/ldap/ldap.c:1.181 --- php-src/ext/ldap/ldap.c:1.180 Sat Feb 9 21:58:39 2008 +++ php-src/ext/ldap/ldap.c Wed Apr 16 13:02:26 2008 @@ -23,7 +23,7 @@ +--+ */ -/* $Id: ldap.c,v 1.180 2008/02/09 21:58:39 johannes Exp $ */ +/* $Id: ldap.c,v 1.181 2008/04/16 13:02:26 tony2001 Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -94,99 +94,6 @@ static int le_link, le_result, le_result_entry; -/* - This is just a small subset of the functionality provided by the LDAP library. All the - operations are synchronous. Referrals are not handled automatically. -*/ -/* {{{ ldap_functions[] - */ -const zend_function_entry ldap_functions[] = { - PHP_FE(ldap_connect, NULL) - PHP_FALIAS(ldap_close, ldap_unbind,NULL) - PHP_FE(ldap_bind, NULL) -#ifdef HAVE_LDAP_SASL - PHP_FE(ldap_sasl_bind, NULL) -#endif - PHP_FE(ldap_unbind, NULL) - PHP_FE(ldap_read, NULL) - PHP_FE(ldap_list, NULL) - PHP_FE(ldap_search, NULL) - PHP_FE(ldap_free_result, NULL) - PHP_FE(ldap_count_entries, NULL) - PHP_FE(ldap_first_entry, NULL) - PHP_FE(ldap_next_entry, NULL) - PHP_FE(ldap_get_entries, NULL) - PHP_FE(ldap_first_attribute,third_arg_force_ref) - PHP_FE(ldap_next_attribute, third_arg_force_ref) - PHP_FE(ldap_get_attributes, NULL) - PHP_FALIAS(ldap_get_values, ldap_get_values_len, NULL) - PHP_FE(ldap_get_values_len, NULL) - PHP_FE(ldap_get_dn, NULL) - PHP_FE(ldap_explode_dn, NULL) - PHP_FE(ldap_dn2ufn, NULL) - PHP_FE(ldap_add, NULL) - PHP_FE(ldap_delete, NULL) - PHP_FALIAS(ldap_modify, ldap_mod_replace, NULL) - -/* additional functions for attribute based modifications, Gerrit Thomson */ - PHP_FE(ldap_mod_add, NULL) - PHP_FE(ldap_mod_replace, NULL) - PHP_FE(ldap_mod_del, NULL) -/* end gjt mod */ - - PHP_FE(ldap_errno, NULL) - PHP_FE(ldap_err2str, NULL) - PHP_FE(ldap_error, NULL) - PHP_FE(ldap_compare, NULL) - PHP_FE(ldap_sort, NULL) - -#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 - PHP_FE(ldap_rename, NULL) - PHP_FE(ldap_get_option, third_arg_force_ref) - PHP_FE(ldap_set_option, NULL) - PHP_FE(ldap_first_reference, NULL) - PHP_FE(ldap_next_reference, NULL) -#ifdef HAVE_LDAP_PARSE_REFERENCE - PHP_FE(ldap_parse_reference,third_arg_force_ref) -#endif -#ifdef HAVE_LDAP_PARSE_RESULT - P
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
johannesSat Feb 9 21:58:39 2008 UTC Modified files: /php-src/ext/ldap ldap.c Log: Fix build on Solaris http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.179&r2=1.180&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.179 php-src/ext/ldap/ldap.c:1.180 --- php-src/ext/ldap/ldap.c:1.179 Mon Dec 31 07:12:10 2007 +++ php-src/ext/ldap/ldap.c Sat Feb 9 21:58:39 2008 @@ -23,7 +23,7 @@ +--+ */ -/* $Id: ldap.c,v 1.179 2007/12/31 07:12:10 sebastian Exp $ */ +/* $Id: ldap.c,v 1.180 2008/02/09 21:58:39 johannes Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -327,7 +327,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.179 2007/12/31 07:12:10 sebastian Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.180 2008/02/09 21:58:39 johannes Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -1726,10 +1726,9 @@ zval_dtor(*retval); ZVAL_LONG(*retval, val); } break; -#if defined(LDAP_OPT_NETWORK_TIMEOUT) || defined(LDAP_X_OPT_CONNECT_TIMEOUT) +#ifdef LDAP_OPT_NETWORK_TIMEOUT case LDAP_OPT_NETWORK_TIMEOUT: { -# ifdef LDAP_OPT_NETWORK_TIMEOUT struct timeval *timeout; if (ldap_get_option(ld->link, LDAP_OPT_NETWORK_TIMEOUT, (void *) &timeout)) { @@ -1741,7 +1740,10 @@ zval_dtor(*retval); ZVAL_LONG(*retval, timeout->tv_sec); ldap_memfree(timeout); -# elif defined(LDAP_X_OPT_CONNECT_TIMEOUT) + } break; +#elif defined(LDAP_X_OPT_CONNECT_TIMEOUT) + case LDAP_X_OPT_CONNECT_TIMEOUT: + { int timeout; if (ldap_get_option(ld->link, LDAP_X_OPT_CONNECT_TIMEOUT, &timeout)) { @@ -1749,7 +1751,6 @@ } zval_dtor(*retval); ZVAL_LONG(*retval, (timeout / 1000)); -# endif } break; #endif /* options with string value */ @@ -1834,10 +1835,9 @@ RETURN_FALSE; } } break; -#if defined(LDAP_OPT_NETWORK_TIMEOUT) || defined(LDAP_X_OPT_CONNECT_TIMEOUT) +#ifdef LDAP_OPT_NETWORK_TIMEOUT case LDAP_OPT_NETWORK_TIMEOUT: { -# ifdef LDAP_OPT_NETWORK_TIMEOUT struct timeval timeout; convert_to_long_ex(newval); @@ -1846,15 +1846,17 @@ if (ldap_set_option(ldap, LDAP_OPT_NETWORK_TIMEOUT, (void *) &timeout)) { RETURN_FALSE; } -# elif defined(LDAP_X_OPT_CONNECT_TIMEOUT) + } break; +#elif defined(LDAP_X_OPT_CONNECT_TIMEOUT) + case LDAP_X_OPT_CONNECT_TIMEOUT: + { int timeout; convert_to_long_ex(newval); - timeou = 1000 * Z_LVAL_PP(newval); /* Convert to milliseconds */ + timeout = 1000 * Z_LVAL_PP(newval); /* Convert to milliseconds */ if (ldap_set_option(ldap, LDAP_X_OPT_CONNECT_TIMEOUT, &timeout)) { RETURN_FALSE; } -# endif } break; #endif /* options with string value */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
janiSat Oct 6 02:13:32 2007 UTC Modified files: /php-src/ext/ldap ldap.c Log: - Add support for LDAP_X_OPT_CONNECT_TIMEOUT (Netscape LDAP SDK equivalent for LDAP_OPT_NETWORK_TIMEOUT) http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.177&r2=1.178&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.177 php-src/ext/ldap/ldap.c:1.178 --- php-src/ext/ldap/ldap.c:1.177 Sat Oct 6 01:42:40 2007 +++ php-src/ext/ldap/ldap.c Sat Oct 6 02:13:31 2007 @@ -23,7 +23,7 @@ +--+ */ -/* $Id: ldap.c,v 1.177 2007/10/06 01:42:40 jani Exp $ */ +/* $Id: ldap.c,v 1.178 2007/10/06 02:13:31 jani Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -260,6 +260,8 @@ REGISTER_LONG_CONSTANT("LDAP_OPT_TIMELIMIT", LDAP_OPT_TIMELIMIT, CONST_PERSISTENT | CONST_CS); #ifdef LDAP_OPT_NETWORK_TIMEOUT REGISTER_LONG_CONSTANT("LDAP_OPT_NETWORK_TIMEOUT", LDAP_OPT_NETWORK_TIMEOUT, CONST_PERSISTENT | CONST_CS); +#elif defined (LDAP_X_OPT_CONNECT_TIMEOUT) + REGISTER_LONG_CONSTANT("LDAP_OPT_NETWORK_TIMEOUT", LDAP_X_OPT_CONNECT_TIMEOUT, CONST_PERSISTENT | CONST_CS); #endif REGISTER_LONG_CONSTANT("LDAP_OPT_PROTOCOL_VERSION", LDAP_OPT_PROTOCOL_VERSION, CONST_PERSISTENT | CONST_CS); REGISTER_LONG_CONSTANT("LDAP_OPT_ERROR_NUMBER", LDAP_OPT_ERROR_NUMBER, CONST_PERSISTENT | CONST_CS); @@ -325,7 +327,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.177 2007/10/06 01:42:40 jani Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.178 2007/10/06 02:13:31 jani Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -1724,20 +1726,30 @@ zval_dtor(*retval); ZVAL_LONG(*retval, val); } break; -#ifdef LDAP_OPT_NETWORK_TIMEOUT +#if defined(LDAP_OPT_NETWORK_TIMEOUT) || defined(LDAP_X_OPT_CONNECT_TIMEOUT) case LDAP_OPT_NETWORK_TIMEOUT: { +# ifdef LDAP_OPT_NETWORK_TIMEOUT struct timeval *timeout; - - if (ldap_get_option(ld->link, opt, (void *) &timeout)) { + + if (ldap_get_option(ld->link, LDAP_OPT_NETWORK_TIMEOUT, (void *) &timeout)) { if (timeout) { ldap_memfree(timeout); } RETURN_FALSE; - } + } zval_dtor(*retval); ZVAL_LONG(*retval, timeout->tv_sec); ldap_memfree(timeout); +# elif defined(LDAP_X_OPT_CONNECT_TIMEOUT) + int timeout; + + if (ldap_get_option(ld->link, LDAP_X_OPT_CONNECT_TIMEOUT, &timeout)) { + RETURN_FALSE; + } + zval_dtor(*retval); + ZVAL_LONG(*retval, (timeout / 1000)); +# endif } break; #endif /* options with string value */ @@ -1822,17 +1834,27 @@ RETURN_FALSE; } } break; -#ifdef LDAP_OPT_NETWORK_TIMEOUT +#if defined(LDAP_OPT_NETWORK_TIMEOUT) || defined(LDAP_X_OPT_CONNECT_TIMEOUT) case LDAP_OPT_NETWORK_TIMEOUT: { +# ifdef LDAP_OPT_NETWORK_TIMEOUT struct timeval timeout; - + convert_to_long_ex(newval); timeout.tv_sec = Z_LVAL_PP(newval); timeout.tv_usec = 0; - if (ldap_set_option(ldap, opt, (void *) &timeout)) { + if (ldap_set_option(ldap, LDAP_OPT_NETWORK_TIMEOUT, (void *) &timeout)) { RETURN_FALSE; } +# elif defined(LDAP_X_OPT_CONNECT_TIMEOUT) + int timeout; + + convert_to_long_ex(newval); + timeou = 1000 * Z_LVAL_PP(newval); /* Convert to milliseconds */ + if (ldap_set_option(ldap, LDAP_X_OPT_CONNECT_TIMEOUT, &timeout)) { + RETURN_FALSE; + } +# endif } break; #endif /* options with string value */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
janiSat Oct 6 01:42:40 2007 UTC Modified files: /php-src/ext/ldap ldap.c Log: - Added LDAP_OPT_NETWORK_TIMEOUT option for ldap_set_option() to allow setting network timeout http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.176&r2=1.177&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.176 php-src/ext/ldap/ldap.c:1.177 --- php-src/ext/ldap/ldap.c:1.176 Thu Sep 27 18:28:39 2007 +++ php-src/ext/ldap/ldap.c Sat Oct 6 01:42:40 2007 @@ -23,7 +23,7 @@ +--+ */ -/* $Id: ldap.c,v 1.176 2007/09/27 18:28:39 dmitry Exp $ */ +/* $Id: ldap.c,v 1.177 2007/10/06 01:42:40 jani Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -258,6 +258,9 @@ REGISTER_LONG_CONSTANT("LDAP_OPT_DEREF", LDAP_OPT_DEREF, CONST_PERSISTENT | CONST_CS); REGISTER_LONG_CONSTANT("LDAP_OPT_SIZELIMIT", LDAP_OPT_SIZELIMIT, CONST_PERSISTENT | CONST_CS); REGISTER_LONG_CONSTANT("LDAP_OPT_TIMELIMIT", LDAP_OPT_TIMELIMIT, CONST_PERSISTENT | CONST_CS); +#ifdef LDAP_OPT_NETWORK_TIMEOUT + REGISTER_LONG_CONSTANT("LDAP_OPT_NETWORK_TIMEOUT", LDAP_OPT_NETWORK_TIMEOUT, CONST_PERSISTENT | CONST_CS); +#endif REGISTER_LONG_CONSTANT("LDAP_OPT_PROTOCOL_VERSION", LDAP_OPT_PROTOCOL_VERSION, CONST_PERSISTENT | CONST_CS); REGISTER_LONG_CONSTANT("LDAP_OPT_ERROR_NUMBER", LDAP_OPT_ERROR_NUMBER, CONST_PERSISTENT | CONST_CS); REGISTER_LONG_CONSTANT("LDAP_OPT_REFERRALS", LDAP_OPT_REFERRALS, CONST_PERSISTENT | CONST_CS); @@ -322,7 +325,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.176 2007/09/27 18:28:39 dmitry Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.177 2007/10/06 01:42:40 jani Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -1714,12 +1717,29 @@ #endif { int val; + if (ldap_get_option(ld->link, opt, &val)) { RETURN_FALSE; } zval_dtor(*retval); ZVAL_LONG(*retval, val); } break; +#ifdef LDAP_OPT_NETWORK_TIMEOUT + case LDAP_OPT_NETWORK_TIMEOUT: + { + struct timeval *timeout; + + if (ldap_get_option(ld->link, opt, (void *) &timeout)) { + if (timeout) { + ldap_memfree(timeout); + } + RETURN_FALSE; + } + zval_dtor(*retval); + ZVAL_LONG(*retval, timeout->tv_sec); + ldap_memfree(timeout); + } break; +#endif /* options with string value */ case LDAP_OPT_ERROR_STRING: #ifdef LDAP_OPT_HOST_NAME @@ -1795,12 +1815,26 @@ #endif { int val; + convert_to_long_ex(newval); val = Z_LVAL_PP(newval); if (ldap_set_option(ldap, opt, &val)) { RETURN_FALSE; } } break; +#ifdef LDAP_OPT_NETWORK_TIMEOUT + case LDAP_OPT_NETWORK_TIMEOUT: + { + struct timeval timeout; + + convert_to_long_ex(newval); + timeout.tv_sec = Z_LVAL_PP(newval); + timeout.tv_usec = 0; + if (ldap_set_option(ldap, opt, (void *) &timeout)) { + RETURN_FALSE; + } + } break; +#endif /* options with string value */ case LDAP_OPT_ERROR_STRING: #ifdef LDAP_OPT_HOST_NAME -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
janiTue Jul 17 09:09:03 2007 UTC Modified files: /php-src/ext/ldap ldap.c Log: MFB: %f -> %F http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.174&r2=1.175&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.174 php-src/ext/ldap/ldap.c:1.175 --- php-src/ext/ldap/ldap.c:1.174 Tue Jul 17 08:38:19 2007 +++ php-src/ext/ldap/ldap.c Tue Jul 17 09:09:03 2007 @@ -23,7 +23,7 @@ +--+ */ -/* $Id: ldap.c,v 1.174 2007/07/17 08:38:19 jani Exp $ */ +/* $Id: ldap.c,v 1.175 2007/07/17 09:09:03 jani Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -322,7 +322,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.174 2007/07/17 08:38:19 jani Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.175 2007/07/17 09:09:03 jani Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -347,13 +347,13 @@ #if HAVE_NSLDAP SDKVersion = ldap_version(&ver); - snprintf(tmp, 31, "%f", SDKVersion/100.0); + snprintf(tmp, 31, "%F", SDKVersion/100.0); php_info_print_table_row(2, "SDK Version", tmp); - snprintf(tmp, 31, "%f", ver.protocol_version/100.0); + snprintf(tmp, 31, "%F", ver.protocol_version/100.0); php_info_print_table_row(2, "Highest LDAP Protocol Supported", tmp); - snprintf(tmp, 31, "%f", ver.SSL_version/100.0); + snprintf(tmp, 31, "%F", ver.SSL_version/100.0); php_info_print_table_row(2, "SSL Level Supported", tmp); if (ver.security_level != LDAP_SECURITY_NONE) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
janiTue Jul 17 08:38:19 2007 UTC Modified files: /php-src/ext/ldap ldap.c Log: - Fixed bug #42015 (ldap_rename() gets server error "DSA is unwilling to perform") http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.173&r2=1.174&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.173 php-src/ext/ldap/ldap.c:1.174 --- php-src/ext/ldap/ldap.c:1.173 Fri Jul 13 02:00:26 2007 +++ php-src/ext/ldap/ldap.c Tue Jul 17 08:38:19 2007 @@ -23,7 +23,7 @@ +--+ */ -/* $Id: ldap.c,v 1.173 2007/07/13 02:00:26 jani Exp $ */ +/* $Id: ldap.c,v 1.174 2007/07/17 08:38:19 jani Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -322,7 +322,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.173 2007/07/13 02:00:26 jani Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.174 2007/07/17 08:38:19 jani Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -2074,6 +2074,7 @@ zval **link, **dn, **newrdn, **newparent, **deleteoldrdn; ldap_linkdata *ld; int rc; + char *newp = NULL; if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &link, &dn, &newrdn, &newparent, &deleteoldrdn) == FAILURE) { WRONG_PARAM_COUNT; @@ -2086,10 +2087,12 @@ convert_to_string_ex(newparent); convert_to_boolean_ex(deleteoldrdn); + newp = (Z_STRLEN_PP(newparent) > 0) ? Z_STRVAL_PP(newparent) : NULL; + #if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 - rc = ldap_rename_s(ld->link, Z_STRVAL_PP(dn), Z_STRVAL_PP(newrdn), Z_STRVAL_PP(newparent), Z_BVAL_PP(deleteoldrdn), NULL, NULL); + rc = ldap_rename_s(ld->link, Z_STRVAL_PP(dn), Z_STRVAL_PP(newrdn), newp, Z_BVAL_PP(deleteoldrdn), NULL, NULL); #else - if (Z_STRLEN_PP(newparent) != 0) { + if (newp != NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "You are using old LDAP API, newparent must be the empty string, can only modify RDN"); RETURN_FALSE; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
janiFri Jul 13 02:00:26 2007 UTC Modified files: /php-src/ext/ldap ldap.c Log: - Make sure people call ldap_first_attribute() before ldap_next_attribute() http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.172&r2=1.173&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.172 php-src/ext/ldap/ldap.c:1.173 --- php-src/ext/ldap/ldap.c:1.172 Fri Jul 13 01:15:47 2007 +++ php-src/ext/ldap/ldap.c Fri Jul 13 02:00:26 2007 @@ -23,7 +23,7 @@ +--+ */ -/* $Id: ldap.c,v 1.172 2007/07/13 01:15:47 jani Exp $ */ +/* $Id: ldap.c,v 1.173 2007/07/13 02:00:26 jani Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -322,7 +322,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.172 2007/07/13 01:15:47 jani Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.173 2007/07/13 02:00:26 jani Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -1165,6 +1165,11 @@ ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link); ZEND_FETCH_RESOURCE(resultentry, ldap_resultentry *, result_entry, -1, "ldap result entry", le_result_entry); + if (resultentry->ber == NULL) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "called before calling ldap_first_attribute() or no attributes found in result entry"); + RETURN_FALSE; + } + if ((attribute = ldap_next_attribute(ld->link, resultentry->data, resultentry->ber)) == NULL) { #if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 || WINDOWS if (resultentry->ber != NULL) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
janiFri Jul 13 01:15:47 2007 UTC Modified files: /php-src/ext/ldap ldap.c Log: - Fixed bug #41127 (Memory leak in ldap_{first|next}_attribute functions) [DOC] The last parameter "ber" is removed by this fix! (It's not needed) http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.171&r2=1.172&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.171 php-src/ext/ldap/ldap.c:1.172 --- php-src/ext/ldap/ldap.c:1.171 Thu Jul 12 22:05:09 2007 +++ php-src/ext/ldap/ldap.c Fri Jul 13 01:15:47 2007 @@ -23,7 +23,7 @@ +--+ */ -/* $Id: ldap.c,v 1.171 2007/07/12 22:05:09 jani Exp $ */ +/* $Id: ldap.c,v 1.172 2007/07/13 01:15:47 jani Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -75,6 +75,7 @@ typedef struct { LDAPMessage *data; + BerElement *ber; int id; } ldap_resultentry; @@ -91,7 +92,7 @@ ZEND_ARG_PASS_INFO(1) ZEND_END_ARG_INFO(); -static int le_link, le_result, le_result_entry, le_ber_entry; +static int le_link, le_result, le_result_entry; /* This is just a small subset of the functionality provided by the LDAP library. All the @@ -217,6 +218,10 @@ static void _free_ldap_result_entry(zend_rsrc_list_entry *rsrc TSRMLS_DC) { ldap_resultentry *entry = (ldap_resultentry *)rsrc->ptr; + + if (entry->ber != NULL) { + ber_free(entry->ber, 0); + } zend_list_delete(entry->id); efree(entry); } @@ -286,10 +291,9 @@ REGISTER_LONG_CONSTANT("GSLC_SSL_TWOWAY_AUTH", GSLC_SSL_TWOWAY_AUTH, CONST_PERSISTENT | CONST_CS); #endif - le_result = zend_register_list_destructors_ex(_free_ldap_result, NULL, "ldap result", module_number); le_link = zend_register_list_destructors_ex(_close_ldap_link, NULL, "ldap link", module_number); + le_result = zend_register_list_destructors_ex(_free_ldap_result, NULL, "ldap result", module_number); le_result_entry = zend_register_list_destructors_ex(_free_ldap_result_entry, NULL, "ldap result entry", module_number); - le_ber_entry = zend_register_list_destructors_ex(NULL, NULL, "ldap ber entry", module_number); Z_TYPE(ldap_module_entry) = type; @@ -318,7 +322,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.171 2007/07/12 22:05:09 jani Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.172 2007/07/13 01:15:47 jani Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -993,6 +997,7 @@ resultentry->id = Z_LVAL_PP(result); zend_list_addref(resultentry->id); resultentry->data = entry; + resultentry->ber = NULL; } } /* }}} */ @@ -1021,6 +1026,7 @@ resultentry_next->id = resultentry->id; zend_list_addref(resultentry->id); resultentry_next->data = entry_next; + resultentry_next->ber = NULL; } } /* }}} */ @@ -1091,8 +1097,9 @@ attribute = ldap_next_attribute(ldap, ldap_result_entry, ber); } #if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 || WINDOWS - if (ber != NULL) + if (ber != NULL) { ber_free(ber, 0); + } #endif add_assoc_long(tmp1, "count", num_attrib); @@ -1115,28 +1122,25 @@ } /* }}} */ -/* {{{ proto string ldap_first_attribute(resource link, resource result_entry, int ber) +/* {{{ proto string ldap_first_attribute(resource link, resource result_entry) Return first attribute */ PHP_FUNCTION(ldap_first_attribute) { - zval **link, **result_entry, **berp; + zval **link, **result_entry; ldap_linkdata *ld; ldap_resultentry *resultentry; - BerElement *ber; char *attribute; - if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &link, &result_entry, &berp) == FAILURE) { + if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &result_entry) == FAILURE) { WRONG_PARAM_COUNT; } ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link); ZEND_FETCH_RESOURCE(resultentry, ldap_resultentry *, result_entry, -1, "ldap result entry", le_result_entry); - if ((attribute = ldap_first_attribute(ld->link, resultentry->data, &ber)) == NULL) { + if ((attribute = ldap_first_attribute(ld->link, resultentry->data, &resultentry->ber)) == NULL) { RETURN_FALSE; } else { - ZEND_REGISTER_RESOURCE(*berp, ber, le_ber_entry); - RETVAL_STRING(attribute, 1); #if (LDAP_API_VERSION > 2000)
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
janiThu Jul 12 22:05:10 2007 UTC Modified files: /php-src/ext/ldap ldap.c Log: - Fixed bug #39291 (ldap_sasl_bind() is mising sasl_authc_id paratemeter) # It's the equivalent for the ldapsearch -U parameter # @doc, @DOC or whatever the tag was.. http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.170&r2=1.171&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.170 php-src/ext/ldap/ldap.c:1.171 --- php-src/ext/ldap/ldap.c:1.170 Mon Apr 30 21:39:48 2007 +++ php-src/ext/ldap/ldap.c Thu Jul 12 22:05:09 2007 @@ -23,7 +23,7 @@ +--+ */ -/* $Id: ldap.c,v 1.170 2007/04/30 21:39:48 tony2001 Exp $ */ +/* $Id: ldap.c,v 1.171 2007/07/12 22:05:09 jani Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -318,7 +318,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.170 2007/04/30 21:39:48 tony2001 Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.171 2007/07/12 22:05:09 jani Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -503,15 +503,15 @@ /* {{{ _php_sasl_setdefs */ -static php_ldap_bictx *_php_sasl_setdefs(LDAP *ld, char *sasl_mech, char *sasl_realm, char *binddn, char *pass, char *sasl_authz_id) +static php_ldap_bictx *_php_sasl_setdefs(LDAP *ld, char *sasl_mech, char *sasl_realm, char *sasl_authc_id, char *passwd, char *sasl_authz_id) { php_ldap_bictx *ctx; ctx = ber_memalloc(sizeof(php_ldap_bictx)); ctx->mech= (sasl_mech) ? ber_strdup(sasl_mech) : NULL; ctx->realm = (sasl_realm) ? ber_strdup(sasl_realm) : NULL; - ctx->authcid = (binddn) ? ber_strdup(binddn) : NULL; - ctx->passwd = (pass) ? ber_strdup(pass) : NULL; + ctx->authcid = (sasl_authc_id) ? ber_strdup(sasl_authc_id) : NULL; + ctx->passwd = (passwd) ? ber_strdup(passwd) : NULL; ctx->authzid = (sasl_authz_id) ? ber_strdup(sasl_authz_id) : NULL; if (ctx->mech == NULL) { @@ -577,28 +577,29 @@ } /* }}} */ -/* {{{ proto bool ldap_sasl_bind(resource link [, string binddn, string password, string sasl_mech, string sasl_realm, string sasl_authz_id, string props]) +/* {{{ proto bool ldap_sasl_bind(resource link [, string binddn, string password, string sasl_mech, string sasl_realm, string sasl_authc_id, string sasl_authz_id, string props]) Bind to LDAP directory using SASL */ PHP_FUNCTION(ldap_sasl_bind) { zval *link; ldap_linkdata *ld; char *binddn = NULL; - char *pass = NULL; + char *passwd = NULL; char *sasl_mech = NULL; char *sasl_realm = NULL; char *sasl_authz_id = NULL; + char *sasl_authc_id = NULL; char *props = NULL; - int rc, dn_len, pass_len, mech_len, realm_len, authz_id_len, props_len; + int rc, dn_len, passwd_len, mech_len, realm_len, authc_id_len, authz_id_len, props_len; php_ldap_bictx *ctx; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ss", &link, &binddn, &dn_len, &pass, &pass_len, &sasl_mech, &mech_len, &sasl_realm, &realm_len, &sasl_authz_id, &authz_id_len, &props, &props_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|sss", &link, &binddn, &dn_len, &passwd, &passwd_len, &sasl_mech, &mech_len, &sasl_realm, &realm_len, &sasl_authc_id, &authc_id_len, &sasl_authz_id, &authz_id_len, &props, &props_len) == FAILURE) { RETURN_FALSE; } ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link); - ctx = _php_sasl_setdefs(ld->link, sasl_mech, sasl_realm, binddn, pass, sasl_authz_id); + ctx = _php_sasl_setdefs(ld->link, sasl_mech, sasl_realm, sasl_authc_id, passwd, sasl_authz_id); if (props) { ldap_set_option(ld->link, LDAP_OPT_X_SASL_SECPROPS, props); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
tony2001Mon Apr 30 21:39:48 2007 UTC Modified files: /php-src/ext/ldap ldap.c Log: initialize optional parameters http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.169&r2=1.170&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.169 php-src/ext/ldap/ldap.c:1.170 --- php-src/ext/ldap/ldap.c:1.169 Fri Mar 23 15:07:38 2007 +++ php-src/ext/ldap/ldap.c Mon Apr 30 21:39:48 2007 @@ -23,7 +23,7 @@ +--+ */ -/* $Id: ldap.c,v 1.169 2007/03/23 15:07:38 cardoe Exp $ */ +/* $Id: ldap.c,v 1.170 2007/04/30 21:39:48 tony2001 Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -318,7 +318,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.169 2007/03/23 15:07:38 cardoe Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.170 2007/04/30 21:39:48 tony2001 Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -376,9 +376,9 @@ int hostlen; long port = 389; /* Default port */ #ifdef HAVE_ORALDAP - char *wallet, *walletpasswd; - int walletlen, walletpasswdlen; - long authmode; + char *wallet = NULL, *walletpasswd = NULL; + int walletlen = 0, walletpasswdlen = 0; + long authmode = GSLC_SSL_NO_AUTH; int ssl=0; #endif ldap_linkdata *ld; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
cardoe Fri Mar 23 15:07:38 2007 UTC Modified files: /php-src/ext/ldap ldap.c Log: Replaced all instances of ldap_get_values() with ldap_get_values_len(), which returns back the length of the data so on non-NULL terminated data we don't crash in a strlen(). Removed the PHP function ldap_get_values() since it's the same thing as ldap_get_values_len() now and made it alias ldap_get_values_len(). This should fix some random PHP<->LDAP crashes http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.168&r2=1.169&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.168 php-src/ext/ldap/ldap.c:1.169 --- php-src/ext/ldap/ldap.c:1.168 Mon Jan 1 09:29:25 2007 +++ php-src/ext/ldap/ldap.c Fri Mar 23 15:07:38 2007 @@ -18,11 +18,12 @@ | Gerrit Thomson <[EMAIL PROTECTED]> | | Jani Taskinen <[EMAIL PROTECTED]> | | Stig Venaas<[EMAIL PROTECTED]> | + | Doug Goldstein <[EMAIL PROTECTED]> | | PHP 4.0 updates: Zeev Suraski <[EMAIL PROTECTED]> | +--+ */ -/* $Id: ldap.c,v 1.168 2007/01/01 09:29:25 sebastian Exp $ */ +/* $Id: ldap.c,v 1.169 2007/03/23 15:07:38 cardoe Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -117,7 +118,7 @@ PHP_FE(ldap_first_attribute,third_arg_force_ref) PHP_FE(ldap_next_attribute, third_arg_force_ref) PHP_FE(ldap_get_attributes, NULL) - PHP_FE(ldap_get_values, NULL) + PHP_FALIAS(ldap_get_values, ldap_get_values_len, NULL) PHP_FE(ldap_get_values_len, NULL) PHP_FE(ldap_get_dn, NULL) PHP_FE(ldap_explode_dn, NULL) @@ -317,7 +318,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.168 2007/01/01 09:29:25 sebastian Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.169 2007/03/23 15:07:38 cardoe Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -1036,7 +1037,7 @@ BerElement *ber; char *attribute; size_t attr_len; - char **ldap_value; + struct berval **ldap_value; char *dn; if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &result) == FAILURE) { @@ -1067,16 +1068,16 @@ attribute = ldap_first_attribute(ldap, ldap_result_entry, &ber); while (attribute != NULL) { - ldap_value = ldap_get_values(ldap, ldap_result_entry, attribute); - num_values = ldap_count_values(ldap_value); + ldap_value = ldap_get_values_len(ldap, ldap_result_entry, attribute); + num_values = ldap_count_values_len(ldap_value); MAKE_STD_ZVAL(tmp2); array_init(tmp2); add_assoc_long(tmp2, "count", num_values); for (i = 0; i < num_values; i++) { - add_index_string(tmp2, i, ldap_value[i], 1); + add_index_stringl(tmp2, i, ldap_value[i]->bv_val, ldap_value[i]->bv_len, 1); } - ldap_value_free(ldap_value); + ldap_value_free_len(ldap_value); attr_len = strlen(attribute); zend_hash_update(Z_ARRVAL_P(tmp1), php_strtolower(attribute, attr_len), attr_len+1, (void *) &tmp2, sizeof(zval *), NULL); @@ -1183,7 +1184,7 @@ ldap_linkdata *ld; ldap_resultentry *resultentry; char *attribute; - char **ldap_value; + struct berval **ldap_value; int i, num_values, num_attrib; BerElement *ber; @@ -1199,16 +1200,16 @@ attribute = ldap_first_attribute(ld->link, resultentry->data, &ber); while (attribute != NULL) { - ldap_value = ldap_get_values(ld->link, resultentry->data, attribute); - num_values = ldap_count_values(ldap_value); + ldap_value = ldap_get_values_len(ld->link, resultentry->data, attribute); + num_values = ldap_count_values_len(ldap_value); MAKE_STD_ZVAL(tmp); array_init(tmp); add_assoc_long(tmp, "count", num_values); for (i = 0; i < num_
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
sniper Sun Dec 11 22:38:24 2005 EDT Modified files: /php-src/ext/ldap ldap.c Log: - Added missing fold tags http://cvs.php.net/viewcvs.cgi/php-src/ext/ldap/ldap.c?r1=1.163&r2=1.164&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.163 php-src/ext/ldap/ldap.c:1.164 --- php-src/ext/ldap/ldap.c:1.163 Tue Dec 6 02:24:38 2005 +++ php-src/ext/ldap/ldap.c Sun Dec 11 22:38:24 2005 @@ -22,7 +22,7 @@ +--+ */ -/* $Id: ldap.c,v 1.163 2005/12/06 02:24:38 sniper Exp $ */ +/* $Id: ldap.c,v 1.164 2005/12/11 22:38:24 sniper Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -314,7 +314,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.163 2005/12/06 02:24:38 sniper Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.164 2005/12/11 22:38:24 sniper Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -525,8 +525,9 @@ return ctx; } +/* }}} */ -/* {{{ _php_sasl_setdefs +/* {{{ _php_sasl_freedefs */ static void _php_sasl_freedefs(php_ldap_bictx *ctx) { @@ -537,6 +538,7 @@ if (ctx->authzid) ber_memfree(ctx->authzid); ber_memfree(ctx); } +/* }}} */ /* {{{ _php_sasl_interact Internal interact function for SASL */ @@ -569,6 +571,7 @@ } return LDAP_SUCCESS; } +/* }}} */ /* {{{ proto bool ldap_sasl_bind(resource link [, string binddn, string password, string sasl_mech, string sasl_realm, string sasl_authz_id, string props]) Bind to LDAP directory using SASL */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
sniper Fri Jul 8 20:59:50 2005 EDT Modified files: /php-src/ext/ldap ldap.c Log: - No need to use convert_to_string_ex() when dealing with strings http://cvs.php.net/diff.php/php-src/ext/ldap/ldap.c?r1=1.159&r2=1.160&ty=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.159 php-src/ext/ldap/ldap.c:1.160 --- php-src/ext/ldap/ldap.c:1.159 Fri Jul 8 20:46:45 2005 +++ php-src/ext/ldap/ldap.c Fri Jul 8 20:59:49 2005 @@ -22,7 +22,7 @@ +--+ */ -/* $Id: ldap.c,v 1.159 2005/07/09 00:46:45 sniper Exp $ */ +/* $Id: ldap.c,v 1.160 2005/07/09 00:59:49 sniper Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -314,7 +314,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.159 2005/07/09 00:46:45 sniper Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.160 2005/07/09 00:59:49 sniper Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -730,7 +730,6 @@ /* If anything else than string is passed, ldap_base_dn = NULL */ if (Z_TYPE_PP(base_dn) == IS_STRING) { - convert_to_string_ex(base_dn); ldap_base_dn = Z_STRVAL_PP(base_dn); } } @@ -770,7 +769,6 @@ nbases = 0; /* this means string, not array */ /* If anything else than string is passed, ldap_base_dn = NULL */ if (Z_TYPE_PP(base_dn) == IS_STRING) { - convert_to_string_ex(base_dn); ldap_base_dn = Z_STRVAL_PP(base_dn); } else { ldap_base_dn = NULL; @@ -815,7 +813,6 @@ /* If anything else than string is passed, ldap_base_dn = NULL */ if (Z_TYPE_PP(entry) == IS_STRING) { - convert_to_string_ex(entry); ldap_base_dn = Z_STRVAL_PP(entry); } else { ldap_base_dn = NULL; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
sniper Sun Apr 17 12:26:00 2005 EDT Modified files: /php-src/ext/ldap ldap.c Log: - Fixed bug #30819 (Better support for LDAP SASL bind) http://cvs.php.net/diff.php/php-src/ext/ldap/ldap.c?r1=1.156&r2=1.157&ty=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.156 php-src/ext/ldap/ldap.c:1.157 --- php-src/ext/ldap/ldap.c:1.156 Tue Apr 5 16:31:10 2005 +++ php-src/ext/ldap/ldap.c Sun Apr 17 12:25:59 2005 @@ -22,7 +22,7 @@ +--+ */ -/* $Id: ldap.c,v 1.156 2005/04/05 20:31:10 tony2001 Exp $ */ +/* $Id: ldap.c,v 1.157 2005/04/17 16:25:59 sniper Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -265,6 +265,13 @@ REGISTER_LONG_CONSTANT("LDAP_OPT_DEBUG_LEVEL", LDAP_OPT_DEBUG_LEVEL, CONST_PERSISTENT | CONST_CS); #endif +#ifdef HAVE_LDAP_SASL + REGISTER_LONG_CONSTANT("LDAP_OPT_X_SASL_MECH", LDAP_OPT_X_SASL_MECH, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_OPT_X_SASL_REALM", LDAP_OPT_X_SASL_REALM, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_OPT_X_SASL_AUTHCID", LDAP_OPT_X_SASL_AUTHCID, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_OPT_X_SASL_AUTHZID", LDAP_OPT_X_SASL_AUTHZID, CONST_PERSISTENT | CONST_CS); +#endif + #ifdef ORALDAP REGISTER_LONG_CONSTANT("GSLC_SSL_NO_AUTH", GSLC_SSL_NO_AUTH, CONST_PERSISTENT | CONST_CS); REGISTER_LONG_CONSTANT("GSLC_SSL_ONEWAY_AUTH", GSLC_SSL_ONEWAY_AUTH, CONST_PERSISTENT | CONST_CS); @@ -303,7 +310,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.156 2005/04/05 20:31:10 tony2001 Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.157 2005/04/17 16:25:59 sniper Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -478,42 +485,122 @@ /* }}} */ #ifdef HAVE_LDAP_SASL +typedef struct { + char *mech; + char *realm; + char *authcid; + char *passwd; + char *authzid; +} php_ldap_bictx; + +/* {{{ _php_sasl_setdefs + */ +static php_ldap_bictx *_php_sasl_setdefs(LDAP *ld, char *sasl_mech, char *sasl_realm, char *binddn, char *pass, char *sasl_authz_id) +{ + php_ldap_bictx *ctx; + + ctx = ber_memalloc(sizeof(php_ldap_bictx)); + ctx->mech= (sasl_mech) ? ber_strdup(sasl_mech) : NULL; + ctx->realm = (sasl_realm) ? ber_strdup(sasl_realm) : NULL; + ctx->authcid = (binddn) ? ber_strdup(binddn) : NULL; + ctx->passwd = (pass) ? ber_strdup(pass) : NULL; + ctx->authzid = (sasl_authz_id) ? ber_strdup(sasl_authz_id) : NULL; + + if (ctx->mech == NULL) { + ldap_get_option(ld, LDAP_OPT_X_SASL_MECH, &ctx->mech); + } + if (ctx->realm == NULL) { + ldap_get_option(ld, LDAP_OPT_X_SASL_REALM, &ctx->realm); + } + if (ctx->authcid == NULL) { + ldap_get_option(ld, LDAP_OPT_X_SASL_AUTHCID, &ctx->authcid); + } + if (ctx->authzid == NULL) { + ldap_get_option(ld, LDAP_OPT_X_SASL_AUTHZID, &ctx->authzid); + } + + return ctx; +} + +/* {{{ _php_sasl_setdefs + */ +static void _php_sasl_freedefs(php_ldap_bictx *ctx) +{ + if (ctx->mech) ber_memfree(ctx->mech); + if (ctx->realm) ber_memfree(ctx->realm); + if (ctx->authcid) ber_memfree(ctx->authcid); + if (ctx->passwd) ber_memfree(ctx->passwd); + if (ctx->authzid) ber_memfree(ctx->authzid); + ber_memfree(ctx); +} + /* {{{ _php_sasl_interact - Interact function for SASL */ + Internal interact function for SASL */ static int _php_sasl_interact(LDAP *ld, unsigned flags, void *defaults, void *in) { sasl_interact_t *interact = in; + const char *p; + php_ldap_bictx *ctx = defaults; - while (interact->id != SASL_CB_LIST_END) { - const char *dflt = interact->defresult; - - interact->result = strdup((dflt && *dflt) ? dflt : ""); - interact->len = interact->result ? strlen(interact->result) : 0; - interact++; - }; + for (;interact->id != SASL_CB_LIST_END;interact++) { + p = NULL; + switch(interact->id) { + case SASL_CB_GETREALM: + p = ctx->realm; + break; + case SASL_CB_AUTHNAME: + p = ctx->authcid; + break; + case SASL_CB_USER: + p = ctx->authzid; + break; + case SASL_CB_PASS: + p = ctx->passwd; + break; + } +
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
tony2001Tue Apr 5 16:31:13 2005 EDT Modified files: /php-src/ext/ldap ldap.c Log: remove proto, it's internal func http://cvs.php.net/diff.php/php-src/ext/ldap/ldap.c?r1=1.155&r2=1.156&ty=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.155 php-src/ext/ldap/ldap.c:1.156 --- php-src/ext/ldap/ldap.c:1.155 Tue Jan 18 19:27:21 2005 +++ php-src/ext/ldap/ldap.c Tue Apr 5 16:31:10 2005 @@ -22,7 +22,7 @@ +--+ */ -/* $Id: ldap.c,v 1.155 2005/01/19 00:27:21 sniper Exp $ */ +/* $Id: ldap.c,v 1.156 2005/04/05 20:31:10 tony2001 Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -303,7 +303,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.155 2005/01/19 00:27:21 sniper Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.156 2005/04/05 20:31:10 tony2001 Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -2039,7 +2039,7 @@ #endif /* (LDAP_API_VERSION > 2000) || HAVE_NSLDAP */ #if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC) -/* {{{ proto _ldap_rebind_proc() +/* {{{ _ldap_rebind_proc() */ int _ldap_rebind_proc(LDAP *ldap, const char *url, ber_tag_t req, ber_int_t msgid, void *params) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
sniper Tue Jan 18 19:27:21 2005 EDT Modified files: /php-src/ext/ldap ldap.c Log: - ldap_start_tls() requires ldapv3 protocol -> force it http://cvs.php.net/diff.php/php-src/ext/ldap/ldap.c?r1=1.154&r2=1.155&ty=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.154 php-src/ext/ldap/ldap.c:1.155 --- php-src/ext/ldap/ldap.c:1.154 Mon Jun 28 18:31:28 2004 +++ php-src/ext/ldap/ldap.c Tue Jan 18 19:27:21 2005 @@ -22,7 +22,7 @@ +--+ */ -/* $Id: ldap.c,v 1.154 2004/06/28 22:31:28 iliaa Exp $ */ +/* $Id: ldap.c,v 1.155 2005/01/19 00:27:21 sniper Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -303,7 +303,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.154 2004/06/28 22:31:28 iliaa Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.155 2005/01/19 00:27:21 sniper Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -2017,7 +2017,7 @@ { zval **link; ldap_linkdata *ld; - int rc; + int rc, protocol = LDAP_VERSION3; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &link) == FAILURE) { WRONG_PARAM_COUNT; @@ -2025,7 +2025,9 @@ ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link); - if ((rc = ldap_start_tls_s(ld->link, NULL, NULL)) != LDAP_SUCCESS) { + if (((rc = ldap_set_option(ld->link, LDAP_OPT_PROTOCOL_VERSION, &protocol)) != LDAP_SUCCESS) || + ((rc = ldap_start_tls_s(ld->link, NULL, NULL)) != LDAP_SUCCESS) + ) { php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unable to start TLS: %s", ldap_err2string(rc)); RETURN_FALSE; } else { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
iliaa Mon Jun 28 18:31:29 2004 EDT Modified files: /php-src/ext/ldap ldap.c Log: Removed pointless allocation check. http://cvs.php.net/diff.php/php-src/ext/ldap/ldap.c?r1=1.153&r2=1.154&ty=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.153 php-src/ext/ldap/ldap.c:1.154 --- php-src/ext/ldap/ldap.c:1.153 Tue Jun 1 17:04:33 2004 +++ php-src/ext/ldap/ldap.c Mon Jun 28 18:31:28 2004 @@ -22,7 +22,7 @@ +--+ */ -/* $Id: ldap.c,v 1.153 2004/06/01 21:04:33 iliaa Exp $ */ +/* $Id: ldap.c,v 1.154 2004/06/28 22:31:28 iliaa Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -303,7 +303,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.153 2004/06/01 21:04:33 iliaa Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.154 2004/06/28 22:31:28 iliaa Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -616,10 +616,7 @@ } num_attribs = zend_hash_num_elements(Z_ARRVAL_PP(attrs)); - if ((ldap_attrs = safe_emalloc((num_attribs+1), sizeof(char *), 0)) == NULL) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not allocate memory"); - RETURN_FALSE; - } + ldap_attrs = safe_emalloc((num_attribs+1), sizeof(char *), 0); for (i = 0; ihttp://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
iliaa Tue Jun 1 17:04:33 2004 EDT Modified files: /php-src/ext/ldap ldap.c Log: No need to NULL terminate manually, snprintf() does it for us already. http://cvs.php.net/diff.php/php-src/ext/ldap/ldap.c?r1=1.152&r2=1.153&ty=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.152 php-src/ext/ldap/ldap.c:1.153 --- php-src/ext/ldap/ldap.c:1.152 Wed May 12 06:15:48 2004 +++ php-src/ext/ldap/ldap.c Tue Jun 1 17:04:33 2004 @@ -22,7 +22,7 @@ +--+ */ -/* $Id: ldap.c,v 1.152 2004/05/12 10:15:48 helly Exp $ */ +/* $Id: ldap.c,v 1.153 2004/06/01 21:04:33 iliaa Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -303,19 +303,17 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.152 2004/05/12 10:15:48 helly Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.153 2004/06/01 21:04:33 iliaa Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); } else { snprintf(tmp, 31, "%ld/%ld", LDAPG(num_links), LDAPG(max_links)); } - tmp[31] = '\0'; php_info_print_table_row(2, "Total Links", tmp); #ifdef LDAP_API_VERSION snprintf(tmp, 31, "%d", LDAP_API_VERSION); - tmp[31] = '\0'; php_info_print_table_row(2, "API Version", tmp); #endif @@ -325,27 +323,22 @@ #ifdef LDAP_VENDOR_VERSION snprintf(tmp, 31, "%d", LDAP_VENDOR_VERSION); - tmp[31] = '\0'; php_info_print_table_row(2, "Vendor Version", tmp); #endif #if HAVE_NSLDAP SDKVersion = ldap_version(&ver); snprintf(tmp, 31, "%f", SDKVersion/100.0); - tmp[31] = '\0'; php_info_print_table_row(2, "SDK Version", tmp); snprintf(tmp, 31, "%f", ver.protocol_version/100.0); - tmp[31] = '\0'; php_info_print_table_row(2, "Highest LDAP Protocol Supported", tmp); snprintf(tmp, 31, "%f", ver.SSL_version/100.0); - tmp[31] = '\0'; php_info_print_table_row(2, "SSL Level Supported", tmp); if (ver.security_level != LDAP_SECURITY_NONE) { snprintf(tmp, 31, "%d", ver.security_level); - tmp[31] = '\0'; } else { strcpy(tmp, "SSL not enabled"); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
iliaa Tue Apr 6 19:14:07 2004 EDT Modified files: /php-src/ext/ldap ldap.c Log: Removed pointless check. http://cvs.php.net/diff.php/php-src/ext/ldap/ldap.c?r1=1.150&r2=1.151&ty=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.150 php-src/ext/ldap/ldap.c:1.151 --- php-src/ext/ldap/ldap.c:1.150 Thu Jan 8 03:15:55 2004 +++ php-src/ext/ldap/ldap.c Tue Apr 6 19:14:06 2004 @@ -22,7 +22,7 @@ +--+ */ -/* $Id: ldap.c,v 1.150 2004/01/08 08:15:55 andi Exp $ */ +/* $Id: ldap.c,v 1.151 2004/04/06 23:14:06 iliaa Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -302,7 +302,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.150 2004/01/08 08:15:55 andi Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.151 2004/04/06 23:14:06 iliaa Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -399,9 +399,6 @@ } ld = ecalloc(1, sizeof(ldap_linkdata)); - if (ld == NULL) { - RETURN_FALSE; - } #ifdef LDAP_API_FEATURE_X_OPENLDAP if (host != NULL && strchr(host, '/')) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
iliaa Mon Oct 6 20:36:32 2003 EDT Modified files: /php-src/ext/ldap ldap.c Log: Cleaned up previous patch. Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.148 php-src/ext/ldap/ldap.c:1.149 --- php-src/ext/ldap/ldap.c:1.148 Mon Oct 6 19:33:00 2003 +++ php-src/ext/ldap/ldap.c Mon Oct 6 20:36:31 2003 @@ -22,7 +22,7 @@ +--+ */ -/* $Id: ldap.c,v 1.148 2003/10/06 23:33:00 sniper Exp $ */ +/* $Id: ldap.c,v 1.149 2003/10/07 00:36:31 iliaa Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -302,7 +302,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.148 2003/10/06 23:33:00 sniper Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.149 2003/10/07 00:36:31 iliaa Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -1665,18 +1665,15 @@ { char *val = NULL; - if (ldap_get_option(ld->link, opt, &val)) { - RETURN_FALSE; - } - if (val != NULL) { - if (*val != '\0') { - zval_dtor(*retval); - ZVAL_STRING(*retval, val, 1); + if (ldap_get_option(ld->link, opt, &val) || val == NULL || *val == '\0') { + if (val) { + ldap_memfree(val); } - ldap_memfree(val); - } else { RETURN_FALSE; } + zval_dtor(*retval); + ZVAL_STRING(*retval, val, 1); + ldap_memfree(val); } break; /* options not implemented case LDAP_OPT_SERVER_CONTROLS: -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
sniper Mon Oct 6 19:33:00 2003 EDT Modified files: /php-src/ext/ldap ldap.c Log: - Fixed bug #25764 (ldap_get_option() crashes when called with unbinded ldap link) Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.147 php-src/ext/ldap/ldap.c:1.148 --- php-src/ext/ldap/ldap.c:1.147 Sat Sep 13 13:31:07 2003 +++ php-src/ext/ldap/ldap.c Mon Oct 6 19:33:00 2003 @@ -22,7 +22,7 @@ +--+ */ -/* $Id: ldap.c,v 1.147 2003/09/13 17:31:07 pollita Exp $ */ +/* $Id: ldap.c,v 1.148 2003/10/06 23:33:00 sniper Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -302,7 +302,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.147 2003/09/13 17:31:07 pollita Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.148 2003/10/06 23:33:00 sniper Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -1663,13 +1663,20 @@ case LDAP_OPT_MATCHED_DN: #endif { - char *val; + char *val = NULL; + if (ldap_get_option(ld->link, opt, &val)) { RETURN_FALSE; } - zval_dtor(*retval); - ZVAL_STRING(*retval, val, 1); - ldap_memfree(val); + if (val != NULL) { + if (*val != '\0') { + zval_dtor(*retval); + ZVAL_STRING(*retval, val, 1); + } + ldap_memfree(val); + } else { + RETURN_FALSE; + } } break; /* options not implemented case LDAP_OPT_SERVER_CONTROLS: -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
pollita Sat Sep 13 13:31:07 2003 EDT Modified files: /php-src/ext/ldap ldap.c Log: Fix Bug #25525 ldap_explode_dn crashes when passed invalid params. Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.146 php-src/ext/ldap/ldap.c:1.147 --- php-src/ext/ldap/ldap.c:1.146 Sun Aug 31 16:45:45 2003 +++ php-src/ext/ldap/ldap.c Sat Sep 13 13:31:07 2003 @@ -22,7 +22,7 @@ +--+ */ -/* $Id: ldap.c,v 1.146 2003/08/31 20:45:45 iliaa Exp $ */ +/* $Id: ldap.c,v 1.147 2003/09/13 17:31:07 pollita Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -302,7 +302,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.146 2003/08/31 20:45:45 iliaa Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.147 2003/09/13 17:31:07 pollita Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -1261,7 +1261,10 @@ convert_to_string_ex(dn); convert_to_long_ex(with_attrib); - ldap_value = ldap_explode_dn(Z_STRVAL_PP(dn), Z_LVAL_PP(with_attrib)); + if (!(ldap_value = ldap_explode_dn(Z_STRVAL_PP(dn), Z_LVAL_PP(with_attrib { + /* Invalid parameters were passed to ldap_explode_dn */ + RETURN_FALSE; + } i=0; while (ldap_value[i] != NULL) i++; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ldap ldap.c
sniper Tue Aug 5 07:54:01 2003 EDT Modified files: /php-src/ext/ldap ldap.c Log: The last 4 args are by ref.. Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.143 php-src/ext/ldap/ldap.c:1.144 --- php-src/ext/ldap/ldap.c:1.143 Sun Aug 3 13:44:36 2003 +++ php-src/ext/ldap/ldap.c Tue Aug 5 07:54:01 2003 @@ -22,7 +22,7 @@ +--+ */ -/* $Id: ldap.c,v 1.143 2003/08/03 17:44:36 zeev Exp $ */ +/* $Id: ldap.c,v 1.144 2003/08/05 11:54:01 sniper Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -83,7 +83,7 @@ ZEND_BEGIN_ARG_INFO(arg3to6of6_force_ref, 0) ZEND_ARG_PASS_INFO(0) ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) + ZEND_ARG_PASS_INFO(1) ZEND_ARG_PASS_INFO(1) ZEND_ARG_PASS_INFO(1) ZEND_ARG_PASS_INFO(1) @@ -299,7 +299,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.143 2003/08/03 17:44:36 zeev Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.144 2003/08/05 11:54:01 sniper Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php