ldap_exop_passwd.phpt 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --TEST--
  2. ldap_exop_passwd() - Changing password through EXOP
  3. --CREDITS--
  4. Côme Chilliet <mcmic@php.net>
  5. --EXTENSIONS--
  6. ldap
  7. --SKIPIF--
  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, $base);
  14. // ldap_exop_passwd() allows to pass the DN, OLD and NEW passwords,
  15. // and optionally returns the NEW password if none was passed.
  16. var_dump(
  17. $genpw = ldap_exop_passwd($link, "cn=userA,$base", "oops", "", $ctrls),
  18. $ctrls,
  19. $genpw = ldap_exop_passwd($link, "cn=userA,$base"),
  20. test_bind($host, $port, "cn=userA,$base", $genpw, $protocol_version),
  21. ldap_exop_passwd($link, "cn=userA,$base", $genpw, "newPassword"),
  22. test_bind($host, $port, "cn=userA,$base", "newPassword", $protocol_version)
  23. );
  24. ?>
  25. --CLEAN--
  26. <?php
  27. require "connect.inc";
  28. $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
  29. remove_dummy_data($link, $base);
  30. ?>
  31. --EXPECTF--
  32. string(%d) "%s"
  33. array(0) {
  34. }
  35. string(%d) "%s"
  36. bool(true)
  37. bool(true)
  38. bool(true)