diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:26:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:26:00 +0000 |
commit | 830407e88f9d40d954356c3754f2647f91d5c06a (patch) | |
tree | d6a0ece6feea91f3c656166dbaa884ef8a29740e /tests/config/tls.test.lua | |
parent | Initial commit. (diff) | |
download | knot-resolver-830407e88f9d40d954356c3754f2647f91d5c06a.tar.xz knot-resolver-830407e88f9d40d954356c3754f2647f91d5c06a.zip |
Adding upstream version 5.6.0.upstream/5.6.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/config/tls.test.lua')
-rw-r--r-- | tests/config/tls.test.lua | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/config/tls.test.lua b/tests/config/tls.test.lua new file mode 100644 index 0000000..ef811bb --- /dev/null +++ b/tests/config/tls.test.lua @@ -0,0 +1,29 @@ +local ffi = require('ffi') +ffi.cdef([[ const char * gnutls_check_version (const char * req_version); ]]) + +-- SPDX-License-Identifier: GPL-3.0-or-later +local function test_session_config() + ok(net.tls_sticket_secret(), + 'net.tls_sticket_secret() to trigger key regeneration') + if ffi.C.gnutls_check_version("3.6.3") ~= nil then + ok(net.tls_sticket_secret('0123456789ABCDEF0123456789ABCDEF'), + 'net.tls_sticket_secret with valid key') + end + boom(net.tls_sticket_secret, {{}}, + 'net.tls_sticket_secret({}) is invalid') + boom(net.tls_sticket_secret, {'0123456789ABCDEF0123456789ABCDE'}, + 'net.tls_sticket_secret with too short key') + + boom(net.tls_sticket_secret_file, {}, + 'net.tls_sticket_secret_file without filename') + boom(net.tls_sticket_secret_file, {{}}, + 'net.tls_sticket_secret_file with non-string filename') + boom(net.tls_sticket_secret_file, {'/tmp/a_non_existent_file_REALLY_1528898130'}, + 'net.tls_sticket_secret_file with non-existent filename') + boom(net.tls_sticket_secret_file, {'/dev/null'}, + 'net.tls_sticket_secret_file with empty file') +end + +return { + test_session_config +} |