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

This commit is contained in:
David CARLIER 2024-02-16 18:26:08 +00:00 committed by GitHub
parent 492b9e09e9
commit 09415077f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 90 additions and 6 deletions

View File

@ -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);
@ -35,5 +34,3 @@ bool(true)
int(770)
bool(true)
int(771)
bool(true)
int(772)

View File

@ -0,0 +1,45 @@
--TEST--
ldap_set_option() - Basic test for TLS protocol max ldap option
--CREDITS--
Chad Sikorra <Chad.Sikorra@gmail.com>
--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)

View File

@ -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);
@ -35,5 +34,3 @@ bool(true)
int(770)
bool(true)
int(771)
bool(true)
int(772)

View File

@ -0,0 +1,45 @@
--TEST--
ldap_set_option() - Basic test for TLS protocol min ldap option
--CREDITS--
Chad Sikorra <Chad.Sikorra@gmail.com>
--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)