com php-src: Fixed ldap_exop and ldap_parse_exop. Only tested them for whoami exop. (see tes t file): ext/ldap/ldap.c ext/ldap/tests/ldap_exop .phpt

From: Date: Mon, 03 Jul 2017 08:58:13 +0000
Subject: com php-src: Fixed ldap_exop and ldap_parse_exop. Only tested them for whoami exop. (see tes t file): ext/ldap/ldap.c ext/ldap/tests/ldap_exop .phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-98388@lists.php.net to get a copy of this message
Commit: e832ce4b22c09dd753854183f03aa0a02c38cb47 Author: Côme Chilliet <mcmic@php.net> Mon, 26 Jun 2017 11:03:26 +0200 Parents: 28530b2f1ce4d8b9b128385ece6147b10bce2853 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e832ce4b22c09dd753854183f03aa0a02c38cb47 Log: Fixed ldap_exop and ldap_parse_exop. Only tested them for whoami exop. (see test file) Changed paths: M ext/ldap/ldap.c A ext/ldap/tests/ldap_exop.phpt Diff: diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 50f0fb2..e541b35 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -2577,7 +2577,7 @@ PHP_FUNCTION(ldap_parse_exop) struct berval *lretdata; int rc, myargcount = ZEND_NUM_ARGS(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|zz", &link, &result, &retoid, &retdata) == SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|z/z/", &link, &result, &retoid, &retdata) != SUCCESS) { WRONG_PARAM_COUNT; } @@ -3314,7 +3314,7 @@ PHP_FUNCTION(ldap_exop) int rc, msgid, myargcount = ZEND_NUM_ARGS(); /* int reqoid_len, reqdata_len, retdata_len, retoid_len, retdat_len; */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz|zzz", &link, &reqoid, &reqdata, &retoid, &retdata) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz|zz/z/", &link, &reqoid, &reqdata, &retoid, &retdata) != SUCCESS) { WRONG_PARAM_COUNT; } @@ -3879,7 +3879,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_exop, 0, 0, 5) ZEND_ARG_INFO(0, link) ZEND_ARG_INFO(0, reqoid) - ZEND_ARG_INFO(1, reqdata) + ZEND_ARG_INFO(0, reqdata) ZEND_ARG_INFO(1, repoid) ZEND_ARG_INFO(1, repdata) ZEND_END_ARG_INFO() diff --git a/ext/ldap/tests/ldap_exop.phpt b/ext/ldap/tests/ldap_exop.phpt new file mode 100644 index 0000000..883bfa5 --- /dev/null +++ b/ext/ldap/tests/ldap_exop.phpt @@ -0,0 +1,52 @@ +--TEST-- +ldap_exop() and ldap_parse_exop() - EXOP operations +--CREDITS-- +Côme Chilliet <mcmic@php.net> +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +<?php require_once('skipifbindfailure.inc'); ?> +--FILE-- +<?php +require "connect.inc"; + +$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); +insert_dummy_data($link, $base); + +function ber_encode($string) { + $null_padded_string = ''; + for($i = 0; $i<strlen($string); $i++) { + $null_padded_string .= substr($string,$i,1)."\0"; + } + return base64_encode($null_padded_string); +} + +// ldap_exop(resource link, string reqoid [, string reqdata [, string retoid [, string retdata]]]) +// bool ldap_parse_exop(resource link, resource result [, string retoid [, string retdata]]) +var_dump( + ldap_exop($link, "1.3.6.1.4.1.4203.1.11.3", NULL, $retoid, $retdata), + $retdata, + $retoid, + $r = ldap_exop($link, "1.3.6.1.4.1.4203.1.11..3"), + ldap_parse_exop($link, $r, $retoid2, $retdata2), + $retdata2, + $retoid2 +); +?> +===DONE=== +--CLEAN-- +<?php +require "connect.inc"; + +$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); + +remove_dummy_data($link, $base); +?> +--EXPECTF-- +bool(true) +string(%d) "dn:%s" +string(0) "" +resource(%d) of type (ldap result) +bool(true) +string(%d) "dn:%s" +string(0) "" +===DONE===

« previous php.cvs (#98388) next »