From 2368f4bbfc12e0dedc869c732662212f72f0c5ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Musab=20K=C4=B1l=C4=B1=C3=A7?= Date: Wed, 29 May 2024 16:19:26 +0200 Subject: [PATCH] Bug#115056 ssl_session_cache_timeout max value is set to 84600 instead of 86400s(1 day) ssl_session_cache_timeout system variable could only take values between 0-84600, and it is stated this is equivalent to the number of seconds in a day both in the code and the documentation. However, this is a typo as the correct number should be 86400. --- .../r/ssl_session_cache_timeout_basic.result | 6 ++--- .../t/ssl_session_cache_timeout_basic.test | 4 ++-- router/src/routing/src/plugin_config.cc | 2 +- router/tests/component/test_routing.cc | 24 +++++++++---------- sql/ssl_init_callback.cc | 4 ++-- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/mysql-test/suite/sys_vars/r/ssl_session_cache_timeout_basic.result b/mysql-test/suite/sys_vars/r/ssl_session_cache_timeout_basic.result index 82ef072fc02..242037cbc43 100644 --- a/mysql-test/suite/sys_vars/r/ssl_session_cache_timeout_basic.result +++ b/mysql-test/suite/sys_vars/r/ssl_session_cache_timeout_basic.result @@ -52,15 +52,15 @@ ERROR HY000: Variable 'ssl_session_cache_timeout' is a GLOBAL variable # Set value to min SET @@GLOBAL.ssl_session_cache_timeout = 0; # Set value to max -SET @@GLOBAL.ssl_session_cache_timeout = 84600; +SET @@GLOBAL.ssl_session_cache_timeout = 86400; # Set value below min SET @@GLOBAL.ssl_session_cache_timeout = -1; Warnings: Warning 1292 Truncated incorrect ssl_session_cache_timeout value: '-1' # Set value above max -SET @@GLOBAL.ssl_session_cache_timeout = 84600 + 1; +SET @@GLOBAL.ssl_session_cache_timeout = 86400 + 1; Warnings: -Warning 1292 Truncated incorrect ssl_session_cache_timeout value: '84601' +Warning 1292 Truncated incorrect ssl_session_cache_timeout value: '86400' # expect to be able to set it with step of 1 SET @@GLOBAL.ssl_session_cache_timeout = 300; SET @@GLOBAL.ssl_session_cache_timeout = 301; diff --git a/mysql-test/suite/sys_vars/t/ssl_session_cache_timeout_basic.test b/mysql-test/suite/sys_vars/t/ssl_session_cache_timeout_basic.test index b0237c5c8b6..6590cd6c30a 100644 --- a/mysql-test/suite/sys_vars/t/ssl_session_cache_timeout_basic.test +++ b/mysql-test/suite/sys_vars/t/ssl_session_cache_timeout_basic.test @@ -61,7 +61,7 @@ SET @@GLOBAL.ssl_session_cache_timeout = 0; # expect success --echo # Set value to max -SET @@GLOBAL.ssl_session_cache_timeout = 84600; +SET @@GLOBAL.ssl_session_cache_timeout = 86400; # expect success --echo # Set value below min @@ -69,7 +69,7 @@ SET @@GLOBAL.ssl_session_cache_timeout = -1; # expect warning --echo # Set value above max -SET @@GLOBAL.ssl_session_cache_timeout = 84600 + 1; +SET @@GLOBAL.ssl_session_cache_timeout = 86400 + 1; # expect warning --echo # expect to be able to set it with step of 1 diff --git a/router/src/routing/src/plugin_config.cc b/router/src/routing/src/plugin_config.cc index ff1d0a55379..9eb0efe6613 100644 --- a/router/src/routing/src/plugin_config.cc +++ b/router/src/routing/src/plugin_config.cc @@ -510,7 +510,7 @@ RoutingPluginConfig::RoutingPluginConfig( GET_OPTION_CHECKED(dest_ssl_curves, section, "server_ssl_curves", StringOption{}); auto ssl_session_cache_size_op = IntOption{1, 0x7fffffff}; - auto ssl_session_cache_timeout_op = IntOption{0, 84600}; + auto ssl_session_cache_timeout_op = IntOption{0, 86400}; GET_OPTION_CHECKED(client_ssl_session_cache_mode, section, "client_ssl_session_cache_mode", BoolOption{}); GET_OPTION_CHECKED(client_ssl_session_cache_size, section, diff --git a/router/tests/component/test_routing.cc b/router/tests/component/test_routing.cc index 1ca848a82ed..a09e8993a5d 100644 --- a/router/tests/component/test_routing.cc +++ b/router/tests/component/test_routing.cc @@ -2799,23 +2799,23 @@ INSTANTIATE_TEST_SUITE_P( /* client_ssl_session_cache_timeout */ "-1", std::nullopt, std::nullopt, std::nullopt}, "Configuration error: option client_ssl_session_cache_timeout in " - "[routing:classic] needs value between 0 and 84600 inclusive, " + "[routing:classic] needs value between 0 and 86400 inclusive, " "was '-1'"}, SessionReuseInvalidOptionValueParam{ "client_ssl_session_cache_timeout_out_of_range", {std::nullopt, std::nullopt, - /* client_ssl_session_cache_timeout */ "84601", std::nullopt, + /* client_ssl_session_cache_timeout */ "86401", std::nullopt, std::nullopt, std::nullopt}, "Configuration error: option client_ssl_session_cache_timeout in " - "[routing:classic] needs value between 0 and 84600 inclusive, " - "was '84601'"}, + "[routing:classic] needs value between 0 and 86400 inclusive, " + "was '86401'"}, SessionReuseInvalidOptionValueParam{ "client_ssl_session_cache_timeout_not_integer", {std::nullopt, std::nullopt, /* client_ssl_session_cache_timeout */ "a", std::nullopt, std::nullopt, std::nullopt}, "Configuration error: option client_ssl_session_cache_timeout in " - "[routing:classic] needs value between 0 and 84600 inclusive, " + "[routing:classic] needs value between 0 and 86400 inclusive, " "was 'a'"}, SessionReuseInvalidOptionValueParam{ "client_ssl_session_cache_timeout_special_character", @@ -2823,7 +2823,7 @@ INSTANTIATE_TEST_SUITE_P( /* client_ssl_session_cache_timeout */ "$", std::nullopt, std::nullopt, std::nullopt}, "Configuration error: option client_ssl_session_cache_timeout in " - "[routing:classic] needs value between 0 and 84600 inclusive, " + "[routing:classic] needs value between 0 and 86400 inclusive, " "was '$'"}, // server @@ -2894,28 +2894,28 @@ INSTANTIATE_TEST_SUITE_P( {std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt, /* server_ssl_session_cache_timeout */ "-1"}, "Configuration error: option server_ssl_session_cache_timeout in " - "[routing:classic] needs value between 0 and 84600 inclusive, " + "[routing:classic] needs value between 0 and 86400 inclusive, " "was '-1'"}, SessionReuseInvalidOptionValueParam{ "server_ssl_session_cache_timeout_out_of_range", {std::nullopt, std::nullopt, std::nullopt, std::nullopt, - std::nullopt, /* server_ssl_session_cache_timeout */ "84601"}, + std::nullopt, /* server_ssl_session_cache_timeout */ "86401"}, "Configuration error: option server_ssl_session_cache_timeout in " - "[routing:classic] needs value between 0 and 84600 inclusive, " - "was '84601"}, + "[routing:classic] needs value between 0 and 86400 inclusive, " + "was '86401"}, SessionReuseInvalidOptionValueParam{ "server_ssl_session_cache_timeout_not_integer", {std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt, /* server_ssl_session_cache_timeout */ "a"}, "Configuration error: option server_ssl_session_cache_timeout in " - "[routing:classic] needs value between 0 and 84600 inclusive, " + "[routing:classic] needs value between 0 and 86400 inclusive, " "was 'a'"}, SessionReuseInvalidOptionValueParam{ "server_ssl_session_cache_timeout_special_character", {std::nullopt, std::nullopt, std::nullopt, std::nullopt, std::nullopt, /* server_ssl_session_cache_timeout */ "$"}, "Configuration error: option server_ssl_session_cache_timeout in " - "[routing:classic] needs value between 0 and 84600 inclusive, " + "[routing:classic] needs value between 0 and 86400 inclusive, " "was '$"}), [](const ::testing::TestParamInfo &info) { return info.param.test_name; }); diff --git a/sql/ssl_init_callback.cc b/sql/ssl_init_callback.cc index 816106052cd..47da4c883ab 100644 --- a/sql/ssl_init_callback.cc +++ b/sql/ssl_init_callback.cc @@ -216,13 +216,13 @@ static Sys_var_bool Sys_var_opt_ssl_session_cache_mode( PERSIST_AS_READONLY GLOBAL_VAR(opt_ssl_session_cache_mode), CMD_LINE(OPT_ARG), DEFAULT(true), PFS_TRAILING_PROPERTIES); -/* 84600 is 1 day in seconds */ +/* 86400 is 1 day in seconds */ static Sys_var_long Sys_var_opt_ssl_session_cache_timeout( "ssl_session_cache_timeout", "The timeout to expire sessions in the TLS session cache", PERSIST_AS_READONLY GLOBAL_VAR(opt_ssl_session_cache_timeout), CMD_LINE(REQUIRED_ARG, OPT_SSL_SESSION_CACHE_TIMEOUT), - VALID_RANGE(0, 84600), DEFAULT(300), BLOCK_SIZE(1), + VALID_RANGE(0, 86400), DEFAULT(300), BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES); /* Related to admin connection port */ -- 2.35.2.windows.1