Skip to content

Commit c54dad8

Browse files
committed
ext/ldap: few new unit tests (tls13 protocol).
1 parent e7b1f2a commit c54dad8

4 files changed

+90
-6
lines changed

ext/ldap/tests/ldap_set_option_tls_protocol_max_basic.phpt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ foreach([
1515
LDAP_OPT_X_TLS_PROTOCOL_TLS1_0,
1616
LDAP_OPT_X_TLS_PROTOCOL_TLS1_1,
1717
LDAP_OPT_X_TLS_PROTOCOL_TLS1_2,
18-
LDAP_OPT_X_TLS_PROTOCOL_TLS1_3,
1918
] as $option) {
2019
$result = ldap_set_option($link, LDAP_OPT_X_TLS_PROTOCOL_MAX, $option);
2120
var_dump($result);
@@ -35,5 +34,3 @@ bool(true)
3534
int(770)
3635
bool(true)
3736
int(771)
38-
bool(true)
39-
int(772)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
--TEST--
2+
ldap_set_option() - Basic test for TLS protocol max ldap option
3+
--CREDITS--
4+
Chad Sikorra <[email protected]>
5+
--EXTENSIONS--
6+
ldap
7+
--SKIPIF--
8+
<?php
9+
10+
if (!defined("LDAP_OPT_X_TLS_PROTOCOL_MAX")) {
11+
die('LDAP_OPT_X_TLS_PROTOCOL_MAX unsupported.');
12+
}
13+
--FILE--
14+
<?php
15+
require "connect.inc";
16+
$link = ldap_connect($uri);
17+
18+
foreach([
19+
LDAP_OPT_X_TLS_PROTOCOL_SSL2,
20+
LDAP_OPT_X_TLS_PROTOCOL_SSL3,
21+
LDAP_OPT_X_TLS_PROTOCOL_TLS1_0,
22+
LDAP_OPT_X_TLS_PROTOCOL_TLS1_1,
23+
LDAP_OPT_X_TLS_PROTOCOL_TLS1_2,
24+
LDAP_OPT_X_TLS_PROTOCOL_TLS1_3,
25+
] as $option) {
26+
$result = ldap_set_option($link, LDAP_OPT_X_TLS_PROTOCOL_MAX, $option);
27+
var_dump($result);
28+
29+
ldap_get_option($link, LDAP_OPT_X_TLS_PROTOCOL_MAX, $optionval);
30+
var_dump($optionval);
31+
}
32+
?>
33+
--EXPECT--
34+
bool(true)
35+
int(512)
36+
bool(true)
37+
int(768)
38+
bool(true)
39+
int(769)
40+
bool(true)
41+
int(770)
42+
bool(true)
43+
int(771)
44+
bool(true)
45+
int(772)

ext/ldap/tests/ldap_set_option_tls_protocol_min_basic.phpt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ foreach([
1515
LDAP_OPT_X_TLS_PROTOCOL_TLS1_0,
1616
LDAP_OPT_X_TLS_PROTOCOL_TLS1_1,
1717
LDAP_OPT_X_TLS_PROTOCOL_TLS1_2,
18-
LDAP_OPT_X_TLS_PROTOCOL_TLS1_3,
1918
] as $option) {
2019
$result = ldap_set_option($link, LDAP_OPT_X_TLS_PROTOCOL_MIN, $option);
2120
var_dump($result);
@@ -35,5 +34,3 @@ bool(true)
3534
int(770)
3635
bool(true)
3736
int(771)
38-
bool(true)
39-
int(772)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
--TEST--
2+
ldap_set_option() - Basic test for TLS protocol min ldap option
3+
--CREDITS--
4+
Chad Sikorra <[email protected]>
5+
--EXTENSIONS--
6+
ldap
7+
--SKIPIF--
8+
<?php
9+
10+
if (!defined("LDAP_OPT_X_TLS_PROTOCOL_TLS1_3")) {
11+
die('LDAP_OPT_X_TLS_PROTOCOL_TLS1_3 unsupported.');
12+
}
13+
--FILE--
14+
<?php
15+
require "connect.inc";
16+
$link = ldap_connect($uri);
17+
18+
foreach([
19+
LDAP_OPT_X_TLS_PROTOCOL_SSL2,
20+
LDAP_OPT_X_TLS_PROTOCOL_SSL3,
21+
LDAP_OPT_X_TLS_PROTOCOL_TLS1_0,
22+
LDAP_OPT_X_TLS_PROTOCOL_TLS1_1,
23+
LDAP_OPT_X_TLS_PROTOCOL_TLS1_2,
24+
LDAP_OPT_X_TLS_PROTOCOL_TLS1_3,
25+
] as $option) {
26+
$result = ldap_set_option($link, LDAP_OPT_X_TLS_PROTOCOL_MIN, $option);
27+
var_dump($result);
28+
29+
ldap_get_option($link, LDAP_OPT_X_TLS_PROTOCOL_MIN, $optionval);
30+
var_dump($optionval);
31+
}
32+
?>
33+
--EXPECT--
34+
bool(true)
35+
int(512)
36+
bool(true)
37+
int(768)
38+
bool(true)
39+
int(769)
40+
bool(true)
41+
int(770)
42+
bool(true)
43+
int(771)
44+
bool(true)
45+
int(772)

0 commit comments

Comments
 (0)