From: Côme Chilliet Date: Thu, 7 Sep 2017 14:29:11 +0000 (+0200) Subject: Removing client controls attribute from ldap_exop signature X-Git-Tag: php-7.2.0RC2~33 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e67379399a69ee03315d0434e991eeba08639182;p=php Removing client controls attribute from ldap_exop signature Client controls will not get implemented in php-ldap as they are specific to each client ldap lib and most of the time unused any way. (servers controls on the other end are used and will get implemented) --- diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 511db37434..a8b9923b10 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -3322,11 +3322,11 @@ PHP_FUNCTION(ldap_control_paged_result_response) /* {{{ Extended operations, Pierangelo Masarati */ #ifdef HAVE_LDAP_EXTENDED_OPERATION_S -/* {{{ proto resource ldap_exop(resource link, string reqoid [, string reqdata [, array servercontrols [, array clientcontrols [, string &retdata [, string &retoid]]]]]) +/* {{{ proto resource ldap_exop(resource link, string reqoid [, string reqdata [, array servercontrols [, string &retdata [, string &retoid]]]]) Extended operation */ PHP_FUNCTION(ldap_exop) { - zval *servercontrols, *clientcontrols; + zval *servercontrols; zval *link, *reqoid, *reqdata, *retdata, *retoid; char *lreqoid, *lretoid = NULL; struct berval lreqdata, *lretdata = NULL; @@ -3335,7 +3335,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(), "rz|zzzz/z/", &link, &reqoid, &reqdata, &servercontrols, &clientcontrols, &retdata, &retoid) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz|zzz/z/", &link, &reqoid, &reqdata, &servercontrols, &retdata, &retoid) != SUCCESS) { WRONG_PARAM_COUNT; } @@ -3344,7 +3344,6 @@ PHP_FUNCTION(ldap_exop) } switch (myargcount) { - case 7: case 6: case 5: case 4: @@ -3358,13 +3357,13 @@ PHP_FUNCTION(ldap_exop) lreqoid = Z_STRVAL_P(reqoid); } - if (myargcount > 5) { + if (myargcount > 4) { /* synchronous call */ rc = ldap_extended_operation_s(ld->link, lreqoid, lreqdata.bv_len > 0 ? &lreqdata: NULL, NULL, NULL, - myargcount > 6 ? &lretoid : NULL, + myargcount > 5 ? &lretoid : NULL, &lretdata ); if (rc != LDAP_SUCCESS ) { php_error_docref(NULL, E_WARNING, "Extended operation %s failed: %s (%d)", lreqoid, ldap_err2string(rc), rc); @@ -3373,7 +3372,7 @@ PHP_FUNCTION(ldap_exop) /* Reverse -> fall through */ switch (myargcount) { - case 7: + case 6: zval_dtor(retoid); if (lretoid == NULL) { ZVAL_EMPTY_STRING(retoid); @@ -3381,8 +3380,8 @@ PHP_FUNCTION(ldap_exop) ZVAL_STRING(retoid, lretoid); ldap_memfree(lretoid); } - case 6: - /* use arg #4 as the data returned by the server */ + case 5: + /* use arg #5 as the data returned by the server */ zval_dtor(retdata); if (lretdata == NULL) { ZVAL_EMPTY_STRING(retdata); @@ -3802,7 +3801,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_exop, 0, 0, 2) ZEND_ARG_INFO(0, reqoid) ZEND_ARG_INFO(0, reqdata) ZEND_ARG_INFO(0, servercontrols) - ZEND_ARG_INFO(0, clientcontrols) ZEND_ARG_INFO(1, retdata) ZEND_ARG_INFO(1, retoid) ZEND_END_ARG_INFO() diff --git a/ext/ldap/tests/ldap_exop.phpt b/ext/ldap/tests/ldap_exop.phpt index a80372a555..48038cf230 100644 --- a/ext/ldap/tests/ldap_exop.phpt +++ b/ext/ldap/tests/ldap_exop.phpt @@ -36,10 +36,10 @@ function extract_genpw($retdata) $userAPassword = "oops"; -// ldap_exop(resource link, string reqoid [, string reqdata [, array servercontrols [, array clientcontrols [, string &retdata [, string &retoid]]]]]) +// ldap_exop(resource link, string reqoid [, string reqdata [, array servercontrols [, string &retdata [, string &retoid]]]]) // bool ldap_parse_exop(resource link, resource result [, string &retdata [, string &retoid]]) var_dump( - ldap_exop($link, LDAP_EXOP_WHO_AM_I, NULL, NULL, NULL, $retdata, $retoid), + ldap_exop($link, LDAP_EXOP_WHO_AM_I, NULL, NULL, $retdata, $retoid), $retdata, $retoid, $r = ldap_exop($link, LDAP_EXOP_WHO_AM_I),