php-src/ext/ldap/tests
2021-03-16 09:31:37 +01:00
..
bug48441.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
bug72021.phpt Make LDAP_ESCAPE_DN compliant with RFC 4514 2016-06-25 21:16:45 -05:00
bug73933.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
bug77958.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
CONFLICTS enable ext/ldap/tests on azure 2020-07-10 09:56:02 +02:00
connect.inc Merge branch 'PHP-7.4' 2020-07-10 09:57:13 +02:00
ldap_add_basic.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_add_error.phpt Promote warnings to exceptions in ext/ldap 2020-09-04 15:26:16 +02:00
ldap_add_ext.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_bind_basic.phpt Clean DONE tags from tests 2019-11-07 21:31:47 +01:00
ldap_bind_error.phpt Clean DONE tags from tests 2019-11-07 21:31:47 +01:00
ldap_bind_ext.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_bind_variation.phpt Clean DONE tags from tests 2019-11-07 21:31:47 +01:00
ldap_compare_basic.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_compare_error.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_connect_basic.phpt Clean DONE tags from tests 2019-11-07 21:31:47 +01:00
ldap_connect_error.phpt Clean DONE tags from tests 2019-11-07 21:31:47 +01:00
ldap_connect_ldap_conf.phpt Clean DONE tags from tests 2019-11-07 21:31:47 +01:00
ldap_connect_variation.phpt Clean DONE tags from tests 2019-11-07 21:31:47 +01:00
ldap_controls.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_count_entries_basic.phpt Clean DONE tags from tests 2019-11-07 21:31:47 +01:00
ldap_count_references_basic.phpt Add ldap_count_references() 2020-07-01 09:29:46 +02:00
ldap_delete_basic.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_delete_error.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_delete_ext.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_dn2ufn.phpt Remove ldap zpp tests 2019-06-11 10:09:40 +02:00
ldap_err2str_basic.phpt Clean DONE tags from tests 2019-11-07 21:31:47 +01:00
ldap_errno_basic.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_error_basic.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_escape_all.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:33:09 +02:00
ldap_escape_both.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:33:09 +02:00
ldap_escape_dn.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:33:09 +02:00
ldap_escape_filter.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:33:09 +02:00
ldap_escape_ignore.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:33:09 +02:00
ldap_exop_passwd_error.phpt Clean DONE tags from tests 2019-11-07 21:31:47 +01:00
ldap_exop_passwd.phpt Clean DONE tags from tests 2019-11-07 21:31:47 +01:00
ldap_exop_refresh.phpt Run tidy 2020-09-18 14:28:32 +02:00
ldap_exop_whoami.phpt Clean DONE tags from tests 2019-11-07 21:31:47 +01:00
ldap_exop.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_explode_dn.phpt Replace EXPECTF when possible 2020-06-29 21:31:44 +02:00
ldap_first_attribute_basic.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_first_attribute_error.phpt Clean DONE tags from tests 2019-11-07 21:31:47 +01:00
ldap_first_entry_basic.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_first_reference_basic.phpt Clean DONE tags from tests 2019-11-07 21:31:47 +01:00
ldap_free_result_basic.phpt Clean DONE tags from tests 2019-11-07 21:31:47 +01:00
ldap_get_attributes_basic.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_get_dn_basic.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_get_entries_basic.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_get_entries_variation.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_get_option_basic.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_get_option_controls.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_get_option_package_basic.phpt Clean DONE tags from tests 2019-11-07 21:31:47 +01:00
ldap_get_option_variation.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_get_values_len_basic.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_get_values_len_error.phpt Clean DONE tags from tests 2019-11-07 21:31:47 +01:00
ldap_list_basic.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_mod_add_basic.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_mod_add_error.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_mod_del_basic.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_mod_del_error.phpt Clean DONE tags from tests 2019-11-07 21:31:47 +01:00
ldap_mod_ext.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_mod_replace_basic.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_mod_replace_error.phpt Clean DONE tags from tests 2019-11-07 21:31:47 +01:00
ldap_modify_basic.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_modify_batch_basic.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_modify_batch_error.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_modify_error.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_next_attribute_basic.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_next_attribute_error.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_next_entry_basic.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_next_reference_basic.phpt Clean DONE tags from tests 2019-11-07 21:31:47 +01:00
ldap_option_reqcert_basic.phpt Run tidy 2020-09-18 14:28:32 +02:00
ldap_option_reqcert_error.phpt Run tidy 2020-09-18 14:28:32 +02:00
ldap_parse_reference_basic.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_parse_result_basic.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_parse_result_controls.phpt Remove deprecated functions from php-ldap 2020-10-01 10:15:27 +02:00
ldap_read_basic.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_read_variation1.phpt Merge branch 'PHP-7.4' 2019-10-01 11:19:43 +02:00
ldap_rename_basic.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_rename_error.phpt Remove ldap zpp tests 2019-06-11 10:09:40 +02:00
ldap_rename_ext.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_sasl_bind_basic.phpt Run tidy 2020-09-18 14:28:32 +02:00
ldap_sasl_bind_error.phpt Merge branch 'PHP-7.4' 2020-07-10 09:57:13 +02:00
ldap_search_basic.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_search_error.phpt Fix crash in LDAP search functions during argument validation 2021-03-16 09:31:37 +01:00
ldap_search_overrides.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_search_paged_result_controls.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_search_sort_controls.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_search_variation1.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_search_variation2.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_search_variation3.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_search_variation4.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_search_variation5.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_search_variation6.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_set_option_basic.phpt Clean DONE tags from tests 2019-11-07 21:31:47 +01:00
ldap_set_option_cafiles_basic.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_set_option_ciphersuite_basic.phpt Clean DONE tags from tests 2019-11-07 21:31:47 +01:00
ldap_set_option_crlcheck_basic.phpt Run tidy 2020-09-18 14:28:32 +02:00
ldap_set_option_crlcheck_error.phpt Clean DONE tags from tests 2019-11-07 21:31:47 +01:00
ldap_set_option_error.phpt Rename $link parameters to $ldap in ldap functions 2020-09-29 16:31:08 +02:00
ldap_set_option_keepalive_basic.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_set_option_reqcert_basic.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_set_option_reqcert_error.phpt Clean DONE tags from tests 2019-11-07 21:31:47 +01:00
ldap_set_option_tls_protocol_min_basic.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_set_option_variation.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
ldap_set_rebind_proc_basic.phpt Promote warning to exception in ldap_set_rebind_proc() 2020-06-30 16:08:34 +02:00
ldap_set_rebind_proc_error.phpt Run tidy 2020-09-18 14:28:32 +02:00
ldap_start_tls_basic.phpt Clean DONE tags from tests 2019-11-07 21:31:47 +01:00
ldap_unbind_basic.phpt Clean DONE tags from tests 2019-11-07 21:31:47 +01:00
ldap_unbind_variation.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
README.md Fix miscellaneous typos in docs 2019-10-19 19:19:28 +02:00
skipif.inc Reindent phpt files 2020-02-03 22:52:20 +01:00
skipifbindfailure.inc Reindent phpt files 2020-02-03 22:52:20 +01:00
skipifcontrol.inc Reindent phpt files 2020-02-03 22:52:20 +01:00

The ldap extension tests

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

Prerequisites

You will need vagrant on your box.

Usage

To use it follow these steps:

  • Create a Vagrantfile 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 incoming 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 rely 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