forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathldap_parse_reference_basic.phpt
44 lines (43 loc) · 1.17 KB
/
ldap_parse_reference_basic.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
--TEST--
ldap_parse_reference() - Basic ldap_parse_reference test
--CREDITS--
Patrick Allaert <[email protected]>
# Belgian PHP Testfest 2009
--EXTENSIONS--
ldap
--SKIPIF--
<?php require_once('skipifbindfailure.inc'); ?>
--FILE--
<?php
require "connect.inc";
$link = ldap_connect_and_bind($uri, $user, $passwd, $protocol_version);
insert_dummy_data($link, $base);
ldap_add($link, "cn=userref,$base", array(
"objectClass" => array("extensibleObject", "referral"),
"cn" => "userref",
"ref" => "cn=userA,$base",
));
ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_NEVER);
$result = ldap_search($link, "$base", "(cn=*)");
$ref = ldap_first_reference($link, $result);
$refs = null;
var_dump(
ldap_parse_reference($link, $ref, $refs),
$refs
);
?>
--CLEAN--
<?php
include "connect.inc";
$link = ldap_connect_and_bind($uri, $user, $passwd, $protocol_version);
// Referral can only be removed with Manage DSA IT Control
ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, array(array("oid" => "2.16.840.1.113730.3.4.2")));
ldap_delete($link, "cn=userref,$base");
remove_dummy_data($link, $base);
?>
--EXPECTF--
bool(true)
array(1) {
[0]=>
string(%d) "cn=userA,%s"
}