mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Implement ldap_exop_sync
This commit is contained in:
parent
72aada3c7c
commit
b3bd55f244
4 changed files with 47 additions and 6 deletions
|
@ -3883,9 +3883,7 @@ PHP_FUNCTION(ldap_8859_to_t61)
|
|||
|
||||
/* {{{ Extended operations, Pierangelo Masarati */
|
||||
#ifdef HAVE_LDAP_EXTENDED_OPERATION_S
|
||||
/* {{{ Extended operation */
|
||||
PHP_FUNCTION(ldap_exop)
|
||||
{
|
||||
static void php_ldap_exop(INTERNAL_FUNCTION_PARAMETERS, bool force_sync) {
|
||||
zval *serverctrls = NULL;
|
||||
zval *link, *retdata = NULL, *retoid = NULL;
|
||||
char *lretoid = NULL;
|
||||
|
@ -3919,7 +3917,7 @@ PHP_FUNCTION(ldap_exop)
|
|||
}
|
||||
}
|
||||
|
||||
if (retdata) {
|
||||
if (force_sync || retdata) {
|
||||
/* synchronous call */
|
||||
rc = ldap_extended_operation_s(ld->link, ZSTR_VAL(reqoid),
|
||||
lreqdata.bv_len > 0 ? &lreqdata: NULL,
|
||||
|
@ -3978,12 +3976,23 @@ PHP_FUNCTION(ldap_exop)
|
|||
result = Z_LDAP_RESULT_P(return_value);
|
||||
result->result = ldap_res;
|
||||
|
||||
cleanup:
|
||||
cleanup:
|
||||
if (lserverctrls) {
|
||||
_php_ldap_controls_free(&lserverctrls);
|
||||
}
|
||||
}
|
||||
|
||||
/* {{{ Extended operation */
|
||||
PHP_FUNCTION(ldap_exop)
|
||||
{
|
||||
php_ldap_exop(INTERNAL_FUNCTION_PARAM_PASSTHRU, false);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
PHP_FUNCTION(ldap_exop_sync)
|
||||
{
|
||||
php_ldap_exop(INTERNAL_FUNCTION_PARAM_PASSTHRU, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LDAP_PASSWD
|
||||
|
|
|
@ -777,6 +777,11 @@ namespace {
|
|||
* @param string $response_oid
|
||||
*/
|
||||
function ldap_exop(LDAP\Connection $ldap, string $request_oid, ?string $request_data = null, ?array $controls = NULL, &$response_data = UNKNOWN, &$response_oid = null): LDAP\Result|bool {}
|
||||
/**
|
||||
* @param string $response_data
|
||||
* @param string $response_oid
|
||||
*/
|
||||
function ldap_exop_sync(LDAP\Connection $ldap, string $request_oid, ?string $request_data = null, ?array $controls = NULL, &$response_data = null, &$response_oid = null): LDAP\Result|bool {}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LDAP_PASSWD
|
||||
|
|
19
ext/ldap/ldap_arginfo.h
generated
19
ext/ldap/ldap_arginfo.h
generated
|
@ -1,5 +1,5 @@
|
|||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: 63ed5b30556367b8ce48a421a85b92ecf41413b7 */
|
||||
* Stub hash: fec87d81c21ac5d56e62a5e0b4bbe673ea76edd5 */
|
||||
|
||||
#if defined(HAVE_ORALDAP)
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_ldap_connect, 0, 0, LDAP\\Connection, MAY_BE_FALSE)
|
||||
|
@ -316,6 +316,17 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_ldap_exop, 0, 2, LDAP\\Resul
|
|||
ZEND_END_ARG_INFO()
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_LDAP_EXTENDED_OPERATION_S)
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_ldap_exop_sync, 0, 2, LDAP\\Result, MAY_BE_BOOL)
|
||||
ZEND_ARG_OBJ_INFO(0, ldap, LDAP\\Connection, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, request_oid, IS_STRING, 0)
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, request_data, IS_STRING, 1, "null")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, controls, IS_ARRAY, 1, "NULL")
|
||||
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, response_data, "null")
|
||||
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, response_oid, "null")
|
||||
ZEND_END_ARG_INFO()
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_LDAP_PASSWD)
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ldap_exop_passwd, 0, 1, MAY_BE_STRING|MAY_BE_BOOL)
|
||||
ZEND_ARG_OBJ_INFO(0, ldap, LDAP\\Connection, 0)
|
||||
|
@ -438,6 +449,9 @@ ZEND_FUNCTION(ldap_8859_to_t61);
|
|||
#if defined(HAVE_LDAP_EXTENDED_OPERATION_S)
|
||||
ZEND_FUNCTION(ldap_exop);
|
||||
#endif
|
||||
#if defined(HAVE_LDAP_EXTENDED_OPERATION_S)
|
||||
ZEND_FUNCTION(ldap_exop_sync);
|
||||
#endif
|
||||
#if defined(HAVE_LDAP_PASSWD)
|
||||
ZEND_FUNCTION(ldap_exop_passwd);
|
||||
#endif
|
||||
|
@ -544,6 +558,9 @@ static const zend_function_entry ext_functions[] = {
|
|||
#if defined(HAVE_LDAP_EXTENDED_OPERATION_S)
|
||||
ZEND_FE(ldap_exop, arginfo_ldap_exop)
|
||||
#endif
|
||||
#if defined(HAVE_LDAP_EXTENDED_OPERATION_S)
|
||||
ZEND_FE(ldap_exop_sync, arginfo_ldap_exop_sync)
|
||||
#endif
|
||||
#if defined(HAVE_LDAP_PASSWD)
|
||||
ZEND_FE(ldap_exop_passwd, arginfo_ldap_exop_passwd)
|
||||
#endif
|
||||
|
|
|
@ -41,8 +41,13 @@ var_dump(
|
|||
ldap_exop($link, LDAP_EXOP_WHO_AM_I, NULL, NULL, $retdata, $retoid),
|
||||
$retdata,
|
||||
$retoid,
|
||||
ldap_exop_sync($link, LDAP_EXOP_WHO_AM_I, NULL, NULL, $retdata, $retoid),
|
||||
$retdata,
|
||||
$retoid,
|
||||
ldap_exop($link, LDAP_EXOP_WHO_AM_I, NULL, [['oid' => LDAP_CONTROL_PROXY_AUTHZ, 'value' => "dn:cn=userA,$base"]], $retdata),
|
||||
$retdata,
|
||||
ldap_exop_sync($link, LDAP_EXOP_WHO_AM_I, NULL, [['oid' => LDAP_CONTROL_PROXY_AUTHZ, 'value' => "dn:cn=userA,$base"]], $retdata),
|
||||
$retdata,
|
||||
$r = ldap_exop($link, LDAP_EXOP_WHO_AM_I),
|
||||
ldap_parse_exop($link, $r, $retdata2),
|
||||
$retdata2,
|
||||
|
@ -67,6 +72,11 @@ bool(true)
|
|||
string(%d) "dn:%s"
|
||||
string(0) ""
|
||||
bool(true)
|
||||
string(%d) "dn:%s"
|
||||
string(0) ""
|
||||
bool(true)
|
||||
string(%d) "dn:cn=user%s"
|
||||
bool(true)
|
||||
string(%d) "dn:cn=user%s"
|
||||
object(LDAP\Result)#%d (0) {
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue