ldap_exop_passwd.phpt 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. --TEST--
  2. ldap_exop_passwd() - Changing password through EXOP
  3. --CREDITS--
  4. Côme Chilliet <mcmic@php.net>
  5. --SKIPIF--
  6. <?php require_once('skipif.inc'); ?>
  7. <?php require_once('skipifbindfailure.inc'); ?>
  8. --FILE--
  9. <?php
  10. require "connect.inc";
  11. $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
  12. insert_dummy_data($link, $base);
  13. // ldap_exop_passwd() allows to pass the DN, OLD and NEW passwords,
  14. // and optionally returns the NEW password if none was passed.
  15. // ldap_exop_passwd(resource link [, string user [, string oldpw [, string newpw [, string newpasswd ]]]])
  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. ===DONE===
  26. --CLEAN--
  27. <?php
  28. require "connect.inc";
  29. $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
  30. remove_dummy_data($link, $base);
  31. ?>
  32. --EXPECTF--
  33. string(%d) "%s"
  34. array(0) {
  35. }
  36. string(%d) "%s"
  37. bool(true)
  38. bool(true)
  39. bool(true)
  40. ===DONE===