summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-07-10 09:57:13 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-07-10 09:57:13 +0200
commitbc68f10b7624f76707188e56371bcbdd43f8b8bc (patch)
treec230c120cfb8a989a35f92fab2bba149100717fd /ext
parentbee2cf089935cd87326390bf5639608376da093c (diff)
parentb291c926937fdcf3635a8aa3b83571f591c8c022 (diff)
downloadphp-git-bc68f10b7624f76707188e56371bcbdd43f8b8bc.tar.gz
Merge branch 'PHP-7.4'
* PHP-7.4: enable ext/ldap/tests on azure fix some ext/ldap/tests
Diffstat (limited to 'ext')
-rw-r--r--ext/ldap/tests/CONFLICTS1
-rw-r--r--ext/ldap/tests/connect.inc3
-rw-r--r--ext/ldap/tests/ldap_sasl_bind_basic.phpt13
-rw-r--r--ext/ldap/tests/ldap_sasl_bind_error.phpt21
4 files changed, 31 insertions, 7 deletions
diff --git a/ext/ldap/tests/CONFLICTS b/ext/ldap/tests/CONFLICTS
new file mode 100644
index 0000000000..c1142c3c5c
--- /dev/null
+++ b/ext/ldap/tests/CONFLICTS
@@ -0,0 +1 @@
+ldap
diff --git a/ext/ldap/tests/connect.inc b/ext/ldap/tests/connect.inc
index bd6a144d2e..e3a9d1c777 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 d447572e09..3ab977b854 100644
--- a/ext/ldap/tests/ldap_sasl_bind_basic.phpt
+++ b/ext/ldap/tests/ldap_sasl_bind_basic.phpt
@@ -17,9 +17,20 @@ 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));
+?>
+--CLEAN--
+<?php
+include "connect.inc";
+
+$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
+remove_dummy_data($link, $base);
?>
--EXPECT--
bool(true)
diff --git a/ext/ldap/tests/ldap_sasl_bind_error.phpt b/ext/ldap/tests/ldap_sasl_bind_error.phpt
index eb68370ff6..53a84eae1a 100644
--- a/ext/ldap/tests/ldap_sasl_bind_error.phpt
+++ b/ext/ldap/tests/ldap_sasl_bind_error.phpt
@@ -11,22 +11,33 @@ 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);
// 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));
+?>
+--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(): Unable to bind to server: Invalid DN syntax in %s on line %d