ldap_search_overrides.phpt 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. --TEST--
  2. ldap_search() test - test that overrides aren't permanent
  3. --CREDITS--
  4. Tyson Andre <tandre@ifwe.co>
  5. # Based on ldap_search_basic.phpt
  6. --SKIPIF--
  7. <?php
  8. require_once('skipif.inc');
  9. require_once('skipifbindfailure.inc');
  10. ?>
  11. --FILE--
  12. <?php
  13. include "connect.inc";
  14. $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
  15. ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_SEARCHING);
  16. ldap_set_option($link, LDAP_OPT_SIZELIMIT, 123);
  17. ldap_set_option($link, LDAP_OPT_TIMELIMIT, 33);
  18. ldap_set_option($link, LDAP_OPT_NETWORK_TIMEOUT, 44);
  19. insert_dummy_data($link, $base);
  20. var_dump(
  21. $result = ldap_search($link, "$base", "(objectClass=person)", array(), null, 111, 22, LDAP_DEREF_NEVER),
  22. ldap_get_entries($link, $result)
  23. );
  24. var_dump(
  25. ldap_get_option($link, LDAP_OPT_DEREF, $option),
  26. $option,
  27. ldap_get_option($link, LDAP_OPT_SIZELIMIT, $option),
  28. $option,
  29. ldap_get_option($link, LDAP_OPT_TIMELIMIT, $option),
  30. $option,
  31. ldap_get_option($link, LDAP_OPT_NETWORK_TIMEOUT, $option),
  32. $option
  33. );
  34. ?>
  35. ===DONE===
  36. --CLEAN--
  37. <?php
  38. include "connect.inc";
  39. $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
  40. remove_dummy_data($link, $base);
  41. ?>
  42. --EXPECTF--
  43. resource(%d) of type (ldap result)
  44. array(4) {
  45. ["count"]=>
  46. int(3)
  47. [0]=>
  48. array(14) {
  49. ["objectclass"]=>
  50. array(2) {
  51. ["count"]=>
  52. int(1)
  53. [0]=>
  54. string(6) "person"
  55. }
  56. [0]=>
  57. string(11) "objectclass"
  58. ["cn"]=>
  59. array(2) {
  60. ["count"]=>
  61. int(1)
  62. [0]=>
  63. string(5) "userA"
  64. }
  65. [1]=>
  66. string(2) "cn"
  67. ["sn"]=>
  68. array(2) {
  69. ["count"]=>
  70. int(1)
  71. [0]=>
  72. string(7) "testSN1"
  73. }
  74. [2]=>
  75. string(2) "sn"
  76. ["userpassword"]=>
  77. array(2) {
  78. ["count"]=>
  79. int(1)
  80. [0]=>
  81. string(4) "oops"
  82. }
  83. [3]=>
  84. string(12) "userpassword"
  85. ["telephonenumber"]=>
  86. array(2) {
  87. ["count"]=>
  88. int(1)
  89. [0]=>
  90. string(14) "xx-xx-xx-xx-xx"
  91. }
  92. [4]=>
  93. string(15) "telephonenumber"
  94. ["description"]=>
  95. array(2) {
  96. ["count"]=>
  97. int(1)
  98. [0]=>
  99. string(6) "user A"
  100. }
  101. [5]=>
  102. string(11) "description"
  103. ["count"]=>
  104. int(6)
  105. ["dn"]=>
  106. string(%d) "cn=userA,%s"
  107. }
  108. [1]=>
  109. array(12) {
  110. ["objectclass"]=>
  111. array(2) {
  112. ["count"]=>
  113. int(1)
  114. [0]=>
  115. string(6) "person"
  116. }
  117. [0]=>
  118. string(11) "objectclass"
  119. ["cn"]=>
  120. array(2) {
  121. ["count"]=>
  122. int(1)
  123. [0]=>
  124. string(5) "userB"
  125. }
  126. [1]=>
  127. string(2) "cn"
  128. ["sn"]=>
  129. array(2) {
  130. ["count"]=>
  131. int(1)
  132. [0]=>
  133. string(7) "testSN2"
  134. }
  135. [2]=>
  136. string(2) "sn"
  137. ["userpassword"]=>
  138. array(2) {
  139. ["count"]=>
  140. int(1)
  141. [0]=>
  142. string(15) "oopsIDitItAgain"
  143. }
  144. [3]=>
  145. string(12) "userpassword"
  146. ["description"]=>
  147. array(2) {
  148. ["count"]=>
  149. int(1)
  150. [0]=>
  151. string(6) "user B"
  152. }
  153. [4]=>
  154. string(11) "description"
  155. ["count"]=>
  156. int(5)
  157. ["dn"]=>
  158. string(%d) "cn=userB,%s"
  159. }
  160. [2]=>
  161. array(10) {
  162. ["objectclass"]=>
  163. array(2) {
  164. ["count"]=>
  165. int(1)
  166. [0]=>
  167. string(6) "person"
  168. }
  169. [0]=>
  170. string(11) "objectclass"
  171. ["cn"]=>
  172. array(2) {
  173. ["count"]=>
  174. int(1)
  175. [0]=>
  176. string(5) "userC"
  177. }
  178. [1]=>
  179. string(2) "cn"
  180. ["sn"]=>
  181. array(2) {
  182. ["count"]=>
  183. int(1)
  184. [0]=>
  185. string(7) "testSN3"
  186. }
  187. [2]=>
  188. string(2) "sn"
  189. ["userpassword"]=>
  190. array(2) {
  191. ["count"]=>
  192. int(1)
  193. [0]=>
  194. string(17) "0r1g1na1 passw0rd"
  195. }
  196. [3]=>
  197. string(12) "userpassword"
  198. ["count"]=>
  199. int(4)
  200. ["dn"]=>
  201. string(%d) "cn=userC,cn=userB,%s"
  202. }
  203. }
  204. bool(true)
  205. int(1)
  206. bool(true)
  207. int(123)
  208. bool(true)
  209. int(33)
  210. bool(true)
  211. int(44)
  212. ===DONE===