Indexing controls by OID when parsing them

This commit is contained in:
Côme Chilliet 2017-09-12 12:58:46 +02:00
parent 9c7666d93a
commit 679442b1d1
9 changed files with 47 additions and 53 deletions

View File

@ -428,7 +428,7 @@ static void _php_ldap_controls_to_array(LDAP *ld, LDAPControl** ctrls, zval* arr
ctrlp = ctrls;
while (*ctrlp != NULL) {
_php_ldap_control_to_array(ld, *ctrlp, &tmp1, request);
add_next_index_zval(array, &tmp1);
add_assoc_zval(array, (*ctrlp)->ldctl_oid, &tmp1);
ctrlp++;
}
ldap_controls_free(ctrls);

View File

@ -21,7 +21,7 @@ var_dump(
ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls),
$errcode,
$errmsg,
$ctrls,
$ctrls[LDAP_CONTROL_POST_READ],
ldap_get_entries(
$link,
ldap_search($link, "$base", "(o=test_ldap_add_ext)")
@ -42,20 +42,17 @@ resource(%d) of type (ldap result)
bool(true)
int(0)
string(0) ""
array(1) {
[0]=>
array(2) {
["oid"]=>
string(14) "1.3.6.1.1.13.2"
["value"]=>
array(2) {
["oid"]=>
string(14) "1.3.6.1.1.13.2"
["value"]=>
array(2) {
["dn"]=>
string(%d) "o=test_ldap_add_ext,%s"
["o"]=>
array(1) {
[0]=>
string(17) "test_ldap_add_ext"
}
["dn"]=>
string(%d) "o=test_ldap_add_ext,%s"
["o"]=>
array(1) {
[0]=>
string(17) "test_ldap_add_ext"
}
}
}

View File

@ -26,7 +26,7 @@ var_dump(
ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls),
$errcode,
$errmsg,
$ctrls,
$ctrls[LDAP_CONTROL_PRE_READ],
@ldap_search($link, "dc=my-domain,$base", "(o=my-domain)")
);
?>
@ -44,25 +44,22 @@ resource(%d) of type (ldap result)
bool(true)
int(0)
string(0) ""
array(1) {
[0]=>
array(2) {
["oid"]=>
string(14) "1.3.6.1.1.13.1"
["value"]=>
array(3) {
["dn"]=>
string(%d) "dc=my-domain,%s"
["dc"]=>
array(1) {
[0]=>
string(9) "my-domain"
}
["o"]=>
array(1) {
[0]=>
string(9) "my-domain"
}
array(2) {
["oid"]=>
string(14) "1.3.6.1.1.13.1"
["value"]=>
array(3) {
["dn"]=>
string(%d) "dc=my-domain,%s"
["dc"]=>
array(1) {
[0]=>
string(9) "my-domain"
}
["o"]=>
array(1) {
[0]=>
string(9) "my-domain"
}
}
}

View File

@ -72,7 +72,7 @@ bool(false)
bool(true)
bool(true)
array(1) {
[0]=>
["1.2.840.113556.1.4.319"]=>
array(3) {
["oid"]=>
string(22) "1.2.840.113556.1.4.319"
@ -90,7 +90,7 @@ array(1) {
bool(true)
bool(true)
array(1) {
[0]=>
["1.2.840.113556.1.4.319"]=>
array(3) {
["oid"]=>
string(22) "1.2.840.113556.1.4.319"

View File

@ -66,7 +66,7 @@ bool(true)
int(0)
bool(true)
array(2) {
[0]=>
["1.2.752.58.10.1"]=>
array(3) {
["oid"]=>
string(15) "1.2.752.58.10.1"
@ -75,7 +75,7 @@ array(2) {
["value"]=>
NULL
}
[1]=>
["1.2.752.58.1.10"]=>
array(3) {
["oid"]=>
string(15) "1.2.752.58.1.10"
@ -87,7 +87,7 @@ array(2) {
}
bool(true)
array(2) {
[0]=>
["1.2.752.58.10.1"]=>
array(3) {
["oid"]=>
string(15) "1.2.752.58.10.1"
@ -96,7 +96,7 @@ array(2) {
["value"]=>
NULL
}
[1]=>
["1.2.752.58.1.10"]=>
array(3) {
["oid"]=>
string(15) "1.2.752.58.1.10"

View File

@ -63,7 +63,7 @@ bool(true)
int(0)
string(0) ""
array(2) {
[0]=>
["1.3.6.1.1.13.1"]=>
array(2) {
["oid"]=>
string(14) "1.3.6.1.1.13.1"
@ -73,7 +73,7 @@ array(2) {
string(%d) "o=test,%s"
}
}
[1]=>
["1.3.6.1.1.13.2"]=>
array(2) {
["oid"]=>
string(14) "1.3.6.1.1.13.2"
@ -134,7 +134,7 @@ bool(true)
int(0)
string(0) ""
array(2) {
[0]=>
["1.3.6.1.1.13.1"]=>
array(2) {
["oid"]=>
string(14) "1.3.6.1.1.13.1"
@ -149,7 +149,7 @@ array(2) {
}
}
}
[1]=>
["1.3.6.1.1.13.2"]=>
array(2) {
["oid"]=>
string(14) "1.3.6.1.1.13.2"

View File

@ -18,9 +18,9 @@ var_dump(
ldap_control_paged_result($link, 1),
$result = ldap_search($link, $dn, $filter, array('cn')),
ldap_parse_result($link, $result, $errcode, $dn, $errmsg, $refs, $ctrls),
$ctrls[0]['oid'],
$ctrls[0]['value']['size'],
bin2hex($ctrls[0]['value']['cookie']),
$ctrls[LDAP_CONTROL_PAGEDRESULTS]['oid'],
$ctrls[LDAP_CONTROL_PAGEDRESULTS]['value']['size'],
bin2hex($ctrls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie']),
ldap_get_entries($link, $result)['count']
);
?>

View File

@ -22,7 +22,7 @@ var_dump(
ldap_get_entries($link, $result),
ldap_parse_result($link, $result, $errcode , $matcheddn , $errmsg , $referrals, $controls),
$result = ldap_search($link, $dn, $filter, array('cn'), 0, 0, 0, LDAP_DEREF_NEVER,
[['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size' => 20, 'cookie' => $controls[0]['value']['cookie']]]]),
[['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size' => 20, 'cookie' => $controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie']]]]),
ldap_get_entries($link, $result)
);
?>

View File

@ -77,7 +77,7 @@ bool(true)
bool(false)
bool(true)
array(2) {
[0]=>
["1.2.752.58.10.1"]=>
array(3) {
["oid"]=>
string(15) "1.2.752.58.10.1"
@ -86,7 +86,7 @@ array(2) {
["value"]=>
NULL
}
[1]=>
["1.2.752.58.1.10"]=>
array(3) {
["oid"]=>
string(15) "1.2.752.58.1.10"
@ -98,7 +98,7 @@ array(2) {
}
bool(true)
array(2) {
[0]=>
["1.2.752.58.10.1"]=>
array(3) {
["oid"]=>
string(15) "1.2.752.58.10.1"
@ -107,7 +107,7 @@ array(2) {
["value"]=>
NULL
}
[1]=>
["1.2.752.58.1.10"]=>
array(3) {
["oid"]=>
string(15) "1.2.752.58.1.10"