Skip to content

ext/ldap: few new unit tests (tls13 protocol). #13409

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions ext/ldap/tests/ldap_set_option_tls_protocol_max_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ foreach([
LDAP_OPT_X_TLS_PROTOCOL_TLS1_0,
LDAP_OPT_X_TLS_PROTOCOL_TLS1_1,
LDAP_OPT_X_TLS_PROTOCOL_TLS1_2,
LDAP_OPT_X_TLS_PROTOCOL_TLS1_3,
] as $option) {
$result = ldap_set_option($link, LDAP_OPT_X_TLS_PROTOCOL_MAX, $option);
var_dump($result);
Expand All @@ -35,5 +34,3 @@ bool(true)
int(770)
bool(true)
int(771)
bool(true)
int(772)
45 changes: 45 additions & 0 deletions ext/ldap/tests/ldap_set_option_tls_protocol_max_basic_tls13.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
--TEST--
ldap_set_option() - Basic test for TLS protocol max ldap option
--CREDITS--
Chad Sikorra <[email protected]>
--EXTENSIONS--
ldap
--SKIPIF--
<?php

if (!defined("LDAP_OPT_X_TLS_PROTOCOL_MAX")) {
die('LDAP_OPT_X_TLS_PROTOCOL_MAX unsupported.');
}
--FILE--
<?php
require "connect.inc";
$link = ldap_connect($uri);

foreach([
LDAP_OPT_X_TLS_PROTOCOL_SSL2,
LDAP_OPT_X_TLS_PROTOCOL_SSL3,
LDAP_OPT_X_TLS_PROTOCOL_TLS1_0,
LDAP_OPT_X_TLS_PROTOCOL_TLS1_1,
LDAP_OPT_X_TLS_PROTOCOL_TLS1_2,
LDAP_OPT_X_TLS_PROTOCOL_TLS1_3,
] as $option) {
$result = ldap_set_option($link, LDAP_OPT_X_TLS_PROTOCOL_MAX, $option);
var_dump($result);

ldap_get_option($link, LDAP_OPT_X_TLS_PROTOCOL_MAX, $optionval);
var_dump($optionval);
}
?>
--EXPECT--
bool(true)
int(512)
bool(true)
int(768)
bool(true)
int(769)
bool(true)
int(770)
bool(true)
int(771)
bool(true)
int(772)
3 changes: 0 additions & 3 deletions ext/ldap/tests/ldap_set_option_tls_protocol_min_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ foreach([
LDAP_OPT_X_TLS_PROTOCOL_TLS1_0,
LDAP_OPT_X_TLS_PROTOCOL_TLS1_1,
LDAP_OPT_X_TLS_PROTOCOL_TLS1_2,
LDAP_OPT_X_TLS_PROTOCOL_TLS1_3,
] as $option) {
$result = ldap_set_option($link, LDAP_OPT_X_TLS_PROTOCOL_MIN, $option);
var_dump($result);
Expand All @@ -35,5 +34,3 @@ bool(true)
int(770)
bool(true)
int(771)
bool(true)
int(772)
45 changes: 45 additions & 0 deletions ext/ldap/tests/ldap_set_option_tls_protocol_min_basic_tls13.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
--TEST--
ldap_set_option() - Basic test for TLS protocol min ldap option
--CREDITS--
Chad Sikorra <[email protected]>
--EXTENSIONS--
ldap
--SKIPIF--
<?php

if (!defined("LDAP_OPT_X_TLS_PROTOCOL_TLS1_3")) {
die('LDAP_OPT_X_TLS_PROTOCOL_TLS1_3 unsupported.');
}
--FILE--
<?php
require "connect.inc";
$link = ldap_connect($uri);

foreach([
LDAP_OPT_X_TLS_PROTOCOL_SSL2,
LDAP_OPT_X_TLS_PROTOCOL_SSL3,
LDAP_OPT_X_TLS_PROTOCOL_TLS1_0,
LDAP_OPT_X_TLS_PROTOCOL_TLS1_1,
LDAP_OPT_X_TLS_PROTOCOL_TLS1_2,
LDAP_OPT_X_TLS_PROTOCOL_TLS1_3,
] as $option) {
$result = ldap_set_option($link, LDAP_OPT_X_TLS_PROTOCOL_MIN, $option);
var_dump($result);

ldap_get_option($link, LDAP_OPT_X_TLS_PROTOCOL_MIN, $optionval);
var_dump($optionval);
}
?>
--EXPECT--
bool(true)
int(512)
bool(true)
int(768)
bool(true)
int(769)
bool(true)
int(770)
bool(true)
int(771)
bool(true)
int(772)