php-src/ext/ldap/tests
2019-06-13 22:12:34 +02:00
..
bug48441.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
bug48696.phpt fix test 2009-07-26 19:46:38 +00:00
bug72021.phpt Make LDAP_ESCAPE_DN compliant with RFC 4514 2016-06-25 21:16:45 -05:00
bug73933.phpt Fixed another part in ldap (bug #73933) 2017-01-19 12:23:23 +08:00
bug76248.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
bug77958.phpt Some more string conversion handling, fixing bug #77958 2019-06-13 22:12:34 +02:00
connect.inc Added support and test for LDAP_CONTROL_VALUESRETURNFILTER 2017-09-21 10:05:41 +02:00
ldap_add_basic.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_add_error.phpt Removed client controls alltogether 2017-09-21 10:05:41 +02:00
ldap_add_ext.phpt Added skip when control are not supported by the test ldap server 2017-09-21 10:05:42 +02:00
ldap_bind_basic.phpt - Fixed tests 2009-09-26 17:59:33 +00:00
ldap_bind_error.phpt MFH: Tests for ext/ldap from PHPBelgium TestFest 2009-07-03 09:21:31 +00:00
ldap_bind_ext.phpt Added skip when control are not supported by the test ldap server 2017-09-21 10:05:42 +02:00
ldap_bind_variation.phpt - Fixed tests 2009-09-26 17:59:33 +00:00
ldap_compare_basic.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_compare_error.phpt Removed client controls alltogether 2017-09-21 10:05:41 +02:00
ldap_connect_basic.phpt MFH: Tests for ext/ldap from PHPBelgium TestFest 2009-07-03 09:21:31 +00:00
ldap_connect_error.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_connect_ldap_conf.phpt Use EXPECT instead of EXPECTF when possible 2018-02-20 21:53:48 +01:00
ldap_connect_variation.phpt Revert "Added back support for undocummented host:port syntax" 2015-11-24 03:45:21 +01:00
ldap_control_paged_results_variation1.phpt Updated README, added test to create LDAP base if missing and ease tests 2015-07-06 14:26:49 +02:00
ldap_control_paged_results_variation2.phpt Updated README, added test to create LDAP base if missing and ease tests 2015-07-06 14:26:49 +02:00
ldap_control_paged_results_variation3.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_controls.phpt Added skip when control are not supported by the test ldap server 2017-09-21 10:05:42 +02:00
ldap_count_entries_basic.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_count_entries_error.phpt MFH: Tests for ext/ldap from PHPBelgium TestFest 2009-07-03 09:21:31 +00:00
ldap_delete_basic.phpt Fixed two errors in LDAP tests 2015-06-23 16:11:12 +02:00
ldap_delete_error.phpt Removed client controls alltogether 2017-09-21 10:05:41 +02:00
ldap_delete_ext.phpt Added skip when control are not supported by the test ldap server 2017-09-21 10:05:42 +02:00
ldap_dn2ufn.phpt
ldap_err2str_basic.phpt MFH: Tests for ext/ldap from PHPBelgium TestFest 2009-07-03 09:21:31 +00:00
ldap_err2str_error.phpt Use int instead of integer in type errors 2018-02-04 19:08:23 +01:00
ldap_errno_basic.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_errno_error.phpt MFH: Tests for ext/ldap from PHPBelgium TestFest 2009-07-03 09:21:31 +00:00
ldap_error_basic.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_error_error.phpt MFH: Tests for ext/ldap from PHPBelgium TestFest 2009-07-03 09:21:31 +00:00
ldap_escape_all.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
ldap_escape_both.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
ldap_escape_dn.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
ldap_escape_filter.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
ldap_escape_ignore.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
ldap_exop_passwd_error.phpt Added controls support to ldap_parse_result and ldap_exop_passwd 2017-09-21 10:05:40 +02:00
ldap_exop_passwd.phpt Added controls support to ldap_parse_result and ldap_exop_passwd 2017-09-21 10:05:40 +02:00
ldap_exop_refresh.phpt Merge branch 'PHP-7.2' 2018-03-23 18:57:58 +01:00
ldap_exop_whoami.phpt Changed API to avoid using passing result by reference 2017-07-04 10:03:27 +02:00
ldap_exop.phpt Fixed ldap_exop test since rebase remove client controls 2017-09-21 10:05:41 +02:00
ldap_explode_dn.phpt
ldap_first_attribute_basic.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_first_attribute_error.phpt MFH: Tests for ext/ldap from PHPBelgium TestFest 2009-07-03 09:21:31 +00:00
ldap_first_entry_basic.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_first_entry_error.phpt MFH: Tests for ext/ldap from PHPBelgium TestFest 2009-07-03 09:21:31 +00:00
ldap_first_reference_basic.phpt Using new control syntax for MANAGEDSAIT control when deleting references 2017-09-21 10:05:41 +02:00
ldap_first_reference_error.phpt MFH: Tests for ext/ldap from PHPBelgium TestFest 2009-07-03 09:21:31 +00:00
ldap_free_result_basic.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_free_result_error.phpt MFH: Tests for ext/ldap from PHPBelgium TestFest 2009-07-03 09:21:31 +00:00
ldap_get_attributes_basic.phpt Use EXPECT instead of EXPECTF when possible 2018-02-20 21:53:48 +01:00
ldap_get_attributes_error.phpt MFH: Tests for ext/ldap from PHPBelgium TestFest 2009-07-03 09:21:31 +00:00
ldap_get_dn_basic.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_get_dn_error.phpt MFH: Tests for ext/ldap from PHPBelgium TestFest 2009-07-03 09:21:31 +00:00
ldap_get_entries_basic.phpt Fixed two errors in LDAP tests 2015-06-23 16:11:12 +02:00
ldap_get_entries_error.phpt Remove more PHP 6 leftovers from tests 2016-11-24 22:39:39 +01:00
ldap_get_entries_variation.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_get_option_basic.phpt MFH: Tests for ext/ldap from PHPBelgium TestFest 2009-07-03 09:21:31 +00:00
ldap_get_option_controls.phpt Indexing controls by OID when parsing them 2017-09-21 10:05:42 +02:00
ldap_get_option_error.phpt MFH: Tests for ext/ldap from PHPBelgium TestFest 2009-07-03 09:21:31 +00:00
ldap_get_option_package_basic.phpt Add tests for LDAP_OPT_* constants 2016-06-15 23:01:26 -05:00
ldap_get_option_variation.phpt Indexing controls by OID when parsing them 2017-09-21 10:05:42 +02:00
ldap_get_values_len_basic.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_get_values_len_error.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_list_basic.phpt Fixed ldap tests when ldap server hash out passwords 2017-07-26 17:34:18 +02:00
ldap_list_error.phpt Removed client controls alltogether 2017-09-21 10:05:41 +02:00
ldap_mod_add_basic.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_mod_add_error.phpt Removed client controls alltogether 2017-09-21 10:05:41 +02:00
ldap_mod_del_basic.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_mod_del_error.phpt Removed client controls alltogether 2017-09-21 10:05:41 +02:00
ldap_mod_ext.phpt Added skip when control are not supported by the test ldap server 2017-09-21 10:05:42 +02:00
ldap_mod_replace_basic.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_mod_replace_error.phpt Removed client controls alltogether 2017-09-21 10:05:41 +02:00
ldap_modify_basic.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_modify_batch_basic.phpt Fixed ldap tests when ldap server hash out passwords 2017-07-26 17:34:18 +02:00
ldap_modify_batch_error.phpt Removed client controls alltogether 2017-09-21 10:05:41 +02:00
ldap_modify_error.phpt Removed client controls alltogether 2017-09-21 10:05:41 +02:00
ldap_next_attribute_basic.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_next_attribute_error.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_next_entry_basic.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_next_entry_error.phpt MFH: Tests for ext/ldap from PHPBelgium TestFest 2009-07-03 09:21:31 +00:00
ldap_next_reference_basic.phpt Using new control syntax for MANAGEDSAIT control when deleting references 2017-09-21 10:05:41 +02:00
ldap_next_reference_error.phpt MFH: Tests for ext/ldap from PHPBelgium TestFest 2009-07-03 09:21:31 +00:00
ldap_option_reqcert_basic.phpt fix SKIPIF sections 2016-03-09 14:28:38 +01:00
ldap_option_reqcert_error.phpt fix SKIPIF sections 2016-03-09 14:28:38 +01:00
ldap_parse_reference_basic.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_parse_reference_error.phpt MFH: Tests for ext/ldap from PHPBelgium TestFest 2009-07-03 09:21:31 +00:00
ldap_parse_result_basic.phpt Using new control syntax for MANAGEDSAIT control when deleting references 2017-09-21 10:05:41 +02:00
ldap_parse_result_controls.phpt Added skip when control are not supported by the test ldap server 2017-09-21 10:05:42 +02:00
ldap_parse_result_error.phpt MFH: Tests for ext/ldap from PHPBelgium TestFest 2009-07-03 09:21:31 +00:00
ldap_read_basic.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_read_error.phpt Removed client controls alltogether 2017-09-21 10:05:41 +02:00
ldap_rename_basic.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_rename_error.phpt Added controls support to ldap_rename 2017-09-21 10:05:41 +02:00
ldap_rename_ext.phpt Added skip when control are not supported by the test ldap server 2017-09-21 10:05:42 +02:00
ldap_sasl_bind_basic.phpt Fix bug 61717 ext\ldap\tests\ldap_sasl_bind_basic.phpt fails 2012-04-16 15:20:03 +02:00
ldap_sasl_bind_error.phpt MFH: Tests for ext/ldap from PHPBelgium TestFest 2009-07-03 09:21:31 +00:00
ldap_search_basic.phpt Fixed ldap tests when ldap server hash out passwords 2017-07-26 17:34:18 +02:00
ldap_search_error.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_search_overrides.phpt Fixed ldap tests when ldap server hash out passwords 2017-07-26 17:34:18 +02:00
ldap_search_paged_result_controls.phpt Added skip when control are not supported by the test ldap server 2017-09-21 10:05:42 +02:00
ldap_search_sort_controls.phpt Added support for VLV controls request and response 2017-09-21 10:05:42 +02:00
ldap_search_variation1.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_search_variation2.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_search_variation3.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_search_variation4.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_search_variation5.phpt Fixed LDAP tests so that base can exists 2015-06-17 13:55:13 +02:00
ldap_search_variation6.phpt Fixed ldap tests when ldap server hash out passwords 2017-07-26 17:34:18 +02:00
ldap_set_option_basic.phpt MFH: Tests for ext/ldap from PHPBelgium TestFest 2009-07-03 09:21:31 +00:00
ldap_set_option_cafiles_basic.phpt Add tests for LDAP_OPT_* constants 2016-06-15 23:01:26 -05:00
ldap_set_option_ciphersuite_basic.phpt Add tests for LDAP_OPT_* constants 2016-06-15 23:01:26 -05:00
ldap_set_option_crlcheck_basic.phpt Add tests for the LDAP CRL check option 2016-06-15 20:29:39 -05:00
ldap_set_option_crlcheck_error.phpt Add tests for the LDAP CRL check option 2016-06-15 20:29:39 -05:00
ldap_set_option_error.phpt Fixed test for ldap_set_option server controls with empty array 2017-07-26 17:21:27 +02:00
ldap_set_option_keepalive_basic.phpt Add tests for LDAP_OPT_* constants 2016-06-15 23:01:26 -05:00
ldap_set_option_reqcert_basic.phpt Add missing SKIPIF sections 2018-02-03 13:54:34 +01:00
ldap_set_option_reqcert_error.phpt LDAP - Added support to change the certificates verification 2016-03-01 04:59:30 +01:00
ldap_set_option_tls_protocol_min_basic.phpt Add LDAP TLS Protocol Min constants 2016-06-15 22:45:38 -05:00
ldap_set_option_variation.phpt Indexing controls by OID when parsing them 2017-09-21 10:05:42 +02:00
ldap_set_rebind_proc_basic.phpt MFH: Tests for ext/ldap from PHPBelgium TestFest 2009-07-03 09:21:31 +00:00
ldap_set_rebind_proc_error.phpt typo fixes 2013-07-15 00:23:03 -07:00
ldap_sort_basic.phpt Deprecating ldap_sort the right way 2015-06-29 14:31:20 +02:00
ldap_sort_error.phpt Remove more PHP 6 leftovers from tests 2016-11-24 22:39:39 +01:00
ldap_sort_variation.phpt Deprecating ldap_sort the right way 2015-06-29 14:31:20 +02:00
ldap_start_tls_basic.phpt - Fixed tests 2009-09-26 17:59:33 +00:00
ldap_start_tls_error.phpt MFH: Tests for ext/ldap from PHPBelgium TestFest 2009-07-03 09:21:31 +00:00
ldap_unbind_basic.phpt MFH: Tests for ext/ldap from PHPBelgium TestFest 2009-07-03 09:21:31 +00:00
ldap_unbind_error.phpt Remove more PHP 6 leftovers from tests 2016-11-24 22:39:39 +01:00
ldap_unbind_variation.phpt Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
README Trim trailing whitespace in source code files 2018-10-13 14:16:33 +02:00
skipif.inc
skipifbindfailure.inc
skipifcontrol.inc Added skip when control are not supported by the test ldap server 2017-09-21 10:05:42 +02:00

To ease testing LDAP-Setups we've created a vagrant-setup.

Prerequisits:
=============

You will need vagrant on your box. Get it from https://www.vagrantup.com

Usage:
======

To use it follow these steps:

* Create a Vagrant-file with the following content.
* Go to that directory and run "vagrant up"

```
$setup = <<<SETUP
apt-get update

DEBIAN_FRONTEND=noninteractive aptitude install -q -y slapd ldap-utils

export SLAPPASS=`slappasswd -s password`

echo "dn: olcDatabase={1}hdb,cn=config
changetype: modify
replace: olcSuffix
olcSuffix: dc=nodomain
-
replace: olcRootDN
olcRootDN: dc=admin,dc=nodomain
-
replace: olcRootPW
olcRootPW: ${SLAPPASS}" | ldapmodify -Y EXTERNAL -H ldapi:///

echo "dn: dc=nodomain
objectClass: dcObject
objectClass: organization
o: Example
dc: example

dn: ou=extldap,dc=nodomain
objectClass: organizationalUnit
ou: extldap" | ldapadd -c -x -H ldap://localhost:389 -D "dc=admin,dc=nodomain" -w password
SETUP

Vagrant.configure(2) do |config|
  config.vm.box = "ubuntu/trusty64"
  config.vm.network "private_network", ip: "192.168.33.10"
  config.vm.provision "shell", inline: $setup
end
```

Now you will have a virtual machine up and running on IP-Address 192.168.10.33 listening on port 369 for incomming LDAP-connections. The machine is already configured to execute the LDAP-Tests

The next step is to go into the PHP-Source-directory. Configure and make the source as appropriate.

Before running the LDAP-Tests you need to set some environment-variables:

export LDAP_TEST_PASSWD="password"
export LDAP_TEST_BASE="ou=extldap,dc=nodomain"
export LDAP_TEST_USER="dc=admin,dc=nodomain"
export LDAP_TEST_HOST=192.168.33.10

Now you can run the test-suite by calling "make test". To test only the LDAP-Tests, run "make test TESTS=ext/ldap"

CAVEAT: The current setup does not (yet) test secure connections.


========
OLD README

Most tests here relies on the availability of an LDAP server configured with TLS.

Client/Server configuration:
===========================================================
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 (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:
-----------------------------------------------------------
TLSCACertificateFile /etc/openldap/ssl/server.pem
TLSCertificateFile /etc/openldap/ssl/server.pem
TLSCertificateKeyFile /etc/openldap/ssl/server.pem
TLSVerifyClient never

# hdb is used instead of bdb as it enables the usage of referrals & aliases
database        hdb
suffix          "dc=my-domain,dc=com"
checkpoint      32      30
rootdn          "cn=Manager,dc=my-domain,dc=com"
rootpw          secret
directory       /var/lib/openldap-data
index   objectClass     eq

authz-regexp
	uid=Manager,cn=digest-md5,cn=auth
	cn=Manager,dc=my-domain,dc=com


(/etc/openldap/)ldap.conf:
-----------------------------------------------------------
TLS_REQCERT never

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
LDAP_TEST_OPT_PROTOCOL_VERSION (default: 3)                Version of LDAP protocol to use
LDAP_TEST_SKIP_BIND_FAILURE (default: true)                Whether to fail the test or not in case binding fails

Credits:
===========================================================
Davide Mendolia <idaf1er@gmail.com>
Patrick Allaert <patrick.allaert@gmail.com>
Côme Bernigaud <mcmic@php.net>