mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-5.6'
* PHP-5.6: Updated README, added test to create LDAP base if missing and ease tests
This commit is contained in:
commit
a09dcb0e13
4 changed files with 23 additions and 5 deletions
|
@ -2,13 +2,16 @@ Most tests here relies on the availability of an LDAP server configured with TLS
|
|||
|
||||
Client/Server configuration:
|
||||
===========================================================
|
||||
OpenLDAP 2.3.43 has been used with the configuration below.
|
||||
OpenLDAP 2.4.31 has been used with the configuration below.
|
||||
|
||||
Notes:
|
||||
1. A self signed certificate can be generated using:
|
||||
$ openssl req -newkey rsa:1024 -x509 -nodes -out server.pem -keyout server.pem -days 3650
|
||||
It is used for testing ldap_start_tls(), which also requires "TLS_REQCERT never" in client configuration
|
||||
2. An empty LDAP structure is required for the tests to be PASSed
|
||||
2. An empty LDAP structure is required for the tests to be PASSed (except for base and admin)
|
||||
|
||||
If you use a debian based distribution, prefer the use of dpkg-reconfigure.
|
||||
Otherwise you may alter these configuration files:
|
||||
|
||||
(/etc/openldap/)slapd.conf:
|
||||
-----------------------------------------------------------
|
||||
|
@ -40,6 +43,7 @@ Tests configuration:
|
|||
The following environment variables may be defined:
|
||||
LDAP_TEST_HOST (default: localhost) Host to connect to
|
||||
LDAP_TEST_PORT (default: 389) Port to connect to
|
||||
LDAP_TEST_BASE (default: dc=my-domain,dc=com) Base to use. May be the ldap root or a subtree. (ldap_search_variation6 will fail if a subtree is used)
|
||||
LDAP_TEST_USER (default: cn=Manager,dc=my-domain,dc=com) DN used for binding
|
||||
LDAP_TEST_SASL_USER (default: Manager) SASL user used for SASL binding
|
||||
LDAP_TEST_PASSWD (default: secret) Password used for plain and SASL binding
|
||||
|
@ -50,4 +54,4 @@ Credits:
|
|||
===========================================================
|
||||
Davide Mendolia <idaf1er@gmail.com>
|
||||
Patrick Allaert <patrick.allaert@gmail.com>
|
||||
|
||||
Côme Bernigaud <mcmic@php.net>
|
||||
|
|
|
@ -22,6 +22,20 @@ function ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version)
|
|||
}
|
||||
|
||||
function insert_dummy_data($link, $base) {
|
||||
// Create root if not there
|
||||
$testBase = ldap_read($link, $base, '(objectClass=*)', array('objectClass'));
|
||||
if (ldap_count_entries($link, $testBase) < 1) {
|
||||
ldap_add(
|
||||
$link, "$base", array(
|
||||
"objectClass" => array(
|
||||
"top",
|
||||
"organization",
|
||||
"dcObject"
|
||||
),
|
||||
"o" => "php ldap tests"
|
||||
)
|
||||
);
|
||||
}
|
||||
ldap_add($link, "o=test,$base", array(
|
||||
"objectClass" => array(
|
||||
"top",
|
||||
|
|
|
@ -32,7 +32,7 @@ remove_dummy_data($link, $base);
|
|||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
resource(6) of type (ldap result)
|
||||
resource(%d) of type (ldap result)
|
||||
array(2) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
|
|
|
@ -32,7 +32,7 @@ remove_dummy_data($link, $base);
|
|||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
resource(6) of type (ldap result)
|
||||
resource(%d) of type (ldap result)
|
||||
array(3) {
|
||||
["count"]=>
|
||||
int(2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue