Now you can set the base in the env var LDAP_TEST_BASE.
The base has to exists. (before tests were attempting to create/delete
the base itself)
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
+insert_dummy_data($link, $base);
-$dn = "dc=my-domain,dc=com";
+$dn = "$base";
$filter = "(objectclass=person)";
var_dump(
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
--EXPECTF--
resource(%d) of type (ldap result)
["count"]=>
int(1)
["dn"]=>
- string(28) "cn=userA,dc=my-domain,dc=com"
+ string(%d) "cn=userA,%s"
}
[1]=>
array(4) {
["count"]=>
int(1)
["dn"]=>
- string(28) "cn=userB,dc=my-domain,dc=com"
+ string(%d) "cn=userB,%s"
}
[2]=>
array(4) {
["count"]=>
int(1)
["dn"]=>
- string(37) "cn=userC,cn=userB,dc=my-domain,dc=com"
+ string(%d) "cn=userC,cn=userB,%s"
}
}
["count"]=>
int(1)
["dn"]=>
- string(28) "cn=userA,dc=my-domain,dc=com"
+ string(%d) "cn=userA,%s"
}
}
resource(%d) of type (ldap result)
["count"]=>
int(1)
["dn"]=>
- string(28) "cn=userA,dc=my-domain,dc=com"
+ string(%d) "cn=userA,%s"
}
[1]=>
array(4) {
["count"]=>
int(1)
["dn"]=>
- string(28) "cn=userB,dc=my-domain,dc=com"
+ string(%d) "cn=userB,%s"
}
[2]=>
array(4) {
["count"]=>
int(1)
["dn"]=>
- string(37) "cn=userC,cn=userB,dc=my-domain,dc=com"
+ string(%d) "cn=userC,cn=userB,%s"
}
}
===DONE===
<?php
/*
-Default values are "localhost", "root", database "test" and empty password.
+Default values are "localhost", "cn=Manager,dc=my-domain,dc=com", and password "secret".
Change the LDAP_TEST_* environment values if you want to use another configuration.
*/
$host = getenv("LDAP_TEST_HOST") ? getenv("LDAP_TEST_HOST") : "localhost";
$port = getenv("LDAP_TEST_PORT") ? getenv("LDAP_TEST_PORT") : 389;
-$user = getenv("LDAP_TEST_USER") ? getenv("LDAP_TEST_USER") : "cn=Manager,dc=my-domain,dc=com";
+$base = getenv("LDAP_TEST_BASE") ? getenv("LDAP_TEST_BASE") : "dc=my-domain,dc=com";
+$user = getenv("LDAP_TEST_USER") ? getenv("LDAP_TEST_USER") : "cn=Manager,$base";
$sasl_user = getenv("LDAP_TEST_SASL_USER") ? getenv("LDAP_TEST_SASL_USER") : "Manager";
$passwd = getenv("LDAP_TEST_PASSWD") ? getenv("LDAP_TEST_PASSWD") : "secret";
$protocol_version = getenv("LDAP_TEST_OPT_PROTOCOL_VERSION") ? getenv("LDAP_TEST_OPT_PROTOCOL_VERSION") : 3;
return $link;
}
-function insert_dummy_data($link) {
- ldap_add($link, "dc=my-domain,dc=com", array(
+function insert_dummy_data($link, $base) {
+ ldap_add($link, "o=test,$base", array(
"objectClass" => array(
- "top",
- "dcObject",
- "organization"),
- "dc" => "my-domain",
- "o" => "my-domain",
+ "top",
+ "organization"),
+ "o" => "test",
));
- ldap_add($link, "cn=userA,dc=my-domain,dc=com", array(
+ ldap_add($link, "cn=userA,$base", array(
"objectclass" => "person",
"cn" => "userA",
"sn" => "testSN1",
"telephoneNumber" => "xx-xx-xx-xx-xx",
"description" => "user A",
));
- ldap_add($link, "cn=userB,dc=my-domain,dc=com", array(
+ ldap_add($link, "cn=userB,$base", array(
"objectclass" => "person",
"cn" => "userB",
"sn" => "testSN2",
"userPassword" => "oopsIDitItAgain",
"description" => "user B",
));
- ldap_add($link, "cn=userC,cn=userB,dc=my-domain,dc=com", array(
+ ldap_add($link, "cn=userC,cn=userB,$base", array(
"objectclass" => "person",
"cn" => "userC",
"sn" => "testSN3",
));
}
-function remove_dummy_data($link) {
- ldap_delete($link, "cn=userC,cn=userB,dc=my-domain,dc=com");
- ldap_delete($link, "cn=userA,dc=my-domain,dc=com");
- ldap_delete($link, "cn=userB,dc=my-domain,dc=com");
- ldap_delete($link, "dc=my-domain,dc=com");
+function remove_dummy_data($link, $base) {
+ ldap_delete($link, "cn=userC,cn=userB,$base");
+ ldap_delete($link, "cn=userA,$base");
+ ldap_delete($link, "cn=userB,$base");
+ ldap_delete($link, "o=test,$base");
}
?>
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
var_dump(
- ldap_add($link, "dc=my-domain,dc=com", array(
+ ldap_add($link, "dc=my-domain,$base", array(
"objectClass" => array(
"top",
"dcObject",
)),
ldap_get_entries(
$link,
- ldap_search($link, "dc=my-domain,dc=com", "(o=my-domain)")
+ ldap_search($link, "$base", "(o=my-domain)")
)
);
?>
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-ldap_delete($link, "dc=my-domain,dc=com");
+ldap_delete($link, "dc=my-domain,$base");
?>
---EXPECT--
+--EXPECTF--
bool(true)
array(2) {
["count"]=>
["count"]=>
int(3)
["dn"]=>
- string(19) "dc=my-domain,dc=com"
+ string(%d) "dc=my-domain,%s"
}
}
===DONE===
// Too few parameters
var_dump(ldap_add());
var_dump(ldap_add($link));
-var_dump(ldap_add($link, "dc=my-domain,dc=com"));
+var_dump(ldap_add($link, "$base"));
// Too many parameters
-var_dump(ldap_add($link, "dc=my-domain,dc=com", array(), "Additional data"));
+var_dump(ldap_add($link, "$base", array(), "Additional data"));
-var_dump(ldap_add($link, "dc=my-domain,dc=com", array()));
+var_dump(ldap_add($link, "$base", array()));
// Invalid DN
var_dump(
// Duplicate entry
for ($i = 0; $i < 2; $i++)
var_dump(
- ldap_add($link, "dc=my-domain,dc=com", array(
- "objectClass" => array(
- "top",
- "dcObject",
- "organization"),
- "dc" => "my-domain",
- "o" => "my-domain",
- ))
+ ldap_add($link, "dc=my-domain,$base", array(
+ "objectClass" => array(
+ "top",
+ "dcObject",
+ "organization"),
+ "dc" => "my-domain",
+ "o" => "my-domain",
+ ))
);
var_dump(ldap_error($link), ldap_errno($link));
// Invalid attribute
var_dump(
- ldap_add($link, "dc=my-domain,dc=com", array(
+ ldap_add($link, "$base", array(
"objectClass" => array(
"top",
"dcObject",
);
var_dump(
- ldap_add($link, "dc=my-domain,dc=com", array(array( "Oops"
+ ldap_add($link, "$base", array(array( "Oops"
)))
/* Is this correct behaviour to still have "Undefined attribute type" as error/errno?
,
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-ldap_delete($link, "dc=my-domain,dc=com");
+ldap_delete($link, "dc=my-domain,$base");
?>
--EXPECTF--
Warning: ldap_add() expects exactly 3 parameters, 0 given in %s on line %d
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
+insert_dummy_data($link, $base);
var_dump(
- ldap_compare($link, "cn=userA,dc=my-domain,dc=com", "sn", "testSN1"),
- ldap_compare($link, "cn=userA,dc=my-domain,dc=com", "telephoneNumber", "yy-yy-yy-yy-yy")
+ ldap_compare($link, "cn=userA,$base", "sn", "testSN1"),
+ ldap_compare($link, "cn=userA,$base", "telephoneNumber", "yy-yy-yy-yy-yy")
);
?>
===DONE===
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
--EXPECT--
bool(true)
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
+insert_dummy_data($link, $base);
// Too few parameters
var_dump(ldap_compare($link));
var_dump(ldap_compare($link, $link, $link, $link, "Additional data"));
var_dump(
- ldap_compare($link, "cn=userNotAvailable,dc=my-domain,dc=com", "sn", "testSN1"),
+ ldap_compare($link, "cn=userNotAvailable,$base", "sn", "testSN1"),
ldap_error($link),
ldap_errno($link)
);
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
--EXPECTF--
Warning: ldap_compare() expects exactly 4 parameters, 1 given in %s on line %d
// too many arguments
var_dump(ldap_connect(null, null, null));
-var_dump(ldap_connect("ldap://$host:$port/dc=my-domain,dc=com"));
+var_dump(ldap_connect("ldap://$host:$port/$base"));
$links = array();
$links[0] = ldap_connect($host, $port);
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
+insert_dummy_data($link, $base);
-$dn = "dc=my-domain,dc=com";
-$filter = "(cn=*)";
+$dn = "$base";
+$filter = "(cn=user*)";
var_dump(
ldap_control_paged_result($link, 1),
$result = ldap_search($link, $dn, $filter, array('cn')),
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
--EXPECTF--
bool(true)
["count"]=>
int(1)
["dn"]=>
- string(28) "cn=userA,dc=my-domain,dc=com"
+ string(%d) "cn=userA,%s"
}
}
===DONE===
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
+insert_dummy_data($link, $base);
-$dn = "dc=my-domain,dc=com";
-$filter = "(cn=*)";
+$dn = "$base";
+$filter = "(cn=user*)";
var_dump(
ldap_control_paged_result($link, 2),
$result = ldap_search($link, $dn, $filter, array('cn')),
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
--EXPECTF--
bool(true)
["count"]=>
int(1)
["dn"]=>
- string(28) "cn=userA,dc=my-domain,dc=com"
+ string(%d) "cn=userA,%s"
}
[1]=>
array(4) {
["count"]=>
int(1)
["dn"]=>
- string(28) "cn=userB,dc=my-domain,dc=com"
+ string(%d) "cn=userB,%s"
}
}
===DONE===
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
+insert_dummy_data($link, $base);
-$dn = "dc=my-domain,dc=com";
-$filter = "(cn=*)";
+$dn = "$base";
+$filter = "(cn=user*)";
$cookie = '';
var_dump(
ldap_control_paged_result($link, 2, true, $cookie),
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
--EXPECTF--
bool(true)
["count"]=>
int(1)
["dn"]=>
- string(28) "cn=userA,dc=my-domain,dc=com"
+ string(%d) "cn=userA,%s"
}
[1]=>
array(4) {
["count"]=>
int(1)
["dn"]=>
- string(28) "cn=userB,dc=my-domain,dc=com"
+ string(%d) "cn=userB,%s"
}
}
bool(true)
["count"]=>
int(1)
["dn"]=>
- string(37) "cn=userC,cn=userB,dc=my-domain,dc=com"
+ string(%d) "cn=userC,cn=userB,%s"
}
}
===DONE===
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
-$result = ldap_search($link, "dc=my-domain,dc=com", "(objectclass=person)");
+insert_dummy_data($link, $base);
+$result = ldap_search($link, "$base", "(objectclass=person)");
var_dump(ldap_count_entries($link, $result));
?>
===DONE===
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
--EXPECT--
int(3)
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-ldap_add($link, "dc=my-domain,dc=com", array(
+ldap_add($link, "dc=my-domain,$base", array(
"objectClass" => array(
"top",
"dcObject",
));
var_dump(
- ldap_delete($link, "dc=my-domain,dc=com"),
- @ldap_search($link, "dc=my-domain,dc=com", "(o=my-domain)")
+ ldap_delete($link, "dc=my-domain,$base"),
+ @ldap_search($link, "dc=my-domain,$base", "(o=my-domain)")
);
?>
===DONE===
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-ldap_delete($link, "dc=my-domain,dc=com");
+ldap_delete($link, "$base");
?>
--EXPECT--
bool(true)
var_dump(ldap_delete($link));
// Too many parameters
-var_dump(ldap_delete($link, "dc=my-domain,dc=com", "Additional data"));
+var_dump(ldap_delete($link, "$base", "Additional data"));
// Invalid DN
var_dump(
// Deleting unexisting data
var_dump(
- ldap_delete($link, "dc=my-domain,dc=com"),
+ ldap_delete($link, "dc=my-domain,$base"),
ldap_error($link),
ldap_errno($link)
);
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-@ldap_add($link, "badDN dc=my-domain,dc=com", array(
+@ldap_add($link, "badDN $base", array(
"objectClass" => array(
"top",
"dcObject",
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-@ldap_add($link, "badDN dc=my-domain,dc=com", array(
+@ldap_add($link, "badDN $base", array(
"objectClass" => array(
"top",
"dcObject",
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
-$result = ldap_search($link, "dc=my-domain,dc=com", "(objectclass=organization)");
+insert_dummy_data($link, $base);
+$result = ldap_search($link, "$base", "(objectclass=organization)", array("objectClass"));
$entry = ldap_first_entry($link, $result);
var_dump(
ldap_first_attribute($link, $entry)
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
--EXPECT--
string(11) "objectClass"
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
-$result = ldap_search($link, "dc=my-domain,dc=com", "(objectclass=person)");
+insert_dummy_data($link, $base);
+$result = ldap_search($link, "$base", "(objectclass=person)");
var_dump(
$entry = ldap_first_entry($link, $result),
ldap_get_values($link, $entry, 'sn')
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
--EXPECTF--
resource(%d) of type (ldap result entry)
<?php
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
-ldap_add($link, "cn=userref,dc=my-domain,dc=com", array(
+insert_dummy_data($link, $base);
+ldap_add($link, "cn=userref,$base", array(
"objectClass" => array("extensibleObject", "referral"),
"cn" => "userref",
- "ref" => "cn=userA,dc=my-domain,dc=com",
+ "ref" => "cn=userA,$base",
));
ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_NEVER);
-$result = ldap_search($link, "dc=my-domain,dc=com", "(cn=*)");
+$result = ldap_search($link, "$base", "(cn=*)");
var_dump($ref = ldap_first_reference($link, $result));
$refs = null;
ldap_parse_reference($link, $ref, $refs);
$link = ldap_connect_and_bind($host, $port, $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,dc=my-domain,dc=com");
-remove_dummy_data($link);
+ldap_delete($link, "cn=userref,$base");
+remove_dummy_data($link, $base);
?>
--EXPECTF--
resource(%d) of type (ldap result entry)
array(1) {
[0]=>
- string(28) "cn=userA,dc=my-domain,dc=com"
+ string(%d) "cn=userA,%s"
}
===DONE===
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
-$result = ldap_search($link, "dc=my-domain,dc=com", "(objectclass=person)");
+insert_dummy_data($link, $base);
+$result = ldap_search($link, "$base", "(objectclass=person)");
var_dump(ldap_free_result($result));
?>
===DONE===
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
--EXPECT--
bool(true)
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
-$result = ldap_search($link, "dc=my-domain,dc=com", "(objectclass=organization)");
+insert_dummy_data($link, $base);
+$result = ldap_search($link, "$base", "(o=test)");
$entry = ldap_first_entry($link, $result);
var_dump(
ldap_get_attributes($link, $entry)
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
---EXPECT--
-array(7) {
+--EXPECTF--
+array(5) {
["objectClass"]=>
- array(4) {
+ array(3) {
["count"]=>
- int(3)
+ int(2)
[0]=>
string(3) "top"
[1]=>
- string(8) "dcObject"
- [2]=>
string(12) "organization"
}
[0]=>
string(11) "objectClass"
- ["dc"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(9) "my-domain"
- }
- [1]=>
- string(2) "dc"
["o"]=>
array(2) {
["count"]=>
int(1)
[0]=>
- string(9) "my-domain"
+ string(4) "test"
}
- [2]=>
+ [1]=>
string(1) "o"
["count"]=>
- int(3)
+ int(2)
}
===DONE===
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
-$result = ldap_search($link, "dc=my-domain,dc=com", "(objectclass=organization)");
+insert_dummy_data($link, $base);
+$result = ldap_search($link, "$base", "(objectclass=organization)");
$entry = ldap_first_entry($link, $result);
var_dump(
ldap_get_dn($link, $entry)
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
---EXPECT--
-string(19) "dc=my-domain,dc=com"
+--EXPECTF--
+string(%d) "%s"
===DONE===
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
+insert_dummy_data($link, $base);
var_dump(
ldap_get_entries(
$link,
- ldap_search($link, "dc=my-domain,dc=com", "(o=my-domain)")
+ ldap_search($link, "$base", "(o=test)")
)
);
?>
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
---EXPECT--
+--EXPECTF--
array(2) {
["count"]=>
int(1)
[0]=>
- array(8) {
+ array(6) {
["objectclass"]=>
- array(4) {
+ array(3) {
["count"]=>
- int(3)
+ int(2)
[0]=>
string(3) "top"
[1]=>
- string(8) "dcObject"
- [2]=>
string(12) "organization"
}
[0]=>
string(11) "objectclass"
- ["dc"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(9) "my-domain"
- }
- [1]=>
- string(2) "dc"
["o"]=>
array(2) {
["count"]=>
int(1)
[0]=>
- string(9) "my-domain"
+ string(4) "test"
}
- [2]=>
+ [1]=>
string(1) "o"
["count"]=>
- int(3)
+ int(2)
["dn"]=>
- string(19) "dc=my-domain,dc=com"
+ string(23) "o=test,dc=mcmic,dc=test"
}
}
===DONE===
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
+insert_dummy_data($link, $base);
var_dump(
ldap_get_entries(
$link,
- ldap_search($link, "dc=my-domain,dc=com", "(o=my-unexisting-domain)")
+ ldap_search($link, "$base", "(o=my-unexisting-domain)")
)
);
?>
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
--EXPECT--
array(1) {
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
-$result = ldap_search($link, "dc=my-domain,dc=com", "(objectclass=organization)");
+insert_dummy_data($link, $base);
+$result = ldap_search($link, "$base", "(o=test)");
$entry = ldap_first_entry($link, $result);
var_dump(
ldap_get_values_len($link, $entry, "o")
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
--EXPECT--
array(2) {
[0]=>
- string(9) "my-domain"
+ string(4) "test"
["count"]=>
int(1)
}
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
-$result = ldap_search($link, "dc=my-domain,dc=com", "(objectclass=organization)");
+insert_dummy_data($link, $base);
+$result = ldap_search($link, "$base", "(objectclass=organization)");
$entry = ldap_first_entry($link, $result);
// Too few parameters
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
--EXPECTF--
Warning: ldap_get_values_len() expects exactly 3 parameters, 1 given in %s on line %d
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
+insert_dummy_data($link, $base);
var_dump(
- $result = ldap_list($link, "dc=my-domain,dc=com", "(objectClass=person)"),
+ $result = ldap_list($link, "$base", "(objectClass=person)"),
ldap_get_entries($link, $result)
);
?>
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
--EXPECTF--
resource(%d) of type (ldap result)
["count"]=>
int(6)
["dn"]=>
- string(28) "cn=userA,dc=my-domain,dc=com"
+ string(%d) "cn=userA,%s"
}
[1]=>
array(12) {
["count"]=>
int(5)
["dn"]=>
- string(28) "cn=userB,dc=my-domain,dc=com"
+ string(%d) "cn=userB,%s"
}
}
===DONE===
var_dump(ldap_list($link, $link));
// Too many parameters
-var_dump(ldap_list($link, "dc=my-domain,dc=com", "(objectClass=*)", array(), 0, 0, 0, 0 , "Additional data"));
+var_dump(ldap_list($link, "$base", "(objectClass=*)", array(), 0, 0, 0, 0 , "Additional data"));
?>
===DONE===
--EXPECTF--
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
+insert_dummy_data($link, $base);
$entry = array(
"description" => "Domain description",
);
var_dump(
- ldap_mod_add($link, "dc=my-domain,dc=com", $entry),
+ ldap_mod_add($link, "o=test,$base", $entry),
ldap_get_entries(
$link,
- ldap_search($link, "dc=my-domain,dc=com", "(Description=Domain description)")
+ ldap_search($link, "o=test,$base", "(Description=Domain description)")
)
);
?>
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
---EXPECT--
+--EXPECTF--
bool(true)
array(2) {
["count"]=>
int(1)
[0]=>
- array(10) {
+ array(8) {
["objectclass"]=>
- array(4) {
+ array(3) {
["count"]=>
- int(3)
+ int(2)
[0]=>
string(3) "top"
[1]=>
- string(8) "dcObject"
- [2]=>
string(12) "organization"
}
[0]=>
string(11) "objectclass"
- ["dc"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(9) "my-domain"
- }
- [1]=>
- string(2) "dc"
["o"]=>
array(2) {
["count"]=>
int(1)
[0]=>
- string(9) "my-domain"
+ string(4) "test"
}
- [2]=>
+ [1]=>
string(1) "o"
["description"]=>
array(2) {
[0]=>
string(18) "Domain description"
}
- [3]=>
+ [2]=>
string(11) "description"
["count"]=>
- int(4)
+ int(3)
["dn"]=>
- string(19) "dc=my-domain,dc=com"
+ string(%d) "o=test,%s"
}
}
===DONE===
// Too few parameters
var_dump(ldap_mod_add());
var_dump(ldap_mod_add($link));
-var_dump(ldap_mod_add($link, "dc=my-domain,dc=com"));
+var_dump(ldap_mod_add($link, "$base"));
// Too many parameters
-var_dump(ldap_mod_add($link, "dc=my-domain,dc=com", array(), "Additional data"));
+var_dump(ldap_mod_add($link, "$base", array(), "Additional data"));
// DN not found
-var_dump(ldap_mod_add($link, "dc=my-domain,dc=com", array()));
+var_dump(ldap_mod_add($link, "dc=my-domain,$base", array()));
// Invalid DN
var_dump(ldap_mod_add($link, "weirdAttribute=val", array()));
"o" => "my-domain",
);
-ldap_add($link, "dc=my-domain,dc=com", $entry);
+ldap_add($link, "dc=my-domain,$base", $entry);
$entry2 = $entry;
$entry2["dc"] = "Wrong Domain";
-var_dump(ldap_mod_add($link, "dc=my-domain,dc=com", $entry2));
+var_dump(ldap_mod_add($link, "dc=my-domain,$base", $entry2));
$entry2 = $entry;
$entry2["weirdAttribute"] = "weirdVal";
-var_dump(ldap_mod_add($link, "dc=my-domain,dc=com", $entry2));
+var_dump(ldap_mod_add($link, "dc=my-domain,$base", $entry2));
?>
===DONE===
--CLEAN--
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-ldap_delete($link, "dc=my-domain,dc=com");
+ldap_delete($link, "dc=my-domain,$base");
?>
--EXPECTF--
Warning: ldap_mod_add() expects exactly 3 parameters, 0 given in %s on line %d
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
+insert_dummy_data($link, $base);
$entry = array(
"description" => "user A"
);
var_dump(
- ldap_mod_del($link, "cn=userA,dc=my-domain,dc=com", $entry),
+ ldap_mod_del($link, "cn=userA,$base", $entry),
ldap_get_entries(
$link,
- ldap_search($link, "dc=my-domain,dc=com", "(description=user A)")
+ ldap_search($link, "$base", "(description=user A)")
)
);
?>
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
--EXPECT--
bool(true)
// Too few parameters
var_dump(ldap_mod_del());
var_dump(ldap_mod_del($link));
-var_dump(ldap_mod_del($link, "dc=my-domain,dc=com"));
+var_dump(ldap_mod_del($link, "$base"));
// Too many parameters
-var_dump(ldap_mod_del($link, "dc=my-domain,dc=com", array(), "Additional data"));
+var_dump(ldap_mod_del($link, "$base", array(), "Additional data"));
// DN not found
-var_dump(ldap_mod_del($link, "dc=my-domain,dc=com", array()));
+var_dump(ldap_mod_del($link, "dc=my-domain,$base", array()));
// Invalid DN
var_dump(ldap_mod_del($link, "weirdAttribute=val", array()));
// Invalid attributes
-var_dump(ldap_mod_del($link, "dc=my-domain,dc=com", array('dc')));
+var_dump(ldap_mod_del($link, "$base", array('dc')));
?>
===DONE===
--CLEAN--
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-ldap_delete($link, "dc=my-domain,dc=com");
+ldap_delete($link, "dc=my-domain,$base");
?>
--EXPECTF--
Warning: ldap_mod_del() expects exactly 3 parameters, 0 given in %s on line %d
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
+insert_dummy_data($link, $base);
$entry = array(
"description" => "user X"
);
var_dump(
- ldap_mod_replace($link, "cn=userA,dc=my-domain,dc=com", $entry),
+ ldap_mod_replace($link, "cn=userA,$base", $entry),
ldap_get_entries(
$link,
- ldap_search($link, "dc=my-domain,dc=com", "(description=user X)", array("description"))
+ ldap_search($link, "$base", "(description=user X)", array("description"))
)
);
?>
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
---EXPECT--
+--EXPECTF--
bool(true)
array(2) {
["count"]=>
["count"]=>
int(1)
["dn"]=>
- string(28) "cn=userA,dc=my-domain,dc=com"
+ string(%d) "cn=userA,%s"
}
}
===DONE===
// Too few parameters
var_dump(ldap_mod_replace());
var_dump(ldap_mod_replace($link));
-var_dump(ldap_mod_replace($link, "dc=my-domain,dc=com"));
+var_dump(ldap_mod_replace($link, "$base"));
// Too many parameters
-var_dump(ldap_mod_replace($link, "dc=my-domain,dc=com", array(), "Additional data"));
+var_dump(ldap_mod_replace($link, "$base", array(), "Additional data"));
// DN not found
-var_dump(ldap_mod_replace($link, "dc=my-domain,dc=com", array()));
+var_dump(ldap_mod_replace($link, "dc=my-domain,$base", array()));
// Invalid DN
var_dump(ldap_mod_replace($link, "weirdAttribute=val", array()));
// Invalid attributes
-var_dump(ldap_mod_replace($link, "dc=my-domain,dc=com", array('dc')));
+var_dump(ldap_mod_replace($link, "$base", array('dc')));
?>
===DONE===
--CLEAN--
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-
-ldap_delete($link, "dc=my-domain,dc=com");
?>
--EXPECTF--
Warning: ldap_mod_replace() expects exactly 3 parameters, 0 given in %s on line %d
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
+insert_dummy_data($link, $base);
$entry = array(
"objectClass" => array(
"top",
- "dcObject",
"organization"),
- "dc" => "my-domain",
- "o" => "my-domain",
+ "o" => "test",
"description" => "Domain description",
);
var_dump(
- ldap_modify($link, "dc=my-domain,dc=com", $entry),
+ ldap_modify($link, "o=test,$base", $entry),
ldap_get_entries(
$link,
- ldap_search($link, "dc=my-domain,dc=com", "(Description=Domain description)")
+ ldap_search($link, "$base", "(Description=Domain description)")
)
);
?>
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
---EXPECT--
+--EXPECTF--
bool(true)
array(2) {
["count"]=>
int(1)
[0]=>
- array(10) {
+ array(8) {
["objectclass"]=>
- array(4) {
+ array(3) {
["count"]=>
- int(3)
+ int(2)
[0]=>
string(3) "top"
[1]=>
- string(8) "dcObject"
- [2]=>
string(12) "organization"
}
[0]=>
string(11) "objectclass"
- ["dc"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(9) "my-domain"
- }
- [1]=>
- string(2) "dc"
["o"]=>
array(2) {
["count"]=>
int(1)
[0]=>
- string(9) "my-domain"
+ string(4) "test"
}
- [2]=>
+ [1]=>
string(1) "o"
["description"]=>
array(2) {
[0]=>
string(18) "Domain description"
}
- [3]=>
+ [2]=>
string(11) "description"
["count"]=>
- int(4)
+ int(3)
["dn"]=>
- string(19) "dc=my-domain,dc=com"
+ string(%d) "o=test,%s"
}
}
===DONE===
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
+insert_dummy_data($link, $base);
$mods = array(
array(
);
var_dump(
- ldap_modify_batch($link, "cn=userA,dc=my-domain,dc=com", $mods),
- ldap_get_entries($link, ldap_search($link, "dc=my-domain,dc=com", "(sn=Brown-Smith)"))
+ ldap_modify_batch($link, "cn=userA,$base", $mods),
+ ldap_get_entries($link, ldap_search($link, "$base", "(sn=Brown-Smith)"))
);
?>
===DONE===
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
---EXPECT--
+--EXPECTF--
bool(true)
array(2) {
["count"]=>
["count"]=>
int(5)
["dn"]=>
- string(28) "cn=userA,dc=my-domain,dc=com"
+ string(%d) "cn=userA,%s"
}
}
===DONE===
// Too few parameters
var_dump(ldap_modify_batch());
var_dump(ldap_modify_batch($link));
-var_dump(ldap_modify_batch($link, "dc=my-domain,dc=com"));
+var_dump(ldap_modify_batch($link, "$base"));
// Too many parameters
-var_dump(ldap_modify_batch($link, "dc=my-domain,dc=com", $addGivenName, "Invalid additional parameter"));
+var_dump(ldap_modify_batch($link, "$base", $addGivenName, "Invalid additional parameter"));
// DN not found
-var_dump(ldap_modify_batch($link, "dc=my-domain,dc=com", $addGivenName));
+var_dump(ldap_modify_batch($link, "cn=not-found,$base", $addGivenName));
// Invalid DN
var_dump(ldap_modify_batch($link, "weirdAttribute=val", $addGivenName));
"o" => "my-domain",
);
-ldap_add($link, "dc=my-domain,dc=com", $entry);
+ldap_add($link, "dc=my-domain,$base", $entry);
// invalid domain
$mods = array(
)
);
-var_dump(ldap_modify_batch($link, "dc=my-domain,dc=com", $mods));
+var_dump(ldap_modify_batch($link, "dc=my-domain,$base", $mods));
// invalid attribute
$mods = array(
)
);
-var_dump(ldap_modify_batch($link, "dc=my-domain,dc=com", $mods));
+var_dump(ldap_modify_batch($link, "dc=my-domain,$base", $mods));
?>
===DONE===
--CLEAN--
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-ldap_delete($link, "dc=my-domain,dc=com");
+ldap_delete($link, "dc=my-domain,$base");
?>
--EXPECTF--
Warning: ldap_modify_batch() expects exactly 3 parameters, 0 given in %s on line %d
// Too few parameters
var_dump(ldap_modify());
var_dump(ldap_modify($link));
-var_dump(ldap_modify($link, "dc=my-domain,dc=com"));
+var_dump(ldap_modify($link, "$base"));
// Too many parameters
-var_dump(ldap_modify($link, "dc=my-domain,dc=com", array(), "Additional data"));
+var_dump(ldap_modify($link, "$base", array(), "Additional data"));
// DN not found
-var_dump(ldap_modify($link, "dc=my-domain,dc=com", array()));
+var_dump(ldap_modify($link, "cn=not-found,$base", array()));
// Invalid DN
var_dump(ldap_modify($link, "weirdAttribute=val", array()));
"o" => "my-domain",
);
-ldap_add($link, "dc=my-domain,dc=com", $entry);
+ldap_add($link, "dc=my-domain,$base", $entry);
$entry2 = $entry;
$entry2["dc"] = "Wrong Domain";
-var_dump(ldap_modify($link, "dc=my-domain,dc=com", $entry2));
+var_dump(ldap_modify($link, "dc=my-domain,$base", $entry2));
$entry2 = $entry;
$entry2["weirdAttribute"] = "weirdVal";
-var_dump(ldap_modify($link, "dc=my-domain,dc=com", $entry2));
+var_dump(ldap_modify($link, "dc=my-domain,$base", $entry2));
?>
===DONE===
--CLEAN--
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-ldap_delete($link, "dc=my-domain,dc=com");
+ldap_delete($link, "dc=my-domain,$base");
?>
--EXPECTF--
Warning: ldap_modify() expects exactly 3 parameters, 0 given in %s on line %d
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
-$result = ldap_search($link, "dc=my-domain,dc=com", "(objectclass=organization)");
+insert_dummy_data($link, $base);
+$result = ldap_search($link, "$base", "(cn=userC)");
$entry = ldap_first_entry($link, $result);
$attribute = ldap_first_attribute($link, $entry);
var_dump(
+ ldap_next_attribute($link, $entry),
ldap_next_attribute($link, $entry),
ldap_next_attribute($link, $entry),
ldap_next_attribute($link, $entry)
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
--EXPECTF--
string(%d) "%s"
string(%d) "%s"
+string(%d) "%s"
bool(false)
===DONE===
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
-$result = ldap_search($link, "dc=my-domain,dc=com", "(objectclass=organization)");
+insert_dummy_data($link, $base);
+$result = ldap_search($link, "$base", "(objectclass=organization)");
$entry = ldap_first_entry($link, $result);
var_dump(
ldap_next_attribute($link),
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
--EXPECTF--
Warning: ldap_next_attribute() expects %s 2 parameters, 1 given in %s on line %d
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
-$result = ldap_list($link, "dc=my-domain,dc=com", "(objectClass=person)");
+insert_dummy_data($link, $base);
+$result = ldap_list($link, "$base", "(objectClass=person)");
$entry = ldap_first_entry($link, $result);
var_dump(
$entry = ldap_next_entry($link, $entry),
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
--EXPECTF--
resource(%d) of type (ldap result entry)
<?php
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
-ldap_add($link, "cn=userref,dc=my-domain,dc=com", array(
+insert_dummy_data($link, $base);
+ldap_add($link, "cn=userref,$base", array(
"objectClass" => array("extensibleObject", "referral"),
"cn" => "userref",
- "ref" => "cn=userA,dc=my-domain,dc=com",
+ "ref" => "cn=userA,$base",
));
-ldap_add($link, "cn=userref2,dc=my-domain,dc=com", array(
+ldap_add($link, "cn=userref2,$base", array(
"objectClass" => array("extensibleObject", "referral"),
"cn" => "userref2",
- "ref" => "cn=userB,dc=my-domain,dc=com",
+ "ref" => "cn=userB,$base",
));
ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_NEVER);
-$result = ldap_search($link, "dc=my-domain,dc=com", "(cn=*)");
+$result = ldap_search($link, "$base", "(cn=*)");
$ref = ldap_first_reference($link, $result);
var_dump($ref2 = ldap_next_reference($link, $ref));
ldap_parse_reference($link, $ref2, $refs);
$link = ldap_connect_and_bind($host, $port, $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,dc=my-domain,dc=com");
-ldap_delete($link, "cn=userref2,dc=my-domain,dc=com");
-remove_dummy_data($link);
+ldap_delete($link, "cn=userref,$base");
+ldap_delete($link, "cn=userref2,$base");
+remove_dummy_data($link, $base);
?>
--EXPECTF--
resource(%d) of type (ldap result entry)
array(1) {
[0]=>
- string(28) "cn=userB,dc=my-domain,dc=com"
+ string(%d) "cn=userB,%s"
}
===DONE===
<?php
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
-ldap_add($link, "cn=userref,dc=my-domain,dc=com", array(
+insert_dummy_data($link, $base);
+ldap_add($link, "cn=userref,$base", array(
"objectClass" => array("extensibleObject", "referral"),
"cn" => "userref",
- "ref" => "cn=userA,dc=my-domain,dc=com",
+ "ref" => "cn=userA,$base",
));
ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_NEVER);
-$result = ldap_search($link, "dc=my-domain,dc=com", "(cn=*)");
+$result = ldap_search($link, "$base", "(cn=*)");
$ref = ldap_first_reference($link, $result);
$refs = null;
var_dump(
$link = ldap_connect_and_bind($host, $port, $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,dc=my-domain,dc=com");
-remove_dummy_data($link);
+ldap_delete($link, "cn=userref,$base");
+remove_dummy_data($link, $base);
?>
--EXPECTF--
bool(true)
array(1) {
[0]=>
- string(28) "cn=userA,dc=my-domain,dc=com"
+ string(%d) "cn=userA,%s"
}
===DONE===
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
-ldap_add($link, "cn=userref,dc=my-domain,dc=com", array(
+insert_dummy_data($link, $base);
+ldap_add($link, "cn=userref,$base", array(
"objectClass" => array("extensibleObject", "referral"),
"cn" => "userref",
- "ref" => "cn=userA,dc=my-domain,dc=com",
+ "ref" => "cn=userA,$base",
));
-$result = ldap_search($link, "cn=userref,dc=my-domain,dc=com", "(cn=user*)");
+$result = ldap_search($link, "cn=userref,$base", "(cn=user*)");
$errcode = $dn = $errmsg = $refs = null;
var_dump(
ldap_parse_result($link, $result, $errcode, $dn, $errmsg, $refs),
$link = ldap_connect_and_bind($host, $port, $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,dc=my-domain,dc=com");
-remove_dummy_data($link);
+ldap_delete($link, "cn=userref,$base");
+remove_dummy_data($link, $base);
?>
---EXPECT--
+--EXPECTF--
bool(true)
int(10)
-string(30) "cn=userref,dc=my-domain,dc=com"
+string(%d) "cn=userref,%s"
string(0) ""
array(1) {
[0]=>
- string(28) "cn=userA,dc=my-domain,dc=com"
+ string(%d) "cn=userA,%s"
}
===DONE===
Patrick Allaert <patrickallaert@php.net>
Belgian PHP Testfest 2009
--SKIPIF--
-<?php
-require_once('skipif.inc');
+<?php
+require_once('skipif.inc');
require_once('skipifbindfailure.inc');
?>
--FILE--
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
+insert_dummy_data($link, $base);
var_dump(
- $result = ldap_read($link, "dc=my-domain,dc=com", "(dc=*)"),
+ $result = ldap_read($link, "o=test,$base", "(o=*)"),
ldap_get_entries($link, $result)
);
?>
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
--EXPECTF--
resource(%d) of type (ldap result)
["count"]=>
int(1)
[0]=>
- array(8) {
+ array(6) {
["objectclass"]=>
- array(4) {
+ array(3) {
["count"]=>
- int(3)
+ int(2)
[0]=>
string(3) "top"
[1]=>
- string(8) "dcObject"
- [2]=>
string(12) "organization"
}
[0]=>
string(11) "objectclass"
- ["dc"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(9) "my-domain"
- }
- [1]=>
- string(2) "dc"
["o"]=>
array(2) {
["count"]=>
int(1)
[0]=>
- string(9) "my-domain"
+ string(4) "test"
}
- [2]=>
+ [1]=>
string(1) "o"
["count"]=>
- int(3)
+ int(2)
["dn"]=>
- string(19) "dc=my-domain,dc=com"
+ string(%d) "o=test,%s"
}
}
===DONE===
var_dump(ldap_read($link, $link));
// Too many parameters
-var_dump(ldap_read($link, "dc=my-domain,dc=com", "(objectClass=*)", array(), 0, 0, 0, 0 , "Additional data"));
+var_dump(ldap_read($link, "$base", "(objectClass=*)", array(), 0, 0, 0, 0 , "Additional data"));
?>
===DONE===
--EXPECTF--
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
+insert_dummy_data($link, $base);
var_dump(
- ldap_rename($link, "cn=userA,dc=my-domain,dc=com", "cn=userZ", "dc=my-domain,dc=com", true)
+ ldap_rename($link, "cn=userA,$base", "cn=userZ", "$base", true)
);
-$result = ldap_search($link, "dc=my-domain,dc=com", "(cn=userA)", array("cn", "sn"));
-$result = ldap_search($link, "dc=my-domain,dc=com", "(cn=userZ)", array("cn", "sn"));
+$result = ldap_search($link, "$base", "(cn=userA)", array("cn", "sn"));
+$result = ldap_search($link, "$base", "(cn=userZ)", array("cn", "sn"));
var_dump(ldap_get_entries($link, $result));
?>
===DONE===
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-ldap_rename($link, "cn=userZ,dc=my-domain,dc=com", "cn=userA", "dc=my-domain,dc=com", true);
-remove_dummy_data($link);
+ldap_rename($link, "cn=userZ,$base", "cn=userA", "$base", true);
+remove_dummy_data($link, $base);
?>
---EXPECT--
+--EXPECTF--
bool(true)
array(2) {
["count"]=>
["count"]=>
int(2)
["dn"]=>
- string(28) "cn=userZ,dc=my-domain,dc=com"
+ string(%d) "cn=userZ,%s"
}
}
===DONE===
$link = ldap_connect($host, $port);
var_dump(ldap_rename($link));
-var_dump(ldap_rename($link, "cn=userNotFound,dc=my-domain,dc=com", "cn=userZ", "dc=my-domain,dc=com", true));
+var_dump(ldap_rename($link, "cn=userNotFound,$base", "cn=userZ", "$base", true));
?>
===DONE===
--EXPECTF--
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
+insert_dummy_data($link, $base);
var_dump(
- $result = ldap_search($link, "dc=my-domain,dc=com", "(objectClass=person)"),
+ $result = ldap_search($link, "$base", "(objectClass=person)"),
ldap_get_entries($link, $result)
);
?>
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
--EXPECTF--
resource(%d) of type (ldap result)
["count"]=>
int(6)
["dn"]=>
- string(28) "cn=userA,dc=my-domain,dc=com"
+ string(%d) "cn=userA,%s"
}
[1]=>
array(12) {
["count"]=>
int(5)
["dn"]=>
- string(28) "cn=userB,dc=my-domain,dc=com"
+ string(%d) "cn=userB,%s"
}
[2]=>
array(10) {
["count"]=>
int(4)
["dn"]=>
- string(37) "cn=userC,cn=userB,dc=my-domain,dc=com"
+ string(%d) "cn=userC,cn=userB,%s"
}
}
===DONE===
$link = ldap_connect($host, $port);
-$dn = "dc=my-domain,dc=com";
+$dn = "dc=not-found,$base";
$filter = "(dc=*)";
$result = ldap_search();
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
+insert_dummy_data($link, $base);
-$dn = "dc=my-domain,dc=com";
+$dn = "$base";
$filter = "(dc=*)";
var_dump(
- $result = ldap_search($link, "dc=my-domain,dc=com", "(dc=*)", array('dc')),
+ $result = ldap_search($link, "o=test,$base", "(o=*)", array('o')),
ldap_get_entries($link, $result)
);
?>
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
--EXPECTF--
resource(%d) of type (ldap result)
int(1)
[0]=>
array(4) {
- ["dc"]=>
+ ["o"]=>
array(2) {
["count"]=>
int(1)
[0]=>
- string(9) "my-domain"
+ string(4) "test"
}
[0]=>
- string(2) "dc"
+ string(1) "o"
["count"]=>
int(1)
["dn"]=>
- string(19) "dc=my-domain,dc=com"
+ string(%d) "o=test,%s"
}
}
===DONE===
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
+insert_dummy_data($link, $base);
var_dump(
- $result = ldap_search($link, "dc=my-domain,dc=com", "(objectclass=person)", array('sn'), 1),
+ $result = ldap_search($link, "$base", "(objectclass=person)", array('sn'), 1),
ldap_get_entries($link, $result)
);
?>
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
--EXPECTF--
resource(%d) of type (ldap result)
["count"]=>
int(1)
["dn"]=>
- string(28) "cn=userA,dc=my-domain,dc=com"
+ string(%d) "cn=userA,%s"
}
[1]=>
array(4) {
["count"]=>
int(1)
["dn"]=>
- string(28) "cn=userB,dc=my-domain,dc=com"
+ string(%d) "cn=userB,%s"
}
[2]=>
array(4) {
["count"]=>
int(1)
["dn"]=>
- string(37) "cn=userC,cn=userB,dc=my-domain,dc=com"
+ string(%d) "cn=userC,cn=userB,%s"
}
}
===DONE===
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
+insert_dummy_data($link, $base);
-$dn = "dc=my-domain,dc=com";
+$dn = "$base";
$filter = "(objectclass=person)";
var_dump(
$result = ldap_search($link, $dn, $filter, array('sn'), 1, 3),
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
--EXPECTF--
resource(%d) of type (ldap result)
["count"]=>
int(1)
["dn"]=>
- string(28) "cn=userA,dc=my-domain,dc=com"
+ string(%d) "cn=userA,%s"
}
[1]=>
array(4) {
["count"]=>
int(1)
["dn"]=>
- string(28) "cn=userB,dc=my-domain,dc=com"
+ string(%d) "cn=userB,%s"
}
[2]=>
array(4) {
["count"]=>
int(1)
["dn"]=>
- string(37) "cn=userC,cn=userB,dc=my-domain,dc=com"
+ string(%d) "cn=userC,cn=userB,%s"
}
}
["count"]=>
int(1)
["dn"]=>
- string(28) "cn=userA,dc=my-domain,dc=com"
+ string(%d) "cn=userA,%s"
}
}
===DONE===
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
+insert_dummy_data($link, $base);
-$dn = "dc=my-domain,dc=com";
+$dn = "$base";
$filter = "(objectclass=person)";
var_dump(
$result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3),
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
--EXPECTF--
Warning: ldap_search(): Partial search results returned: Sizelimit exceeded in %s on line %d
["count"]=>
int(1)
["dn"]=>
- string(28) "cn=userA,dc=my-domain,dc=com"
+ string(%d) "cn=userA,%s"
}
}
===DONE===
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
+insert_dummy_data($link, $base);
-$dn = "dc=my-domain,dc=com";
+$dn = "$base";
$filter = "(objectclass=person)";
var_dump(
$result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3, LDAP_DEREF_SEARCHING),
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
--EXPECTF--
Warning: ldap_search(): Partial search results returned: Sizelimit exceeded in %s on line %d
["count"]=>
int(1)
["dn"]=>
- string(28) "cn=userA,dc=my-domain,dc=com"
+ string(%d) "cn=userA,%s"
}
}
["count"]=>
int(1)
["dn"]=>
- string(28) "cn=userA,dc=my-domain,dc=com"
+ string(%d) "cn=userA,%s"
}
}
["count"]=>
int(1)
["dn"]=>
- string(28) "cn=userA,dc=my-domain,dc=com"
+ string(%d) "cn=userA,%s"
}
}
===DONE===
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
+insert_dummy_data($link, $base);
-$dn = "dc=my-domain,dc=com";
+$dn = "$base";
$filter = "(objectclass=person)";
var_dump(
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-remove_dummy_data($link);
+remove_dummy_data($link, $base);
?>
--EXPECTF--
array(2) {
["count"]=>
int(6)
["dn"]=>
- string(28) "cn=userA,dc=my-domain,dc=com"
+ string(%d) "cn=userA,%s"
}
[1]=>
array(12) {
["count"]=>
int(5)
["dn"]=>
- string(28) "cn=userB,dc=my-domain,dc=com"
+ string(%d) "cn=userB,%s"
}
[2]=>
array(10) {
["count"]=>
int(4)
["dn"]=>
- string(37) "cn=userC,cn=userB,dc=my-domain,dc=com"
+ string(%d) "cn=userC,cn=userB,%s"
}
}
bool(true)
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
-ldap_add($link, "cn=userC,dc=my-domain,dc=com", array(
+insert_dummy_data($link, $base);
+ldap_add($link, "cn=userC,$base", array(
"objectclass" => "person",
"cn" => "userC",
"sn" => "zzz",
"userPassword" => "oops",
"description" => "a user",
));
-ldap_add($link, "cn=userD,dc=my-domain,dc=com", array(
+ldap_add($link, "cn=userD,$base", array(
"objectclass" => "person",
"cn" => "userD",
"sn" => "aaa",
"userPassword" => "oops",
"description" => "another user",
));
-ldap_add($link, "cn=userE,dc=my-domain,dc=com", array(
+ldap_add($link, "cn=userE,$base", array(
"objectclass" => "person",
"cn" => "userE",
"sn" => "a",
"userPassword" => "oops",
"description" => "yet another user",
));
-$result = ldap_search($link, "dc=my-domain,dc=com", "(objectclass=person)", array("sn", "description"));
+$result = ldap_search($link, "$base", "(objectclass=person)", array("sn", "description"));
var_dump(
ldap_sort($link, $result, "sn"),
ldap_get_entries($link, $result)
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-ldap_delete($link, "cn=userC,dc=my-domain,dc=com");
-ldap_delete($link, "cn=userD,dc=my-domain,dc=com");
-ldap_delete($link, "cn=userE,dc=my-domain,dc=com");
-remove_dummy_data($link);
+ldap_delete($link, "cn=userC,$base");
+ldap_delete($link, "cn=userD,$base");
+ldap_delete($link, "cn=userE,$base");
+remove_dummy_data($link, $base);
?>
---EXPECT--
+--EXPECTF--
bool(true)
array(7) {
["count"]=>
["count"]=>
int(2)
["dn"]=>
- string(28) "cn=userE,dc=my-domain,dc=com"
+ string(%d) "cn=userE,%s"
}
[1]=>
array(6) {
["count"]=>
int(2)
["dn"]=>
- string(28) "cn=userD,dc=my-domain,dc=com"
+ string(%d) "cn=userD,%s"
}
[2]=>
array(6) {
["count"]=>
int(2)
["dn"]=>
- string(28) "cn=userA,dc=my-domain,dc=com"
+ string(%d) "cn=userA,%s"
}
[3]=>
array(6) {
["count"]=>
int(2)
["dn"]=>
- string(28) "cn=userB,dc=my-domain,dc=com"
+ string(%d) "cn=userB,%s"
}
[4]=>
array(4) {
["count"]=>
int(1)
["dn"]=>
- string(37) "cn=userC,cn=userB,dc=my-domain,dc=com"
+ string(%d) "cn=userC,cn=userB,%s"
}
[5]=>
array(6) {
["count"]=>
int(2)
["dn"]=>
- string(28) "cn=userC,dc=my-domain,dc=com"
+ string(%d) "cn=userC,%s"
}
}
===DONE===
require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link);
-ldap_add($link, "cn=userC,dc=my-domain,dc=com", array(
+insert_dummy_data($link, $base);
+ldap_add($link, "cn=userC,$base", array(
"objectclass" => "person",
"cn" => "userC",
"sn" => "zzz",
"userPassword" => "oops",
"description" => "a user",
));
-ldap_add($link, "cn=userD,dc=my-domain,dc=com", array(
+ldap_add($link, "cn=userD,$base", array(
"objectclass" => "person",
"cn" => "userD",
"sn" => "aaa",
"userPassword" => "oops",
"description" => "another user",
));
-ldap_add($link, "cn=userE,dc=my-domain,dc=com", array(
+ldap_add($link, "cn=userE,$base", array(
"objectclass" => "person",
"cn" => "userE",
"sn" => "a",
"userPassword" => "oops",
"description" => "yet another user",
));
-$result = ldap_search($link, "dc=my-domain,dc=com", "(objectclass=person)", array("sn", "description"));
+$result = ldap_search($link, "$base", "(objectclass=person)", array("sn", "description"));
var_dump(
ldap_sort($link, $result, "description"),
ldap_get_entries($link, $result)
include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-ldap_delete($link, "cn=userC,dc=my-domain,dc=com");
-ldap_delete($link, "cn=userD,dc=my-domain,dc=com");
-ldap_delete($link, "cn=userE,dc=my-domain,dc=com");
-remove_dummy_data($link);
+ldap_delete($link, "cn=userC,$base");
+ldap_delete($link, "cn=userD,$base");
+ldap_delete($link, "cn=userE,$base");
+remove_dummy_data($link, $base);
?>
---EXPECT--
+--EXPECTF--
bool(true)
array(7) {
["count"]=>
["count"]=>
int(1)
["dn"]=>
- string(37) "cn=userC,cn=userB,dc=my-domain,dc=com"
+ string(%d) "cn=userC,cn=userB,%s"
}
[1]=>
array(6) {
["count"]=>
int(2)
["dn"]=>
- string(28) "cn=userC,dc=my-domain,dc=com"
+ string(%d) "cn=userC,%s"
}
[2]=>
array(6) {
["count"]=>
int(2)
["dn"]=>
- string(28) "cn=userD,dc=my-domain,dc=com"
+ string(%d) "cn=userD,%s"
}
[3]=>
array(6) {
["count"]=>
int(2)
["dn"]=>
- string(28) "cn=userA,dc=my-domain,dc=com"
+ string(%d) "cn=userA,%s"
}
[4]=>
array(6) {
["count"]=>
int(2)
["dn"]=>
- string(28) "cn=userB,dc=my-domain,dc=com"
+ string(%d) "cn=userB,%s"
}
[5]=>
array(6) {
["count"]=>
int(2)
["dn"]=>
- string(28) "cn=userE,dc=my-domain,dc=com"
+ string(%d) "cn=userE,%s"
}
}
===DONE===