You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.3 KiB

  1. --TEST--
  2. ldap_first_reference() - Basic ldap_first_reference test
  3. --CREDITS--
  4. Patrick Allaert <patrickallaert@php.net>
  5. # Belgian PHP Testfest 2009
  6. --SKIPIF--
  7. <?php require_once('skipif.inc'); ?>
  8. <?php require_once('skipifbindfailure.inc'); ?>
  9. --FILE--
  10. <?php
  11. require "connect.inc";
  12. $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
  13. insert_dummy_data($link);
  14. ldap_add($link, "cn=userref,dc=my-domain,dc=com", array(
  15. "objectClass" => array("extensibleObject", "referral"),
  16. "cn" => "userref",
  17. "ref" => "cn=userA,dc=my-domain,dc=com",
  18. ));
  19. ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_NEVER);
  20. $result = ldap_search($link, "dc=my-domain,dc=com", "(cn=*)");
  21. var_dump($ref = ldap_first_reference($link, $result));
  22. $refs = null;
  23. ldap_parse_reference($link, $ref, $refs);
  24. var_dump($refs);
  25. ?>
  26. ===DONE===
  27. --CLEAN--
  28. <?php
  29. include "connect.inc";
  30. $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
  31. // Referral can only be removed with Manage DSA IT Control
  32. ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, array(array("oid" => "2.16.840.1.113730.3.4.2")));
  33. ldap_delete($link, "cn=userref,dc=my-domain,dc=com");
  34. remove_dummy_data($link);
  35. ?>
  36. --EXPECTF--
  37. resource(%d) of type (ldap result entry)
  38. array(1) {
  39. [0]=>
  40. string(28) "cn=userA,dc=my-domain,dc=com"
  41. }
  42. ===DONE===