Marcus Boerger <[EMAIL PROTECTED]> writes: Hello again Marcus,
forget about the previous email, I forgot to remove a debugging echo statement and the test will always fail. I'm attaching the right test script in this mail. Saludos. Iñaki. -- School of Management Mondragon University 20560 Oñati - Spain +34 943 718009 (ext. 225) GPG Key available at public keyservers --TEST-- ldap paged results control extension (RFC2606) --SKIPIF-- <?php if (!extension_loaded('ldap')) die("skip no ldap extension"); ?> --FILE-- <?php define ('PAGED_CONTROL_OID', '1.2.840.113556.1.4.319'); define ('PAGE_SIZE', 5); $ldap_host = 'ldap://172.31.3.4'; $ldap_user = 'cn=admin,dc=eteo,dc=edu'; $ldap_pwd = 'ldap-user'; $query = 'dc=eteo,dc=edu'; $query_filter = 'objectClass=*'; $query_attribs = array('cn'); $cookie = ''; $l = ldap_connect($ldap_host); if (!$l) { echo "Not OK: ldap_connect \n"; exit; } if (!ldap_set_option($l, LDAP_OPT_PROTOCOL_VERSION, 3)) { echo "Not OK: ldap_set_option (v3)\n"; exit; } if (!ldap_bind($l, $ldap_user, $ldap_pwd)) { echo "Not OK: ldap_bind\n"; exit; } $continue = true; while ($continue) { $paged_control = array( array( 'oid' => PAGED_CONTROL_OID, 'iscritical' => true, 'value' => ldap_ber_printf ('{iO}', PAGE_SIZE, $cookie) ) ); if (!ldap_set_option($l, LDAP_OPT_SERVER_CONTROLS, $paged_control)) { echo "Not OK: ldap_set_option (controls)\n"; exit; } $sr = ldap_search($l, $query, $query_filter, $query_attribs, 0, 0, 0, LDAP_DEREF_NEVER); if ($sr === FALSE) { echo "Not OK: ldap_search\n"; exit; } if (!ldap_parse_result ($l, $sr, &$errcode, &$matcheddn, &$errmsg, &$referrals, &$serverctrls)) { echo "Not OK: ldap_parse_result\n"; exit; } $paged_control_found = FALSE; if (isset($serverctrls)) { foreach ($serverctrls as $i) { if ($i['oid'] == PAGED_CONTROL_OID) { ldap_ber_scanf($i['value'], '{iO}', &$pagesize, &$cookie); $paged_control_found = TRUE; break; } } } if (!$paged_control_found) { echo "Not OK: paged control not found in response \n"; exit; } if (FALSE === ($num_entries = ldap_count_entries ($l, $sr))) { echo "Not OK: ldap_count_entries\n"; exit; } if ($num_entries > PAGE_SIZE) { echo 'Not OK: received more than '. PAGE_SIZE . " entries\n"; exit; } if (($num_entries != PAGE_SIZE) && ($cookie != '')) { echo 'Not OK: received less than '. PAGE_SIZE . " entries\n"; exit; } if ($cookie == '') { $continue = false; } } echo "OK\n"; ?> --EXPECT OK
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php