File tree Expand file tree Collapse file tree 2 files changed +57
-3
lines changed Expand file tree Collapse file tree 2 files changed +57
-3
lines changed Original file line number Diff line number Diff line change 9
9
<?php require_once __DIR__ .'/skipifbindfailure.inc ' ; ?>
10
10
--FILE--
11
11
<?php
12
- require "connect.inc " ;
12
+ require_once "connect.inc " ;
13
13
14
+ // CI uses self signed certificate
15
+
16
+ // No cert option - fails
17
+ $ link = ldap_connect ($ uri );
18
+ ldap_set_option ($ link , LDAP_OPT_PROTOCOL_VERSION , $ protocol_version );
19
+ var_dump (@ldap_start_tls ($ link ));
20
+
21
+ // No cert check - passes
14
22
$ link = ldap_connect ($ uri );
15
23
ldap_set_option ($ link , LDAP_OPT_PROTOCOL_VERSION , $ protocol_version );
16
- // CI uses self signed certificate
17
24
ldap_set_option ($ link , LDAP_OPT_X_TLS_REQUIRE_CERT , LDAP_OPT_X_TLS_NEVER );
18
- var_dump (ldap_start_tls ($ link ));
25
+ var_dump (@ldap_start_tls ($ link ));
26
+
27
+ // With cert check - fails
28
+ $ link = ldap_connect ($ uri );
29
+ ldap_set_option ($ link , LDAP_OPT_PROTOCOL_VERSION , $ protocol_version );
30
+ ldap_set_option ($ link , LDAP_OPT_X_TLS_REQUIRE_CERT , LDAP_OPT_X_TLS_DEMAND );
31
+ var_dump (@ldap_start_tls ($ link ));
19
32
?>
20
33
--EXPECT--
34
+ bool(false)
21
35
bool(true)
36
+ bool(false)
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ ldap_connect() - Basic ldaps test
3
+ --EXTENSIONS--
4
+ ldap
5
+ --SKIPIF--
6
+ <?php require_once __DIR__ .'/skipifbindfailure.inc ' ; ?>
7
+ --FILE--
8
+ <?php
9
+ require_once "connect.inc " ;
10
+
11
+ $ uri = "ldaps:// $ host " ;
12
+
13
+ // CI uses self signed certificate
14
+
15
+ // No cert option - fails
16
+ $ link = ldap_connect ($ uri );
17
+ ldap_set_option ($ link , LDAP_OPT_PROTOCOL_VERSION , $ protocol_version );
18
+ var_dump (@ldap_bind ($ link , $ user , $ passwd ));
19
+ ldap_unbind ($ link );
20
+
21
+ // No cert check - passes
22
+ ldap_set_option (null , LDAP_OPT_X_TLS_REQUIRE_CERT , LDAP_OPT_X_TLS_ALLOW );
23
+ $ link = ldap_connect ($ uri );
24
+ ldap_set_option ($ link , LDAP_OPT_PROTOCOL_VERSION , $ protocol_version );
25
+ var_dump (@ldap_bind ($ link , $ user , $ passwd ));
26
+ ldap_unbind ($ link );
27
+
28
+ // With cert check - fails
29
+ ldap_set_option (null , LDAP_OPT_X_TLS_REQUIRE_CERT , LDAP_OPT_X_TLS_DEMAND );
30
+ $ link = ldap_connect ($ uri );
31
+ ldap_set_option ($ link , LDAP_OPT_PROTOCOL_VERSION , $ protocol_version );
32
+ var_dump (@ldap_bind ($ link , $ user , $ passwd ));
33
+ ldap_unbind ($ link );
34
+
35
+ ?>
36
+ --EXPECT--
37
+ bool(false)
38
+ bool(true)
39
+ bool(false)
You can’t perform that action at this time.
0 commit comments