RE: [PHP-CVS] com php-src: Added ldap_exop_refresh helper for EXOP REFRESH operation on dds overlay: NEWS ext/ldap/config.m4 ext/ldap/config.w32
ext/ldap/ldap.c ext/ldap/tests/ldap_exop_refresh.phpt
| From: | Anatol Belski | Date: | Thu, 20 Jul 2017 16:25:25 +0000 |
| Subject: | RE: [PHP-CVS] com php-src: Added ldap_exop_refresh helper for EXOP REFRESH operation on dds overlay: NEWS ext/ldap/config.m4 ext/ldap/config.w32 ext/ldap/ldap.c ext/ldap/tests/ldap_exop_refresh.phpt |
||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-98663@lists.php.net to get a copy of this message | ||
Hi Come,
> -----Original Message-----
> From: Côme Bernigaud [mailto:mcmic@php.net]
> Sent: Thursday, July 20, 2017 4:17 PM
> To: php-cvs@lists.php.net
> Subject: [PHP-CVS] com php-src: Added ldap_exop_refresh helper for EXOP
> REFRESH operation on dds overlay: NEWS ext/ldap/config.m4
> ext/ldap/config.w32 ext/ldap/ldap.c ext/ldap/tests/ldap_exop_refresh.phpt
>
> Commit: 5e56d050e582d845e977377a1f8ba8deb15ab082
> Author: Côme Chilliet <mcmic@php.net> Thu, 20 Jul 2017 16:14:47 +0200
> Parents: c098304e172cdabf8c0c685e5e843fff772615ce
> Branches: master
>
> Link: http://git.php.net/?p=php-
> src.git;a=commitdiff;h=5e56d050e582d845e977377a1f8ba8deb15ab082
>
Could you check the AppVeyor build please?
https://ci.appveyor.com/project/php/php-src/build/master.build.2706/job/iyq21palexemyivi#L2192
Regards
Anatol
> Log:
> Added ldap_exop_refresh helper for EXOP REFRESH operation on dds overlay
>
> ldap_exop_refresh(resource link, string dn, int ttl) Returns FALSE on failure,
> newttl on success
>
> Changed paths:
> M NEWS
> M ext/ldap/config.m4
> M ext/ldap/config.w32
> M ext/ldap/ldap.c
> A ext/ldap/tests/ldap_exop_refresh.phpt
>
>
> Diff:
> diff --git a/NEWS b/NEWS
> index 06ebc47..fd284f3 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -6,6 +6,9 @@ PHP NEWS
> . Fixed bug #74941 (session fails to start after having headers sent).
> (morozov)
>
> +- LDAP:
> + . Added ldap_exop_refresh helper for EXOP REFRESH operation with dds
> +overlay
> +
> - ODBC:
> . Removed support for Birdstep. (Kalle)
>
> diff --git a/ext/ldap/config.m4 b/ext/ldap/config.m4 index 7ea238f..f77ff5a
> 100644
> --- a/ext/ldap/config.m4
> +++ b/ext/ldap/config.m4
> @@ -204,7 +204,7 @@ if test "$PHP_LDAP" != "no"; then
>
> dnl Solaris 2.8 claims to be 2004 API, but doesn't have
> dnl ldap_parse_reference() nor ldap_start_tls_s()
> - AC_CHECK_FUNCS([ldap_parse_result ldap_parse_reference ldap_start_tls_s
> ldap_control_find ldap_parse_extended_result ldap_extended_operation
> ldap_extended_operation_s ldap_passwd_s ldap_whoami_s])
> + AC_CHECK_FUNCS([ldap_parse_result ldap_parse_reference
> + ldap_start_tls_s ldap_control_find ldap_parse_extended_result
> + ldap_extended_operation ldap_extended_operation_s ldap_passwd_s
> + ldap_whoami_s ldap_refresh_s])
>
> dnl
> dnl SASL check
> diff --git a/ext/ldap/config.w32 b/ext/ldap/config.w32 index 7713bdc..6263755
> 100644
> --- a/ext/ldap/config.w32
> +++ b/ext/ldap/config.w32
> @@ -25,6 +25,7 @@ if (PHP_LDAP != "no") {
> AC_DEFINE('HAVE_LDAP_EXTENDED_OPERATION_S', 1);
> AC_DEFINE('HAVE_LDAP_PASSWD_S', 1);
> AC_DEFINE('HAVE_LDAP_WHOAMI_S', 1);
> + AC_DEFINE('HAVE_LDAP_REFRESH_S', 1);
> AC_DEFINE('HAVE_LDAP_EXTENDED_OPERATION', 1);
>
> } else {
> diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index a710025..3232414 100644
> --- a/ext/ldap/ldap.c
> +++ b/ext/ldap/ldap.c
> @@ -3513,7 +3513,44 @@ PHP_FUNCTION(ldap_exop_whoami) }
> /* }}} */
> #endif
> +
> +#ifdef HAVE_LDAP_REFRESH_S
> +/* {{{ proto bool|int ldap_exop_refresh(resource link , string dn , int ttl)
> + DDS refresh extended operation */
> +PHP_FUNCTION(ldap_exop_refresh)
> +{
> + zval *link, *dn, *ttl;
> + struct berval ldn;
> + ber_int_t lttl;
> + ber_int_t newttl;
> + ldap_linkdata *ld;
> + int rc;
> +
> + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rzz", &link, &dn, &ttl)
> != SUCCESS) {
> + WRONG_PARAM_COUNT;
> + }
> +
> + if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link",
> le_link)) == NULL) {
> + RETURN_FALSE;
> + }
> +
> + convert_to_string_ex(dn);
> + ldn.bv_val = Z_STRVAL_P(dn);
> + ldn.bv_len = Z_STRLEN_P(dn);
> +
> + convert_to_long_ex(ttl);
> + lttl = (ber_int_t)Z_LVAL_P(ttl);
> +
> + rc = ldap_refresh_s(ld->link, &ldn, lttl, &newttl, NULL, NULL);
> + if (rc != LDAP_SUCCESS ) {
> + php_error_docref(NULL, E_WARNING, "Refresh extended
> operation failed: %s (%d)", ldap_err2string(rc), rc);
> + RETURN_FALSE;
> + }
> +
> + RETURN_LONG(newttl);
> +}
> /* }}} */
> +#endif
>
> /* }}} */
>
> @@ -3818,6 +3855,14 @@
> ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_exop_whoami, 0, 0, 1)
> ZEND_END_ARG_INFO()
> #endif
>
> +#ifdef HAVE_LDAP_REFRESH_S
> +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_exop_refresh, 0, 0, 3)
> + ZEND_ARG_INFO(0, link)
> + ZEND_ARG_INFO(0, dn)
> + ZEND_ARG_INFO(0, ttl)
> +ZEND_END_ARG_INFO()
> +#endif
> +
> #ifdef HAVE_LDAP_PARSE_EXTENDED_RESULT
> ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_parse_exop, 0, 0, 4)
> ZEND_ARG_INFO(0, link)
> @@ -3899,6 +3944,9 @@ const zend_function_entry ldap_functions[] = { #ifdef
> HAVE_LDAP_WHOAMI_S
> PHP_FE(ldap_exop_whoami,
> arginfo_ldap_exop_whoami)
> #endif
> +#ifdef HAVE_LDAP_REFRESH_S
> + PHP_FE(ldap_exop_refresh,
> arginfo_ldap_exop_refresh)
> +#endif
> #ifdef HAVE_LDAP_PARSE_EXTENDED_RESULT
> PHP_FE(ldap_parse_exop,
> arginfo_ldap_parse_exop)
> #endif
> diff --git a/ext/ldap/tests/ldap_exop_refresh.phpt
> b/ext/ldap/tests/ldap_exop_refresh.phpt
> new file mode 100644
> index 0000000..170f013
> --- /dev/null
> +++ b/ext/ldap/tests/ldap_exop_refresh.phpt
> @@ -0,0 +1,43 @@
> +--TEST--
> +ldap_exop_refresh() - Test LDAP refresh extended operation
> +--CREDITS--
> +Emmanuel Dreyfus <manu@netbsd.org>
> +--SKIPIF--
> +<?php require_once('skipif.inc'); ?>
> +<?php require_once('skipifbindfailure.inc'); ?> <?php
> + $link = ldap_connect_and_bind($host, $port, $user, $passwd,
> $protocol_version);
> + $r = ldap_read($link, '', 'objectClass=*',
> array('dynamicsubtrees')),
> + $info = ldap_get_entries($link, $r)[0];
> + if (!isset($info['dynamicsubtrees'])) {
> + die("Overlay DDS not available");
> + }
> +?>
> +--FILE--
> +<?php
> +require "connect.inc";
> +
> +$link = ldap_connect_and_bind($host, $port, $user, $passwd,
> +$protocol_version);
> +
> +insert_dummy_data($link, $base);
> +ldap_add($link, "cn=tmp,$base", array(
> + "objectclass" => array("person", "dynamicObject"),
> + "cn" => "tmp",
> + "sn" => "tmp"
> +));
> +var_dump(
> + ldap_exop_refresh($link, "cn=tmp,$base", 1234) ); ?> ===DONE===
> +--CLEAN--
> +<?php
> +include "connect.inc";
> +
> +$link = ldap_connect_and_bind($host, $port, $user, $passwd,
> +$protocol_version); ldap_delete($link, "cn=tmp,$base");
> +remove_dummy_data($link, $base); ?>
> +--EXPECTF--
> +int(1234)
> +===DONE===
>
>
> --
> PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit:
> http://www.php.net/unsub.php