diff options
author | Paweł Tomulik <ptomulik@meil.pw.edu.pl> | 2020-07-03 12:50:40 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-07-10 09:56:02 +0200 |
commit | c6ab3084df3abb5f1af1d2efc09799b9b00ce052 (patch) | |
tree | 619a7104ef47e9eb46ef347ef8c6485386eee198 | |
parent | 22352868ec12330e3c0b4568292f3335d22e9e43 (diff) | |
download | php-git-c6ab3084df3abb5f1af1d2efc09799b9b00ce052.tar.gz |
fix some ext/ldap/tests
-rw-r--r-- | ext/ldap/tests/connect.inc | 3 | ||||
-rw-r--r-- | ext/ldap/tests/ldap_sasl_bind_basic.phpt | 13 | ||||
-rw-r--r-- | ext/ldap/tests/ldap_sasl_bind_error.phpt | 21 |
3 files changed, 30 insertions, 7 deletions
diff --git a/ext/ldap/tests/connect.inc b/ext/ldap/tests/connect.inc index de41cca63c..101895c33d 100644 --- a/ext/ldap/tests/connect.inc +++ b/ext/ldap/tests/connect.inc @@ -9,8 +9,9 @@ $host = getenv("LDAP_TEST_HOST") ?: "localhost"; $port = getenv("LDAP_TEST_PORT") ?: 389; $base = getenv("LDAP_TEST_BASE") ?: "dc=my-domain,dc=com"; $user = getenv("LDAP_TEST_USER") ?: "cn=Manager,$base"; -$sasl_user = getenv("LDAP_TEST_SASL_USER") ?: "Manager"; $passwd = getenv("LDAP_TEST_PASSWD") ?: "secret"; +$sasl_user = getenv("LDAP_TEST_SASL_USER") ?: "userA"; +$sasl_passwd = getenv("LDAP_TEST_SASL_PASSWD") ?: "oops"; $protocol_version = getenv("LDAP_TEST_OPT_PROTOCOL_VERSION") ?: 3; $skip_on_bind_failure = getenv("LDAP_TEST_SKIP_BIND_FAILURE") ?: true; diff --git a/ext/ldap/tests/ldap_sasl_bind_basic.phpt b/ext/ldap/tests/ldap_sasl_bind_basic.phpt index 49c2f24a67..d85cd73a5c 100644 --- a/ext/ldap/tests/ldap_sasl_bind_basic.phpt +++ b/ext/ldap/tests/ldap_sasl_bind_basic.phpt @@ -17,11 +17,22 @@ Patrick Allaert <patrickallaert@php.net> <?php require "connect.inc"; +$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); +insert_dummy_data($link, $base); +ldap_unbind($link); + $link = ldap_connect($host, $port); ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); -var_dump(ldap_sasl_bind($link, null, $passwd, 'DIGEST-MD5', 'realm', $sasl_user)); +var_dump(ldap_sasl_bind($link, null, $sasl_passwd, 'DIGEST-MD5', 'realm', $sasl_user)); ?> ===DONE=== +--CLEAN-- +<?php +include "connect.inc"; + +$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); +remove_dummy_data($link, $base); +?> --EXPECT-- bool(true) ===DONE=== diff --git a/ext/ldap/tests/ldap_sasl_bind_error.phpt b/ext/ldap/tests/ldap_sasl_bind_error.phpt index 180066bb2c..8e2e5e1d13 100644 --- a/ext/ldap/tests/ldap_sasl_bind_error.phpt +++ b/ext/ldap/tests/ldap_sasl_bind_error.phpt @@ -11,6 +11,10 @@ Patrick Allaert <patrickallaert@php.net> <?php require "connect.inc"; +$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); +insert_dummy_data($link, $base); +ldap_unbind($link); + $link = ldap_connect($host, $port); ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); @@ -18,20 +22,27 @@ ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); var_dump(ldap_sasl_bind()); // Invalid DN -var_dump(ldap_sasl_bind($link, "Invalid DN", $passwd, 'DIGEST-MD5', 'realm', $sasl_user)); +var_dump(ldap_sasl_bind($link, "Invalid DN", $sasl_passwd, 'DIGEST-MD5', 'realm', $sasl_user)); // Invalid user -var_dump(ldap_sasl_bind($link, null, "ThisIsNotCorrect$passwd", 'DIGEST-MD5', "realm", "invalid$sasl_user")); +var_dump(ldap_sasl_bind($link, null, "ThisIsNotCorrect$sasl_passwd", 'DIGEST-MD5', "realm", "invalid$sasl_user")); // Invalid password -var_dump(ldap_sasl_bind($link, null, "ThisIsNotCorrect$passwd", 'DIGEST-MD5', "realm", $sasl_user)); +var_dump(ldap_sasl_bind($link, null, "ThisIsNotCorrect$sasl_passwd", 'DIGEST-MD5', "realm", $sasl_user)); -var_dump(ldap_sasl_bind($link, null, $passwd, 'DIGEST-MD5', "realm", "Manager", "test")); +var_dump(ldap_sasl_bind($link, null, $sasl_passwd, 'DIGEST-MD5', "realm", "Manager", "test")); // Invalid DN syntax -var_dump(ldap_sasl_bind($link, "unexistingProperty=weirdValue,$user", $passwd)); +var_dump(ldap_sasl_bind($link, "unexistingProperty=weirdValue,$user", $sasl_passwd)); ?> ===DONE=== +--CLEAN-- +<?php +include "connect.inc"; + +$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); +remove_dummy_data($link, $base); +?> --EXPECTF-- Warning: ldap_sasl_bind() expects at least 1 parameter, 0 given in %s on line %d bool(false) |