初始提交:terminalX 可运行态(M0/M1/M1.5 已真机验证)
- M0: libghostty SSH 终端(渲染/输入/连接)+ 白屏修复(OutputGate) + 会话状态机/自动重连 - M1: tsnet 用户态组网 + SSH-over-tsnet(fd 桥),shell 级真机验证;R5(Go+gvisor+C+++Swift 同进程) retire - M1.5: tmux -CC 原生 tab(MVP) - 结构: packages/(TXCore·TXTransport), apps/TerminalX, vendor/(libghostty-spm/libssh2/mbedtls/tsnet-bridge), artifacts/ - 文档: CLAUDE.md + docs/HANDOFF.md(新会话入口) - 环境: 认证代理→依赖 vendor 本地化;Go 在 ~/.local/go;仅模拟器/未签名 - 待续: M2 mosh, tmux 多 pane, M4 安全(host key/SE) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
7
vendor/libssh2/tests/.gitignore
vendored
Normal file
7
vendor/libssh2/tests/.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
.deps
|
||||
.libs
|
||||
*.gcno
|
||||
*.gcda
|
||||
Makefile
|
||||
Makefile.in
|
||||
Makefile.inc.cmake
|
||||
178
vendor/libssh2/tests/CMakeLists.txt
vendored
Normal file
178
vendor/libssh2/tests/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
# Copyright (C) Alexander Lamaison <alexander.lamaison@gmail.com>
|
||||
# Copyright (C) Viktor Szakats
|
||||
#
|
||||
# Redistribution and use in source and binary forms,
|
||||
# with or without modification, are permitted provided
|
||||
# that the following conditions are met:
|
||||
#
|
||||
# Redistributions of source code must retain the above
|
||||
# copyright notice, this list of conditions and the
|
||||
# following disclaimer.
|
||||
#
|
||||
# Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# Neither the name of the copyright holder nor the names
|
||||
# of any other contributors may be used to endorse or
|
||||
# promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
# OF SUCH DAMAGE.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
include(CopyRuntimeDependencies)
|
||||
|
||||
list(APPEND LIBSSH2_LIBS ${LIBSSH2_LIBS_SOCKET})
|
||||
|
||||
transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
|
||||
# Get 'DOCKER_TESTS', 'DOCKER_TESTS_STATIC', 'STANDALONE_TESTS', 'STANDALONE_TESTS_STATIC', 'SSHD_TESTS',
|
||||
# 'librunner_la_SOURCES' variables
|
||||
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
|
||||
list(APPEND DOCKER_TESTS ${DOCKER_TESTS_STATIC})
|
||||
list(APPEND STANDALONE_TESTS ${STANDALONE_TESTS_STATIC})
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
find_program(GCOV_PATH "gcov")
|
||||
if(GCOV_PATH)
|
||||
set(_gcov_cflags "-g" "--coverage")
|
||||
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
|
||||
set(_gcov_cflags "${_gcov_cflags} -fprofile-abs-path")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(RUN_SSHD_TESTS "Run tests requiring sshd" ON)
|
||||
|
||||
find_program(SH_EXECUTABLE "sh")
|
||||
mark_as_advanced(SH_EXECUTABLE)
|
||||
if(SH_EXECUTABLE)
|
||||
if(RUN_SSHD_TESTS)
|
||||
find_program(SSHD_EXECUTABLE "sshd")
|
||||
mark_as_advanced(SSHD_EXECUTABLE)
|
||||
endif()
|
||||
|
||||
add_test(NAME mansyntax COMMAND ${SH_EXECUTABLE} -c "${CMAKE_CURRENT_SOURCE_DIR}/mansyntax.sh")
|
||||
endif()
|
||||
|
||||
add_library(runner STATIC ${librunner_la_SOURCES})
|
||||
target_compile_definitions(runner PRIVATE "${CRYPTO_BACKEND_DEFINE}")
|
||||
target_include_directories(runner PRIVATE
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../src"
|
||||
"../src"
|
||||
"../include"
|
||||
"${CRYPTO_BACKEND_INCLUDE_DIR}")
|
||||
target_link_libraries(runner PRIVATE libssh2)
|
||||
|
||||
foreach(_test IN LISTS DOCKER_TESTS STANDALONE_TESTS SSHD_TESTS)
|
||||
if(NOT ";${DOCKER_TESTS_STATIC};${STANDALONE_TESTS_STATIC};" MATCHES ";${_test};")
|
||||
set(_lib_for_tests ${LIB_SELECTED})
|
||||
elseif(TARGET ${LIB_STATIC})
|
||||
set(_lib_for_tests ${LIB_STATIC})
|
||||
else()
|
||||
unset(_lib_for_tests)
|
||||
message(STATUS "Skip test requiring static libssh2 lib: ${_test}")
|
||||
endif()
|
||||
|
||||
# We support the same target as both Docker and SSHD test. Build those just once.
|
||||
# Skip building tests that require the static lib when the static lib is disabled.
|
||||
if(NOT TARGET ${_test} AND _lib_for_tests)
|
||||
add_executable(${_test} "${_test}.c")
|
||||
target_compile_definitions(${_test} PRIVATE "${CRYPTO_BACKEND_DEFINE}")
|
||||
target_include_directories(${_test} PRIVATE
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../src"
|
||||
"../src"
|
||||
"../include"
|
||||
"${CRYPTO_BACKEND_INCLUDE_DIR}")
|
||||
set_target_properties(${_test} PROPERTIES UNITY_BUILD OFF)
|
||||
|
||||
# build a single test with gcov
|
||||
if(GCOV_PATH AND _test STREQUAL "test_auth_keyboard_info_request" AND TARGET ${LIB_STATIC})
|
||||
target_compile_options(${_test} BEFORE PRIVATE ${_gcov_cflags})
|
||||
target_link_libraries(${_test} runner ${_lib_for_tests} ${LIBSSH2_LIBS} "gcov")
|
||||
else()
|
||||
target_link_libraries(${_test} runner ${_lib_for_tests} ${LIBSSH2_LIBS})
|
||||
endif()
|
||||
|
||||
list(APPEND TEST_TARGETS ${_test})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
option(RUN_DOCKER_TESTS "Run tests requiring Docker" ON)
|
||||
|
||||
if(RUN_DOCKER_TESTS)
|
||||
foreach(_test IN LISTS DOCKER_TESTS)
|
||||
if(TARGET ${_test})
|
||||
add_test(NAME ${_test} COMMAND "$<TARGET_FILE:${_test}>")
|
||||
set_property(TEST ${_test} APPEND PROPERTY ENVIRONMENT "srcdir=${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
foreach(_test IN LISTS STANDALONE_TESTS)
|
||||
if(TARGET ${_test})
|
||||
add_test(NAME ${_test} COMMAND "$<TARGET_FILE:${_test}>")
|
||||
set_property(TEST ${_test} APPEND PROPERTY ENVIRONMENT "srcdir=${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(RUN_SSHD_TESTS AND SSHD_EXECUTABLE)
|
||||
unset(_sshd_test_targets)
|
||||
foreach(_test IN LISTS SSHD_TESTS)
|
||||
if(TARGET ${_test})
|
||||
set(_sshd_test_targets "${_sshd_test_targets} $<TARGET_FILE:${_test}>")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(_sshd_test_targets)
|
||||
add_test(NAME test_sshd COMMAND ${SH_EXECUTABLE} -c "${CMAKE_CURRENT_SOURCE_DIR}/test_sshd.test ${_sshd_test_targets}")
|
||||
set_property(TEST test_sshd APPEND PROPERTY ENVIRONMENT "srcdir=${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set_property(TEST test_sshd APPEND PROPERTY ENVIRONMENT "SSHD=${SSHD_EXECUTABLE}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(RUN_DOCKER_TESTS)
|
||||
# CRYPT/MAC algo tests
|
||||
file(READ "test_read_algos.txt" _algo_tests)
|
||||
string(REGEX REPLACE "\\\n" ";" _algo_tests ${_algo_tests})
|
||||
foreach(_test IN LISTS _algo_tests)
|
||||
if(_test)
|
||||
set(_testname "test_read-${_test}")
|
||||
add_test(NAME ${_testname} COMMAND "$<TARGET_FILE:test_read>")
|
||||
set_property(TEST ${_testname} APPEND PROPERTY ENVIRONMENT "srcdir=${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
if(_test MATCHES "mac-")
|
||||
set_property(TEST ${_testname} APPEND PROPERTY ENVIRONMENT "FIXTURE_TEST_MAC=${_test}")
|
||||
else()
|
||||
set_property(TEST ${_testname} APPEND PROPERTY ENVIRONMENT "FIXTURE_TEST_CRYPT=${_test}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
add_custom_target(coverage
|
||||
COMMAND gcovr --root "${PROJECT_SOURCE_DIR}" --exclude tests/*
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/coverage"
|
||||
COMMAND gcovr --root "${PROJECT_SOURCE_DIR}" --exclude tests/* --html-details --output "${CMAKE_CURRENT_BINARY_DIR}/coverage/index.html")
|
||||
|
||||
add_custom_target(clean-coverage
|
||||
COMMAND rm -rf "${CMAKE_CURRENT_BINARY_DIR}/coverage")
|
||||
|
||||
add_target_to_copy_dependencies(
|
||||
TARGET copy_test_dependencies
|
||||
DEPENDENCIES ${RUNTIME_DEPENDENCIES}
|
||||
BEFORE_TARGETS ${TEST_TARGETS})
|
||||
55
vendor/libssh2/tests/Makefile.am
vendored
Normal file
55
vendor/libssh2/tests/Makefile.am
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
# Copyright (C) The libssh2 project and its contributors.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
SUBDIRS = ossfuzz
|
||||
|
||||
AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src -I$(top_srcdir)/include
|
||||
|
||||
# This might hold -Werror
|
||||
AM_CFLAGS = @LIBSSH2_CFLAG_EXTRAS@
|
||||
|
||||
# Get DOCKER_TESTS, DOCKER_TESTS_STATIC, STANDALONE_TESTS, STANDALONE_TESTS_STATOC, SSHD_TESTS,
|
||||
# librunner_la_SOURCES defines and *_LDFLAGS for statically linked tests.
|
||||
include Makefile.inc
|
||||
|
||||
if HAVE_LIB_STATIC
|
||||
DOCKER_TESTS += $(DOCKER_TESTS_STATIC)
|
||||
STANDALONE_TESTS += $(STANDALONE_TESTS_STATIC)
|
||||
endif
|
||||
|
||||
# Some tests rely on the 'srcdir' env. Set by autotools automatically.
|
||||
TESTS_ENVIRONMENT =
|
||||
|
||||
# Tests to run
|
||||
TESTS = mansyntax.sh
|
||||
|
||||
if RUN_DOCKER_TESTS
|
||||
TESTS += $(DOCKER_TESTS)
|
||||
endif
|
||||
|
||||
TESTS += $(STANDALONE_TESTS)
|
||||
|
||||
# TAP tests
|
||||
TEST_EXTENSIONS = .test
|
||||
# 'TEST' in 'TEST_LOG_DRIVER' is the test extension in uppercase.
|
||||
TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/tap-driver.sh
|
||||
|
||||
TESTS_ENVIRONMENT += EXEEXT=$(EXEEXT)
|
||||
if RUN_SSHD_TESTS
|
||||
if SSHD
|
||||
TESTS += test_sshd.test
|
||||
TESTS_ENVIRONMENT += SSHD="$(SSHD)"
|
||||
endif
|
||||
endif
|
||||
if RUN_DOCKER_TESTS
|
||||
TESTS += test_read_algos.test
|
||||
endif
|
||||
|
||||
# Tests to build
|
||||
check_PROGRAMS = $(DOCKER_TESTS) $(STANDALONE_TESTS) $(SSHD_TESTS)
|
||||
|
||||
# Internal library used by tests
|
||||
LDADD = librunner.la
|
||||
check_LTLIBRARIES = librunner.la
|
||||
|
||||
# This must be last in the list so it resolves symbols in previous libraries
|
||||
LDADD += ../src/libssh2.la
|
||||
102
vendor/libssh2/tests/Makefile.inc
vendored
Normal file
102
vendor/libssh2/tests/Makefile.inc
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
# Copyright (C) The libssh2 project and its contributors.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
# Keep this list sorted
|
||||
#
|
||||
# NOTE: test_auth_keyboard_info_request does not use the network, but when
|
||||
# run as Windows standalone test, it intermittently fails on GHA with:
|
||||
# `Terminate batch job (Y/N)?`
|
||||
DOCKER_TESTS = \
|
||||
test_aa_warmup \
|
||||
test_agent_forward_ok \
|
||||
test_auth_keyboard_fail \
|
||||
test_auth_keyboard_ok \
|
||||
test_auth_password_fail_password \
|
||||
test_auth_password_fail_username \
|
||||
test_auth_password_ok \
|
||||
test_auth_pubkey_fail \
|
||||
test_auth_pubkey_ok_dsa \
|
||||
test_auth_pubkey_ok_ecdsa \
|
||||
test_auth_pubkey_ok_ecdsa_signed \
|
||||
test_auth_pubkey_ok_ed25519 \
|
||||
test_auth_pubkey_ok_ed25519_encrypted \
|
||||
test_auth_pubkey_ok_ed25519_mem \
|
||||
test_auth_pubkey_ok_rsa \
|
||||
test_auth_pubkey_ok_rsa_aes256gcm \
|
||||
test_auth_pubkey_ok_rsa_encrypted \
|
||||
test_auth_pubkey_ok_rsa_openssh \
|
||||
test_auth_pubkey_ok_rsa_signed \
|
||||
test_auth_pubkey_ok_rsa_sha2_256_signed \
|
||||
test_hostkey_hash \
|
||||
test_read
|
||||
|
||||
STANDALONE_TESTS =
|
||||
|
||||
SSHD_TESTS = \
|
||||
test_ssh2 \
|
||||
test_auth_pubkey_ok_ed25519
|
||||
|
||||
# Programs of the above that use internal libssh2 functions so they need
|
||||
# to be statically linked against libssh2
|
||||
DOCKER_TESTS_STATIC = \
|
||||
test_auth_keyboard_info_request \
|
||||
test_hostkey
|
||||
|
||||
STANDALONE_TESTS_STATIC = \
|
||||
test_simple
|
||||
|
||||
# Copy of the above for Makefile.am.
|
||||
# Is there a way to reuse the lists above?
|
||||
test_auth_keyboard_info_request_LDFLAGS = -static
|
||||
test_hostkey_LDFLAGS = -static
|
||||
test_simple_LDFLAGS = -static
|
||||
|
||||
librunner_la_SOURCES = \
|
||||
runner.c runner.h \
|
||||
session_fixture.c session_fixture.h \
|
||||
openssh_fixture.c openssh_fixture.h
|
||||
|
||||
EXTRA_DIST = \
|
||||
CMakeLists.txt \
|
||||
key_dsa \
|
||||
key_dsa.pub \
|
||||
key_dsa_wrong \
|
||||
key_dsa_wrong.pub \
|
||||
key_ecdsa \
|
||||
key_ecdsa.pub \
|
||||
key_ecdsa_signed \
|
||||
key_ecdsa_signed-cert.pub \
|
||||
key_ecdsa_signed.pub \
|
||||
key_ed25519 \
|
||||
key_ed25519.pub \
|
||||
key_ed25519_encrypted \
|
||||
key_ed25519_encrypted.pub \
|
||||
key_rsa \
|
||||
key_rsa.pub \
|
||||
key_rsa_aes256gcm \
|
||||
key_rsa_aes256gcm.pub \
|
||||
key_rsa_encrypted \
|
||||
key_rsa_encrypted.pub \
|
||||
key_rsa_openssh \
|
||||
key_rsa_openssh.pub \
|
||||
key_rsa_signed \
|
||||
key_rsa_signed-cert.pub \
|
||||
key_rsa_signed.pub \
|
||||
key_rsa_sha2_256_signed \
|
||||
key_rsa_sha2_256_signed-cert.pub \
|
||||
key_rsa_sha2_256_signed.pub \
|
||||
mansyntax.sh \
|
||||
openssh_server/Dockerfile \
|
||||
openssh_server/authorized_keys \
|
||||
openssh_server/ca_ecdsa \
|
||||
openssh_server/ca_ecdsa.pub \
|
||||
openssh_server/ca_rsa \
|
||||
openssh_server/ca_rsa.pub \
|
||||
openssh_server/ca_user_keys.pub \
|
||||
openssh_server/ssh_host_ecdsa_key \
|
||||
openssh_server/ssh_host_ed25519_key \
|
||||
openssh_server/ssh_host_rsa_key \
|
||||
openssh_server/sshd_config \
|
||||
test_read_algos.test \
|
||||
test_read_algos.txt \
|
||||
test_sshd.test
|
||||
72
vendor/libssh2/tests/cmake/CMakeLists.txt
vendored
Normal file
72
vendor/libssh2/tests/cmake/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
# Copyright (C) Viktor Szakats
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
cmake_minimum_required(VERSION 3.7)
|
||||
message(STATUS "Using CMake version ${CMAKE_VERSION}")
|
||||
|
||||
project(test-dependent C)
|
||||
|
||||
option(TEST_INTEGRATION_MODE "Integration mode" "find_package")
|
||||
|
||||
message(STATUS "TEST_INTEGRATION_MODE: ${TEST_INTEGRATION_MODE}")
|
||||
|
||||
if(TEST_INTEGRATION_MODE STREQUAL "find_package" OR
|
||||
TEST_INTEGRATION_MODE STREQUAL "ExternalProject")
|
||||
if(TEST_INTEGRATION_MODE STREQUAL "ExternalProject")
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(libssh2
|
||||
URL "${FROM_ARCHIVE}"
|
||||
URL_HASH "SHA256=${FROM_HASH}"
|
||||
INSTALL_COMMAND ""
|
||||
DOWNLOAD_EXTRACT_TIMESTAMP ON)
|
||||
endif()
|
||||
find_package(libssh2 REQUIRED CONFIG)
|
||||
find_package(libssh2 REQUIRED CONFIG) # test for double-inclusion
|
||||
foreach(result_var IN ITEMS libssh2_FOUND libssh2_VERSION)
|
||||
if(${result_var})
|
||||
message(STATUS "${result_var}: |${${result_var}}|")
|
||||
else()
|
||||
message(FATAL_ERROR "'${result_var}' variable not set by the libssh2 package.")
|
||||
endif()
|
||||
endforeach()
|
||||
elseif(TEST_INTEGRATION_MODE STREQUAL "add_subdirectory")
|
||||
add_subdirectory(libssh2)
|
||||
elseif(TEST_INTEGRATION_MODE STREQUAL "FetchContent")
|
||||
include(FetchContent)
|
||||
option(FROM_GIT_REPO "Git URL" "https://github.com/libssh2/libssh2.git")
|
||||
option(FROM_GIT_TAG "Git tag" "master")
|
||||
FetchContent_Declare(libssh2
|
||||
GIT_REPOSITORY "${FROM_GIT_REPO}"
|
||||
GIT_TAG "${FROM_GIT_TAG}")
|
||||
FetchContent_MakeAvailable(libssh2)
|
||||
endif()
|
||||
|
||||
add_executable(test-dependent-static-ns "test.c")
|
||||
target_link_libraries(test-dependent-static-ns PRIVATE "libssh2::libssh2_static")
|
||||
|
||||
add_executable(test-dependent-shared-ns "test.c")
|
||||
target_link_libraries(test-dependent-shared-ns PRIVATE "libssh2::libssh2_shared")
|
||||
|
||||
# Alias for either shared or static library
|
||||
add_executable(test-dependent-selected-ns "test.c")
|
||||
target_link_libraries(test-dependent-selected-ns PRIVATE "libssh2::libssh2")
|
||||
|
||||
if(TEST_INTEGRATION_MODE STREQUAL "find_package" OR
|
||||
TEST_INTEGRATION_MODE STREQUAL "ExternalProject")
|
||||
|
||||
# Compatibility alias
|
||||
add_executable(test-dependent-compat "test.c")
|
||||
target_link_libraries(test-dependent-compat PRIVATE "Libssh2::libssh2")
|
||||
|
||||
elseif(TEST_INTEGRATION_MODE STREQUAL "add_subdirectory" OR
|
||||
TEST_INTEGRATION_MODE STREQUAL "FetchContent")
|
||||
|
||||
add_executable(test-dependent-static-bare "test.c")
|
||||
target_link_libraries(test-dependent-static-bare PRIVATE "libssh2_static")
|
||||
|
||||
add_executable(test-dependent-shared-bare "test.c")
|
||||
target_link_libraries(test-dependent-shared-bare PRIVATE "libssh2_shared")
|
||||
|
||||
add_executable(test-dependent-selected-bare "test.c")
|
||||
target_link_libraries(test-dependent-selected-bare PRIVATE "libssh2")
|
||||
endif()
|
||||
13
vendor/libssh2/tests/cmake/test.c
vendored
Normal file
13
vendor/libssh2/tests/cmake/test.c
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
/* Copyright (C) Viktor Szakats
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "libssh2.h"
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf("libssh2_version(0): |%s|\n", libssh2_version(0));
|
||||
return 0;
|
||||
}
|
||||
30
vendor/libssh2/tests/cmake/test.sh
vendored
Executable file
30
vendor/libssh2/tests/cmake/test.sh
vendored
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) Viktor Szakats
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
rm -rf bld-fetchcontent; cmake -B bld-fetchcontent -DTEST_INTEGRATION_MODE=FetchContent \
|
||||
-DFROM_GIT_REPO="${PWD}/../.." \
|
||||
-DFROM_GIT_TAG="$(git rev-parse HEAD)"
|
||||
make -j3 -C bld-fetchcontent
|
||||
|
||||
rm -rf libssh2; ln -s ../.. libssh2
|
||||
rm -rf bld-add_subdirectory; cmake -B bld-add_subdirectory -DTEST_INTEGRATION_MODE=add_subdirectory
|
||||
make -j3 -C bld-add_subdirectory
|
||||
|
||||
rm -rf bld-libssh2; cmake ../.. -B bld-libssh2
|
||||
make -j3 -C bld-libssh2 DESTDIR=pkg install
|
||||
rm -rf bld-find_package; cmake -B bld-find_package -DTEST_INTEGRATION_MODE=find_package \
|
||||
-DCMAKE_PREFIX_PATH="${PWD}/bld-libssh2/pkg/usr/local/lib/cmake/libssh2"
|
||||
make -j3 -C bld-find_package
|
||||
|
||||
(cd ../..; git archive --format=tar HEAD) | gzip > source.tar.gz
|
||||
rm -rf bld-externalproject; cmake -B bld-externalproject -DTEST_INTEGRATION_MODE=ExternalProject \
|
||||
-DFROM_ARCHIVE="${PWD}/source.tar.gz" \
|
||||
-DFROM_HASH="$(openssl dgst -sha256 source.tar.gz | grep -a -i -o -E '[0-9a-f]{64}$')"
|
||||
make -j3 -C bld-externalproject
|
||||
82
vendor/libssh2/tests/gen_keys.sh
vendored
Executable file
82
vendor/libssh2/tests/gen_keys.sh
vendored
Executable file
@@ -0,0 +1,82 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) Viktor Szakats
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
# Generate test keys
|
||||
|
||||
# tests/openssh_server
|
||||
|
||||
rm ./openssh_server/*_key || true
|
||||
|
||||
ssh-keygen -t rsa -b 2048 -N '' -m PEM -C '' -f 'openssh_server/ssh_host_rsa_key'
|
||||
ssh-keygen -t ecdsa -b 256 -N '' -m PEM -C '' -f 'openssh_server/ssh_host_ecdsa_key'
|
||||
ssh-keygen -t ed25519 -N '' -C '' -f 'openssh_server/ssh_host_ed25519_key'
|
||||
|
||||
rm ./openssh_server/ca_* || true
|
||||
|
||||
ssh-keygen -t ecdsa -b 521 -N '' -C 'ca_ecdsa' -f 'openssh_server/ca_ecdsa'
|
||||
ssh-keygen -t rsa -b 3072 -N '' -C 'ca_rsa' -f 'openssh_server/ca_rsa'
|
||||
|
||||
# tests
|
||||
|
||||
rm './key_'* || true
|
||||
|
||||
pw='libssh2'
|
||||
id='identity'
|
||||
pr='libssh2'
|
||||
|
||||
ssh-keygen -t dsa -N '' -m PEM -C 'key_dsa' -f 'key_dsa'
|
||||
ssh-keygen -t dsa -N '' -m PEM -C 'key_dsa_wrong' -f 'key_dsa_wrong' # not to add to 'authorized_keys'
|
||||
|
||||
ssh-keygen -t rsa -b 2048 -N '' -m PEM -C 'key_rsa' -f 'key_rsa'
|
||||
ssh-keygen -t rsa -b 2048 -N "${pw}" -m PEM -C 'key_rsa_encrypted' -f 'key_rsa_encrypted'
|
||||
ssh-keygen -t rsa -b 2048 -N '' -C 'key_rsa_openssh' -f 'key_rsa_openssh'
|
||||
ssh-keygen -t rsa -b 2048 -N "${pw}" -C 'key_rsa_aes256gcm' -f 'key_rsa_aes256gcm' -Z aes256-gcm@openssh.com
|
||||
ssh-keygen -t rsa -b 4096 -N '' -C 'key_rsa_signed' -f 'key_rsa_signed'
|
||||
ssh-keygen -I "${id}" -n "${pr}" -s 'openssh_server/ca_rsa' 'key_rsa_signed.pub'
|
||||
ssh-keygen -t rsa -b 4096 -N '' -C 'key_rsa_sha2_256_signed' -f 'key_rsa_sha2_256_signed'
|
||||
ssh-keygen -I "${id}" -n "${pr}" -s 'openssh_server/ca_rsa' 'key_rsa_sha2_256_signed.pub'
|
||||
|
||||
ssh-keygen -t ecdsa -b 384 -N '' -C 'key_ecdsa' -f 'key_ecdsa'
|
||||
ssh-keygen -t ecdsa -b 384 -N '' -C 'key_ecdsa_signed' -f 'key_ecdsa_signed'
|
||||
ssh-keygen -I "${id}" -n "${pr}" -s 'openssh_server/ca_ecdsa' 'key_ecdsa_signed.pub'
|
||||
|
||||
ssh-keygen -t ed25519 -N '' -C 'key_ed25519' -f 'key_ed25519'
|
||||
ssh-keygen -t ed25519 -N "${pw}" -C 'key_ed25519_encrypted' -f 'key_ed25519_encrypted' -Z aes256-ctr
|
||||
|
||||
cat \
|
||||
'key_dsa.pub' \
|
||||
'key_rsa.pub' \
|
||||
'key_rsa_encrypted.pub' \
|
||||
'key_rsa_openssh.pub' \
|
||||
'key_rsa_aes256gcm.pub' \
|
||||
'key_ed25519.pub' \
|
||||
'key_ed25519_encrypted.pub' \
|
||||
'key_ecdsa.pub' \
|
||||
> 'openssh_server/authorized_keys'
|
||||
|
||||
cat \
|
||||
'openssh_server/ca_ecdsa.pub' \
|
||||
'openssh_server/ca_rsa.pub' \
|
||||
> 'openssh_server/ca_user_keys.pub'
|
||||
|
||||
# tests/test_*.c
|
||||
|
||||
echo 'Add these public keys and hashes to:'
|
||||
echo ' - test_hostkey.c'
|
||||
echo ' - test_hostkey_hash.c'
|
||||
|
||||
for fn in ./openssh_server/*_key.pub; do
|
||||
pub="$(grep -a -o -E ' [A-Za-z0-9+/=]+' < "${fn}" | head -1 | cut -c 2-)"
|
||||
printf '====== %s\n' "${fn}"
|
||||
printf 'BASE64 %s\n' "${pub}"
|
||||
{
|
||||
printf 'MD5 %s\n' "$(printf '%s' "${pub}" | openssl base64 -d -A | openssl dgst -hex -md5)"
|
||||
printf 'SHA1 %s\n' "$(printf '%s' "${pub}" | openssl base64 -d -A | openssl dgst -hex -sha1)"
|
||||
printf 'SHA256 %s\n' "$(printf '%s' "${pub}" | openssl base64 -d -A | openssl dgst -hex -sha256)"
|
||||
} | tr '[:lower:]' '[:upper:]'
|
||||
done
|
||||
12
vendor/libssh2/tests/key_dsa
vendored
Normal file
12
vendor/libssh2/tests/key_dsa
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
-----BEGIN DSA PRIVATE KEY-----
|
||||
MIIBvAIBAAKBgQCtiYdgpPvFtfi7Ba44DiB+1x8kojjT0nRvn2hU2aa4p4fXI8kd
|
||||
6Hc57VQO/lLhR9eFpxjP7m+jGwF468Q6NU8xiC71ucep0OoXS7u8RcoIoWfLDtZi
|
||||
DDlahnZTW04mB5fFxo2y7dYl31vE4TPdSxhqpkvnIBIstMFh2M7Dl0w8/QIVAP95
|
||||
u6dg1OW6gGsRgiircsy1A9tzAoGBAIzwc5FCnJnzAJm9Hjv0AFV5l/i/DQulZ9pu
|
||||
EILkNiHCfDR+lTJ8VxAR7J3pgjmvYzeeRvi519ez1YriktDt66kIknQOcHB8ghyg
|
||||
U+dff79SkDcpg8LnX5xb3cVMgABujA0sSpaW1wwm64RXdvmoQvWu6ympUT0l0dEd
|
||||
oYVkb4ytAoGAJ+CGwV/1S4j1GVwa6pSP0nj4V86GWXosTTBg7GT+rKWu8lrxIcr6
|
||||
FzLWgFi/gHoMrgnKWGxO1yF7vkoYM5Yfo84oBYiH+MgpiBuOrZrgzacHsA66JJbU
|
||||
frESRFWZl2blIPr6Gyjj6cVGgMabK3yCiTRi0v7hwffpm0rKyKv7GooCFQCyaA6T
|
||||
tkJunHP+F0Xg/WAUV6tcqA==
|
||||
-----END DSA PRIVATE KEY-----
|
||||
1
vendor/libssh2/tests/key_dsa.pub
vendored
Normal file
1
vendor/libssh2/tests/key_dsa.pub
vendored
Normal file
@@ -0,0 +1 @@
|
||||
ssh-dss AAAAB3NzaC1kc3MAAACBAK2Jh2Ck+8W1+LsFrjgOIH7XHySiONPSdG+faFTZprinh9cjyR3odzntVA7+UuFH14WnGM/ub6MbAXjrxDo1TzGILvW5x6nQ6hdLu7xFygihZ8sO1mIMOVqGdlNbTiYHl8XGjbLt1iXfW8ThM91LGGqmS+cgEiy0wWHYzsOXTDz9AAAAFQD/ebunYNTluoBrEYIoq3LMtQPbcwAAAIEAjPBzkUKcmfMAmb0eO/QAVXmX+L8NC6Vn2m4QguQ2IcJ8NH6VMnxXEBHsnemCOa9jN55G+LnX17PViuKS0O3rqQiSdA5wcHyCHKBT519/v1KQNymDwudfnFvdxUyAAG6MDSxKlpbXDCbrhFd2+ahC9a7rKalRPSXR0R2hhWRvjK0AAACAJ+CGwV/1S4j1GVwa6pSP0nj4V86GWXosTTBg7GT+rKWu8lrxIcr6FzLWgFi/gHoMrgnKWGxO1yF7vkoYM5Yfo84oBYiH+MgpiBuOrZrgzacHsA66JJbUfrESRFWZl2blIPr6Gyjj6cVGgMabK3yCiTRi0v7hwffpm0rKyKv7Goo= awl03@bounty
|
||||
12
vendor/libssh2/tests/key_dsa_wrong
vendored
Normal file
12
vendor/libssh2/tests/key_dsa_wrong
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
-----BEGIN DSA PRIVATE KEY-----
|
||||
MIIBuwIBAAKBgQCE1v/lL1VvjlJMyG7q0wAgl2tqVMzy5h1RVOtDS8bTlXLJg7ks
|
||||
T63wTmXlp2HedgKkfHCu7AKsjPyg1CTrvRBa8BFEvMoUDARonMwql34aiKVMy/t0
|
||||
/ehnmCQV+ZMFpsVFnphJpZuXLTW1F3pnEbSNud5sACjbWb51uly5AUynuwIVAOhj
|
||||
rbNOaAtC1oYki8CVwpkQ8rHhAoGAYSepXRF3GJSjseYgJ2bCgcJS0L9agcvKAf+F
|
||||
dc+ZDJOchhnZC/hGHsjAfg62KowwKuOYsbcR3S4LJxiERcmRabww+kUIL1E8bLaQ
|
||||
RbOygNsHU8LyBdSx3WqC2WEOpVkTAjYDWTkbN+qkb53IBoI0GwFt5P9GHvQcAGkj
|
||||
GJQAWWYCgYAt7vxpDC5Xs6GxbaUupfIP95ZTMx2LqqFjqfT/81nypIHVyIlCnWMi
|
||||
a0mWGe4qXmHSyk6ZYnsk7Ll6WxdwUrFhd75qERyXlRK2x/v/Q3h9IOwChpHdSFx/
|
||||
Tq1Zl9vMx3tmS1H0YF9tUdN7g8S5XTUSvYA+0Lzxs/9zOU5fa55+pAIVAKV45RLf
|
||||
hg2GNXvO68Q4tt3F6kSP
|
||||
-----END DSA PRIVATE KEY-----
|
||||
1
vendor/libssh2/tests/key_dsa_wrong.pub
vendored
Normal file
1
vendor/libssh2/tests/key_dsa_wrong.pub
vendored
Normal file
@@ -0,0 +1 @@
|
||||
ssh-dss AAAAB3NzaC1kc3MAAACBAITW/+UvVW+OUkzIburTACCXa2pUzPLmHVFU60NLxtOVcsmDuSxPrfBOZeWnYd52AqR8cK7sAqyM/KDUJOu9EFrwEUS8yhQMBGiczCqXfhqIpUzL+3T96GeYJBX5kwWmxUWemEmlm5ctNbUXemcRtI253mwAKNtZvnW6XLkBTKe7AAAAFQDoY62zTmgLQtaGJIvAlcKZEPKx4QAAAIBhJ6ldEXcYlKOx5iAnZsKBwlLQv1qBy8oB/4V1z5kMk5yGGdkL+EYeyMB+DrYqjDAq45ixtxHdLgsnGIRFyZFpvDD6RQgvUTxstpBFs7KA2wdTwvIF1LHdaoLZYQ6lWRMCNgNZORs36qRvncgGgjQbAW3k/0Ye9BwAaSMYlABZZgAAAIAt7vxpDC5Xs6GxbaUupfIP95ZTMx2LqqFjqfT/81nypIHVyIlCnWMia0mWGe4qXmHSyk6ZYnsk7Ll6WxdwUrFhd75qERyXlRK2x/v/Q3h9IOwChpHdSFx/Tq1Zl9vMx3tmS1H0YF9tUdN7g8S5XTUSvYA+0Lzxs/9zOU5fa55+pA== awl03@bounty
|
||||
10
vendor/libssh2/tests/key_ecdsa
vendored
Normal file
10
vendor/libssh2/tests/key_ecdsa
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
-----BEGIN OPENSSH PRIVATE KEY-----
|
||||
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAiAAAABNlY2RzYS
|
||||
1zaGEyLW5pc3RwMzg0AAAACG5pc3RwMzg0AAAAYQTosiScH/oRSazpIpPSEFcY4YVZyNby
|
||||
peARi49N3qy78OE118KGc5T8eifd+n1PSb7z8PnfDwOL4jBHxW5nWx0RCocIt7tb2a349J
|
||||
gfEl8PegHGcF/DwC+eesIKJvv0MfkAAADIKLgw6yi4MOsAAAATZWNkc2Etc2hhMi1uaXN0
|
||||
cDM4NAAAAAhuaXN0cDM4NAAAAGEE6LIknB/6EUms6SKT0hBXGOGFWcjW8qXgEYuPTd6su/
|
||||
DhNdfChnOU/Hon3fp9T0m+8/D53w8Di+IwR8VuZ1sdEQqHCLe7W9mt+PSYHxJfD3oBxnBf
|
||||
w8AvnnrCCib79DH5AAAAMGYdHu+u2/L8zC/0S9bao9y6vKiLSuTEfZpCIsyE5jWj/vrS0n
|
||||
r1lzv9kKj+5A86aQAAAAA=
|
||||
-----END OPENSSH PRIVATE KEY-----
|
||||
1
vendor/libssh2/tests/key_ecdsa.pub
vendored
Normal file
1
vendor/libssh2/tests/key_ecdsa.pub
vendored
Normal file
@@ -0,0 +1 @@
|
||||
ecdsa-sha2-nistp384 AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzODQAAABhBOiyJJwf+hFJrOkik9IQVxjhhVnI1vKl4BGLj03erLvw4TXXwoZzlPx6J936fU9JvvPw+d8PA4viMEfFbmdbHREKhwi3u1vZrfj0mB8SXw96AcZwX8PAL556wgom+/Qx+Q==
|
||||
10
vendor/libssh2/tests/key_ecdsa_signed
vendored
Normal file
10
vendor/libssh2/tests/key_ecdsa_signed
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
-----BEGIN OPENSSH PRIVATE KEY-----
|
||||
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAiAAAABNlY2RzYS
|
||||
1zaGEyLW5pc3RwMzg0AAAACG5pc3RwMzg0AAAAYQRv1/fnN1SuIkg222jYnySqIJ88J5M3
|
||||
bB6JGeloKhIvnZdPOSVFuFBjuF7NPrGrsm87QstQFbDiLhIlcDNHIq0VhS5itHNMjtC6Ym
|
||||
RRx7mlQSXPbRRF5MclxvDJCMyAIagAAADQekojnXpKI50AAAATZWNkc2Etc2hhMi1uaXN0
|
||||
cDM4NAAAAAhuaXN0cDM4NAAAAGEEb9f35zdUriJINtto2J8kqiCfPCeTN2weiRnpaCoSL5
|
||||
2XTzklRbhQY7hezT6xq7JvO0LLUBWw4i4SJXAzRyKtFYUuYrRzTI7QumJkUce5pUElz20U
|
||||
ReTHJcbwyQjMgCGoAAAAMQDmng9vaqXjHAhRssuBHeQylRKRwzOYOaToF8f+O0NmpmfLnc
|
||||
/c2wOcXf2f9GBAQdYAAAAAAQIDBAUGBw==
|
||||
-----END OPENSSH PRIVATE KEY-----
|
||||
1
vendor/libssh2/tests/key_ecdsa_signed-cert.pub
vendored
Normal file
1
vendor/libssh2/tests/key_ecdsa_signed-cert.pub
vendored
Normal file
@@ -0,0 +1 @@
|
||||
ecdsa-sha2-nistp384-cert-v01@openssh.com AAAAKGVjZHNhLXNoYTItbmlzdHAzODQtY2VydC12MDFAb3BlbnNzaC5jb20AAAAgQCXc1JaqZ4XzkudbzP/pgEUbkioo7pl9aB09h6sg7KYAAAAIbmlzdHAzODQAAABhBG/X9+c3VK4iSDbbaNifJKognzwnkzdsHokZ6WgqEi+dl085JUW4UGO4Xs0+sauybztCy1AVsOIuEiVwM0cirRWFLmK0c0yO0LpiZFHHuaVBJc9tFEXkxyXG8MkIzIAhqAAAAAAAAAABAAAAAQAAAAhpZGVudGl0eQAAAAsAAAAHbGlic3NoMgAAAAAAAAAA//////////8AAAAAAAAAggAAABVwZXJtaXQtWDExLWZvcndhcmRpbmcAAAAAAAAAF3Blcm1pdC1hZ2VudC1mb3J3YXJkaW5nAAAAAAAAABZwZXJtaXQtcG9ydC1mb3J3YXJkaW5nAAAAAAAAAApwZXJtaXQtcHR5AAAAAAAAAA5wZXJtaXQtdXNlci1yYwAAAAAAAAAAAAAArAAAABNlY2RzYS1zaGEyLW5pc3RwNTIxAAAACG5pc3RwNTIxAAAAhQQAfv15s+G2xg56J+audKAM4G9qOTFrbZRo0CTwvkb/oHrf9/2RSWqYsx/0m5mYCZVlecnZqwRHAOolXbc/Yb4cGjsALUj3UDirsnYR7Ve+SwnunkpvW/H3a98sA3sS+HCpd5RbpfWClSBOI9JEAlPtS1CrEQ7EmO7hmlFOH2cL0qfHCyYAAACnAAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAACMAAAAQgGxnhh8z8LNk5pMw0D9InyEtVRm8OJi23XEhqj/ieT/BsLZXbu65UAcMjrUn6DPdERxF9Dwe9pdIAWOLLjLHYEFBQAAAEIAlxz+XjUKa9Q2vpH0y8IgJMm0H1hTBUM1DQEoL8No1BVtgtIO20mac2fE3I35JxNDmmXoW+FuzmJnyrY9rxY+YXM= key_ecdsa_signed.pub
|
||||
1
vendor/libssh2/tests/key_ecdsa_signed.pub
vendored
Normal file
1
vendor/libssh2/tests/key_ecdsa_signed.pub
vendored
Normal file
@@ -0,0 +1 @@
|
||||
ecdsa-sha2-nistp384 AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzODQAAABhBG/X9+c3VK4iSDbbaNifJKognzwnkzdsHokZ6WgqEi+dl085JUW4UGO4Xs0+sauybztCy1AVsOIuEiVwM0cirRWFLmK0c0yO0LpiZFHHuaVBJc9tFEXkxyXG8MkIzIAhqA== key_ecdsa_signed
|
||||
7
vendor/libssh2/tests/key_ed25519
vendored
Normal file
7
vendor/libssh2/tests/key_ed25519
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
-----BEGIN OPENSSH PRIVATE KEY-----
|
||||
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
|
||||
QyNTUxOQAAACBRINCCN823NclhoUcyHOSsE0ZZsddEUD9LEut/taDD4gAAAJDgVkFO4FZB
|
||||
TgAAAAtzc2gtZWQyNTUxOQAAACBRINCCN823NclhoUcyHOSsE0ZZsddEUD9LEut/taDD4g
|
||||
AAAECD4khMmQkiGtn/wwcwqKNRo3oCetwMOOlhli8S8So8OVEg0II3zbc1yWGhRzIc5KwT
|
||||
Rlmx10RQP0sS63+1oMPiAAAAC2tleV9lZDI1NTE5AQI=
|
||||
-----END OPENSSH PRIVATE KEY-----
|
||||
1
vendor/libssh2/tests/key_ed25519.pub
vendored
Normal file
1
vendor/libssh2/tests/key_ed25519.pub
vendored
Normal file
@@ -0,0 +1 @@
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFEg0II3zbc1yWGhRzIc5KwTRlmx10RQP0sS63+1oMPi key_ed25519
|
||||
8
vendor/libssh2/tests/key_ed25519_encrypted
vendored
Normal file
8
vendor/libssh2/tests/key_ed25519_encrypted
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
-----BEGIN OPENSSH PRIVATE KEY-----
|
||||
b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABD4qdu8J/
|
||||
EAqXFQERrvzMerAAAAEAAAAAEAAAAzAAAAC3NzaC1lZDI1NTE5AAAAICHxEyUTOVHXvdMF
|
||||
ARedFQ+H9DW/n8Zy3daKKRqnTDMqAAAAoO05oxXUkLz8cMQcMeeRSc4UvsaWnCvfN4Qm15
|
||||
NaVwSjb/09AcGGVeF1xxwPEIjwsIRftAjjgLuauI6XpXzyeDOlr2HnwzgpZtmeaHzbB7lS
|
||||
NjpSENP+fXipXinSfgZqGOItPbbismEVWX4sQn/Zla6/f/JAcDV60TK2ZhVEZ5072t0NcA
|
||||
eZQeSzBnpoRhlB7IDO7/7pmu1kNysUzH94Bw8=
|
||||
-----END OPENSSH PRIVATE KEY-----
|
||||
1
vendor/libssh2/tests/key_ed25519_encrypted.pub
vendored
Normal file
1
vendor/libssh2/tests/key_ed25519_encrypted.pub
vendored
Normal file
@@ -0,0 +1 @@
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICHxEyUTOVHXvdMFARedFQ+H9DW/n8Zy3daKKRqnTDMq
|
||||
27
vendor/libssh2/tests/key_rsa
vendored
Normal file
27
vendor/libssh2/tests/key_rsa
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIEoQIBAAKCAQEAnak1T7zHJ+hVRFBDQ9pf1KVzmd5gaNc7y7NPmL13aOG3sYeJ
|
||||
evi1x1WM/R3tb8XnUnzZUX9GJN0MYovvZsw9bknG1mDP72LFbGp/gzPddGIKHBBp
|
||||
vceDaJ85sM/ME3XOtD7uuXQuNAuEHwEzSMMiSIEMcQS+lXIcMLr5xPLEkyNvqsO5
|
||||
RqSjMTLHKHgY8gLWx7oQ1avokhwuDxF7P3Pqtj+rW2Te6vR0i1H6EyFPsBkzkgNX
|
||||
b33cus8M1CnTmYTSgJgmHO2LLcGpjQ5sL8T/PWIWHaSqTnkrFXEMysgoteXnAYIL
|
||||
jzyBaqq2WV4KA3TluGdAP2p8gC32QtKmIuis3QIBIwKCAQB1Hpyhoi2LX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||||
YPeH1pyKsTyKtvcn9DO5BcE1zaGLB9ApULEpOcUuTwPBLvcDfjRREuUhywT44Coi
|
||||
w0MCgYAX5yc7/Z3R6M30rGsrgb1Y2siHYsi2LCygUj7TDGQYpaZN4afPJOT5H/Nr
|
||||
7x7dgZkbOR6PQFm00VgML0XxKih59t0dcQ+2qk1LX5JDKRF/1kER3np6dpceteDu
|
||||
cC+MEHB/KvijnviAtBZGvD0O7oZgvbkKHESu2igXpAnfXPZFvw==
|
||||
-----END RSA PRIVATE KEY-----
|
||||
1
vendor/libssh2/tests/key_rsa.pub
vendored
Normal file
1
vendor/libssh2/tests/key_rsa.pub
vendored
Normal file
@@ -0,0 +1 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAnak1T7zHJ+hVRFBDQ9pf1KVzmd5gaNc7y7NPmL13aOG3sYeJevi1x1WM/R3tb8XnUnzZUX9GJN0MYovvZsw9bknG1mDP72LFbGp/gzPddGIKHBBpvceDaJ85sM/ME3XOtD7uuXQuNAuEHwEzSMMiSIEMcQS+lXIcMLr5xPLEkyNvqsO5RqSjMTLHKHgY8gLWx7oQ1avokhwuDxF7P3Pqtj+rW2Te6vR0i1H6EyFPsBkzkgNXb33cus8M1CnTmYTSgJgmHO2LLcGpjQ5sL8T/PWIWHaSqTnkrFXEMysgoteXnAYILjzyBaqq2WV4KA3TluGdAP2p8gC32QtKmIuis3Q== awl03@bounty
|
||||
28
vendor/libssh2/tests/key_rsa_aes256gcm
vendored
Normal file
28
vendor/libssh2/tests/key_rsa_aes256gcm
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
-----BEGIN OPENSSH PRIVATE KEY-----
|
||||
b3BlbnNzaC1rZXktdjEAAAAAFmFlczI1Ni1nY21Ab3BlbnNzaC5jb20AAAAGYmNyeXB0AA
|
||||
AAGAAAABAmOIAmfR0iPtpLznIb9WCyAAAAEAAAAAEAAAEXAAAAB3NzaC1yc2EAAAADAQAB
|
||||
AAABAQDD+1l4u2Ktp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rGzem6GPm3j1FpuDYS5Z7AszfVPCeJr031ePcH6JZOMa09A0
|
||||
Zfcv2/+lyIpt713m9pTMnbfTEbxa2EVquVnSG+YyknASMnqw/DAT5n3/Zx9sO7RefrrNHx
|
||||
MhOG5Pg1TIb1gr0W5R/f+0evqftJTLDvP7z5cbsqBlKpIc5jnWuV/kvDhltN2Ty6FjSRlX
|
||||
kdf/Cgig7xKxcgd4iC98ThvcHaGjkAu4vD2G6tCVE/vEhq6rkhTsTS/OwKUC8Wd/Agf02S
|
||||
2MRl7cocSqZAJQDiLIWwDIg8hrAV67WqLZi82v4tH+TwjcUnP/JHFI0ZQkcQF203sGml77
|
||||
YC2qS/km1AMj4J4E8i6qLWM3gKuo7ZOvigDQfCGY0VLmuPugI0UKBhiVK7yyKdAfO5CM3d
|
||||
S6c2dNk7AHXI2AdtoFNe227rutuVV1JFzK9si6ZEo6SrcqigPq7WcKjkzrEIVFXxfnj1c2
|
||||
sYQ8gWlzHO3WvSM7/+9vpv0yQEHT1iysjkWscIPEQqkJ7LizXhq8MWp7NRlyIY6/CcqAzX
|
||||
mgIHD2WnoZ/4EzR6tgewWdaIoduiGbO3q7E06sw+2VGwFDXYfOIQjFgvm/fJu4BGRB1dbW
|
||||
HfPJ4F59jHjnnxse44PkztJ3IydvQ4RvM/zoUPa6RMCZTkYnJ0SsgnRoli5+UNNWbf
|
||||
-----END OPENSSH PRIVATE KEY-----
|
||||
1
vendor/libssh2/tests/key_rsa_aes256gcm.pub
vendored
Normal file
1
vendor/libssh2/tests/key_rsa_aes256gcm.pub
vendored
Normal file
@@ -0,0 +1 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDD+1l4u2KtpvsP2EpioqgHjfirT7IIQOQfCsjZCppmLUcPE1/qCC7krqjzaQ3nuKlVEc/pKJrti2oc0tBDp6zzr8pPkmzdMtpjP84RkJZwu6eVZyZqQrjpmwjw7IWVbGoxkKFpWS2ndxCzhoD/F+TW2NcjpwFN53Ktq0SdHVUXU00RlzUiKNTdzanb8vyF3m+PGwIWPX92E2t/31WxRVXwybTdpXSzyz9IIjxMkrSRVa8XzX0EyUzETuiAeU94AWJX5Gu/pFJT6E7VEMQudeN4iI75WYGxrYU1HCOTnsYk/9LCdM7O6ntJIlzul3CwXsD6+B35hu5AJb91RNbHYWUz key_rsa_aes256gcm
|
||||
30
vendor/libssh2/tests/key_rsa_encrypted
vendored
Normal file
30
vendor/libssh2/tests/key_rsa_encrypted
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
Proc-Type: 4,ENCRYPTED
|
||||
DEK-Info: AES-128-CBC,E030CC29AE4C20669EE41DF3DE4C0886
|
||||
|
||||
gLMMWawVUpqtAtpSVnr7HcH+P0gHKFU00hUhNY18TNJRfFIhPqc9R9xsLHgBac7k
|
||||
vHtD2nzUuWLVMIKQoS3+1IF/KO6Xj1zSqnyk49hyKWxFiD3U1YdZAiZNgJ/s6olg
|
||||
J/h4mNNsz8Nh6Swp3HwP2jtLHWHV8fOzsaE3dvnVYZ5gPnec7XAYcQycbOV0t2Wd
|
||||
NGlP09ooAQRWWuf1TaBewjj7Jm40l8OQat5EKZKzydUZZQYAqfJQ7fIw7jI/lQYF
|
||||
KJj9tq0ceFdxvk8LYMr5a+ixnDwirxgg4L0X3fjLocfLVt42qDKkfOGXGg9VI8CO
|
||||
gjTu/MbodGCWKe/5eeCSSLrKo486S/5B6RzN0Ax4QBb1iYAN5IECsV91Ekk0socY
|
||||
DBZmDMEGHppHJhNhbBzfMYeKssWbOQf9z0y+gDPesImV2gXNoMgTcmZrCLOJWj6L
|
||||
ifQAtTKc8P5fV+TLhg3dKmxCt1UMlCHpWWl7tPTsO3WaaXi50f9ypRfpbpH0hket
|
||||
SO//bZqF0lF+Ci8uC6ndXBniIfinFoMWPsY01bxyHvmEMwCTVApZEkrZtGlHnavy
|
||||
d2oYJ0Oc+eeSjnx2BccQ9GdoI3292CVJVgPiibr42updecFwTry+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
-----END RSA PRIVATE KEY-----
|
||||
1
vendor/libssh2/tests/key_rsa_encrypted.pub
vendored
Normal file
1
vendor/libssh2/tests/key_rsa_encrypted.pub
vendored
Normal file
@@ -0,0 +1 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC92YlGoc4PJy6DzX916JJZhxkvmkWBLGJdWOL7R9B6iaYEKebBxzTE3P1RcnxnuI06kklVq/KcDP9sLlgawTZcDg7ifM7HncPOi18OON8vvVVzodikHzuupjhpI5YTT9wwV2fDVi2URsBjvX4AFiZ5WM3/NwqdKpYABzWieBikXGJ58Tsnw+zQw2qMmKKESBuzSN538loTAj5iEH/GAKYDbbH9t2a17qhNCNEw4vrtURT9JqwO1cOg7N1OKpmqCPEbK0wuSTljNC230VJ06X/8UqahWWSH6MreGy6gwpPi6i9wFiFLur301R0dTPiKVhz6bguhcC1EAlhSgjfelFJt awl03@bounty
|
||||
27
vendor/libssh2/tests/key_rsa_openssh
vendored
Normal file
27
vendor/libssh2/tests/key_rsa_openssh
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
-----BEGIN OPENSSH PRIVATE KEY-----
|
||||
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABFwAAAAdzc2gtcn
|
||||
NhAAAAAwEAAQAAAQEA03tZTdi/8nrdDGtSc15EH97dX/qWrgC3nNhbBmcvOykSVtQDsXE0
|
||||
4nj45RcD9cn0itZVl0Prn9G+tYJCqqkedhQ5MtuByVrmJX15REDJ9nfzzQzVQw2zuE1ysj
|
||||
ccVBxSeqmDDXeJFozh/uq5mKFirFlft5g0Wx2oG1TxGC/MHqfDk6ijqq7lS1T82cmGZAbZ
|
||||
+FzhYulBPFioklXStQJtTuVMb5Q/ebd9nmHIesEPWs4DKo2urKXvy+VCYD/N0GRZJ1Qt8D
|
||||
2VpI6qJlRapdBaWkHJRDcMmPzmTMa9HE/3+2wi+rOAP9V6W7BpgtMWpOP0xx2zp/tC3SHo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uGXyTTVLtl54+kzuciuZ/qLHJT49JY/AtOm+rmpXKACNQIZeEnCML8AewLDEg
|
||||
ugXuFCMIFR4/fupCjGv/tTVHvsh6LJ/td3+DQmisVG3uDnGDEAAACBAOH6xeQ5Z/VPFV1b
|
||||
+ZxutTMjFghLce50L6fSHpBbIN00vS+9I4TmXYI1XFvaFjHShYUrFifWiMFGBNjuoqRY+c
|
||||
9/8UDvptdiXLqqLkw3SNB/UqUQRtZkD384Eazxud+FMfMguFBrgmkWYwAh9EVAzXrbzxQd
|
||||
U9To5SerEitsWsfhAAAAEHdpbGxAaUN1YmUubG9jYWwBAg==
|
||||
-----END OPENSSH PRIVATE KEY-----
|
||||
1
vendor/libssh2/tests/key_rsa_openssh.pub
vendored
Normal file
1
vendor/libssh2/tests/key_rsa_openssh.pub
vendored
Normal file
@@ -0,0 +1 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTe1lN2L/yet0Ma1JzXkQf3t1f+pauALec2FsGZy87KRJW1AOxcTTiePjlFwP1yfSK1lWXQ+uf0b61gkKqqR52FDky24HJWuYlfXlEQMn2d/PNDNVDDbO4TXKyNxxUHFJ6qYMNd4kWjOH+6rmYoWKsWV+3mDRbHagbVPEYL8wep8OTqKOqruVLVPzZyYZkBtn4XOFi6UE8WKiSVdK1Am1O5UxvlD95t32eYch6wQ9azgMqja6spe/L5UJgP83QZFknVC3wPZWkjqomVFql0FpaQclENwyY/OZMxr0cT/f7bCL6s4A/1XpbsGmC0xak4/THHbOn+0LdIej2nGV8JFoR
|
||||
49
vendor/libssh2/tests/key_rsa_sha2_256_signed
vendored
Normal file
49
vendor/libssh2/tests/key_rsa_sha2_256_signed
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
-----BEGIN OPENSSH PRIVATE KEY-----
|
||||
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAACFwAAAAdzc2gtcn
|
||||
NhAAAAAwEAAQAAAgEAqdL8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VToF4J
|
||||
GdMzU9wW6MshhA+ZSTFEzMQ88MOaqrrZHdY90subqx5pQ7O1S/a2BJYSEjRg5Z8cONS828
|
||||
Ph9OZn3NntWn3go4wZ8U35nwxQdZDpIUDdeRR0g9127KCMS2eTtMbNMUiGmOhv1YcvBLNU
|
||||
bLm4xDmqWBXwnplFuwU9gre1vBcKEsV3ybO+udPjOb3t/WscEko4/Qnv8kx+jQmg5Z8vDh
|
||||
ZjR8vSMlZvCJAAAAF2tleV9yc2Ffc2hhMl8yNTZfc2lnbmVkAQID
|
||||
-----END OPENSSH PRIVATE KEY-----
|
||||
1
vendor/libssh2/tests/key_rsa_sha2_256_signed-cert.pub
vendored
Normal file
1
vendor/libssh2/tests/key_rsa_sha2_256_signed-cert.pub
vendored
Normal file
@@ -0,0 +1 @@
|
||||
ssh-rsa-cert-v01@openssh.com AAAAHHNzaC1yc2EtY2VydC12MDFAb3BlbnNzaC5jb20AAAAgMM4Hjk6jALP2CQJ7CfJ/JYH8fIxjGMp8VZ7o3FpcF5sAAAADAQABAAACAQCp0vxjWDhHiT2u0j7Eor+iLjqfGvx0tGNu//VKW/sLKPnRiR+Ate4adBPSDxrQ6tEkrwQEn48FnUknoXMDum87XRK5hu4b7ukizI9PXHk/dh4J70WAVVB3sTukSKy7/V06EdwDsMtG02l20aVdBcDeGVkMWT4OX/aKhKoxljm4OUsx6/JMVHScQA7BPdVuC+RnN64RQMKLAHPNzIpwR6wdO+lRTZajz9nekcldm+YF7bac7aNUYwEilMriFYgLvvr7QV5W2diZDVRzk2G+6avCYfCCo49P24NJv86ab+S1GsvQkFsTfaTWLKxpAc5A6juRTtvLTBy7ko/XrtRWzJJnhcpSMiYSmyYMqHr6oDR4bnHs2r8nwoUUDfdz9hgnjR2clBkkDjju8MVkcWlD4atZCq2EdHCMPbHsoaRkVrJ4vwYOjuUtzwGxwLzWliBWZTAS4DI1moJX+pCmDshxnIih1TZl+wcUPJgLHIog7cqb7g3GG3AXCrb0eltAI5D7hubuRY6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dfeIYki90gFM4G8TmSv2nyGaPJL70UmRDIAM74V4KfW0eFNve2DWImf321nderiuNbrt0fcNueT9Yc3bdrzimw8sjUWl4loiMZNS0SLpM9S7ARmaWxwWw6i4smEv5buEtQDhu2Um1HCLx9DIbUdypSELuv8tiB3zcc1L7VjoL3BDdwmnG0JOJWFD8wuUt6NotnnQhAuBbopi3I0735HXAqBD2v6kbCXOvWxr1uNbiEf/JAvOi/3GNVVZzNyDCOKHRgl8OgaDfpRQgChtyRN2LxDlnFrBVQiNFQiBr67fitZinU+A9hLra5FWXGRs5oTWq3K6kyfgLd4SHRcPeCz+R1rPKMpPi/ObEYKGLOp9EUNOL+zI2iv0FYSgJSRmaBw+md6SBuoHhEdCUFW8GvG4qufzApAl1MmznY4A0pVxIPZTBd0qSTeeE4ZkSZ key_rsa_sha2_256_signed
|
||||
1
vendor/libssh2/tests/key_rsa_sha2_256_signed.pub
vendored
Normal file
1
vendor/libssh2/tests/key_rsa_sha2_256_signed.pub
vendored
Normal file
@@ -0,0 +1 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCp0vxjWDhHiT2u0j7Eor+iLjqfGvx0tGNu//VKW/sLKPnRiR+Ate4adBPSDxrQ6tEkrwQEn48FnUknoXMDum87XRK5hu4b7ukizI9PXHk/dh4J70WAVVB3sTukSKy7/V06EdwDsMtG02l20aVdBcDeGVkMWT4OX/aKhKoxljm4OUsx6/JMVHScQA7BPdVuC+RnN64RQMKLAHPNzIpwR6wdO+lRTZajz9nekcldm+YF7bac7aNUYwEilMriFYgLvvr7QV5W2diZDVRzk2G+6avCYfCCo49P24NJv86ab+S1GsvQkFsTfaTWLKxpAc5A6juRTtvLTBy7ko/XrtRWzJJnhcpSMiYSmyYMqHr6oDR4bnHs2r8nwoUUDfdz9hgnjR2clBkkDjju8MVkcWlD4atZCq2EdHCMPbHsoaRkVrJ4vwYOjuUtzwGxwLzWliBWZTAS4DI1moJX+pCmDshxnIih1TZl+wcUPJgLHIog7cqb7g3GG3AXCrb0eltAI5D7hubuRY6DinUD1moAyjP35QjKwVVPlK0IbF75fCNfIwbTorYZuKh4Fd0bW8DY2/Ev1oH48n1fJvYzI6cywTWl96bzQRYR3kAu1wwYyi2DpyW8qTcPTcfNlw7dRSwIgGSbzOg9XYjCnosN6asmyl9JMVXbC07+PkWtl51kRFDcdRY46w== key_rsa_sha2_256_signed
|
||||
49
vendor/libssh2/tests/key_rsa_signed
vendored
Normal file
49
vendor/libssh2/tests/key_rsa_signed
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
-----BEGIN OPENSSH PRIVATE KEY-----
|
||||
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAACFwAAAAdzc2gtcn
|
||||
NhAAAAAwEAAQAAAgEAsDLVuq8/N4YAiqldV39ij4LVgOaZFQN42OAqLIFrFfK48EqavgDJ
|
||||
gdcM1XU0/86xBMstoi6CMIgF0O8JaaNUEFpJZwoSHZW2sYPhdFLpZbGCGKBMay/vWDMERs
|
||||
JndNMiHvzzh5QQmtdKngVn3TJo7eWQ5WpD1WMBY7yuZWdFFtRTNbnKl+R6CD4VTjX0XmaJ
|
||||
wj/o8L4p+OCDGqrXWksuJO9UKu0bkWzGHk86TWsb9gm8bm72ORO8JQ60+O3tuQ5/13qFdl
|
||||
RF/U/O2QDJ8Jnsg2yltg7+PJeGc3t2PL3lKI3x9zZQPxfftT8HU5airH+ORP1VS8k07Z9S
|
||||
ictoS8rmr/ELeloHsONRthfWpQyWm9dbq3KIEYh8iP6D6NHOiptb4nheyH1u9shOUxU2bW
|
||||
80jUvltBgqNcYeE1MfGwTVxzuPpgxbdoDQoF/h3+uBZT6jNJGmUlLQVSq1krqYE2zEl3x2
|
||||
0VeTSb0nRqT1FnhQ9Yn8WHD4ccCZc5011ULphIJQ7niDLJxPMihGI0RLbmqPP6/fjkban/
|
||||
Tj2bE/Y/m8ETnryxZymZM3w/cWEMlNmjK0Q7qPEekg+0oiOrV0c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klu+Vz7l9s/pAa/XmGSpG50bnRq0PL64aLR45dAXvCFGm5EmY/eb5CVwi892cC/XwY
|
||||
JsvaoMDOjLillPOxB+UU7ggTLFue3uKzgbt3vez5HqtsLT5YLvXnxx0F9ezjFpT2XmFHRa
|
||||
7mtRlMfdKqEzR6xQ9/ncMgzrUWbNMxw/52HHMlgqTaHfj6CBrXarEqOFbOUwo+SyLBJMd5
|
||||
d6BrRj6MZqw9J7AAABAQDM1n5T+2eznjYahX07VmdzMX9lzMUnH7cRbAcv0QZv4nZNgZkj
|
||||
1h+kX6BzVvrARQW2GQ0dg4+03lMpd4fKtqUo6etptocl0zjHqTpIbYKDwWr1s9GUiRC9hL
|
||||
O0gE8nuYZl3c/Z8lNwV9XaDr6a83g24TUcjlj4M3m8S2vi9FGp01ch3JJjzhvoosx7iqkd
|
||||
4Eq6mk3vZHmCgppn8JswWE1ea6bXZFoECRrOnaKbcLImJKu0H+aEq7ra680XqBtNdRVPwg
|
||||
Xex/tfw77hvUBZFZos1t1PUvXjHQtyMSCDbA2I9Jfe3lDwNsS0OG/zYa2/yKGqh8IT8NFR
|
||||
Vq+eerPcc9fJAAAAFnNhYmFuc2FsQHNhYmFuc2FsLWRldjMBAgME
|
||||
-----END OPENSSH PRIVATE KEY-----
|
||||
1
vendor/libssh2/tests/key_rsa_signed-cert.pub
vendored
Normal file
1
vendor/libssh2/tests/key_rsa_signed-cert.pub
vendored
Normal file
@@ -0,0 +1 @@
|
||||
ssh-rsa-cert-v01@openssh.com AAAAHHNzaC1yc2EtY2VydC12MDFAb3BlbnNzaC5jb20AAAAgqdnJWdHT2qMpEe6kVJ81q9c0U3ODMvcuWfJJkV8UVBoAAAADAQABAAACAQCwMtW6rz83hgCKqV1Xf2KPgtWA5pkVA3jY4CosgWsV8rjwSpq+AMmB1wzVdTT/zrEEyy2iLoIwiAXQ7wlpo1QQWklnChIdlbaxg+F0UullsYIYoExrL+9YMwRGwmd00yIe/POHlBCa10qeBWfdMmjt5ZDlakPVY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XTvw/xtBRbTKj13gtcEFyOUR50Z7PU4iOhKd694euGSOYgWGXhtehZPp7hr7afli1hOZtNb3xB3OaPqdPY/jYtZkOaZlKtwDjPzGTIfngpE7LZwsp4P2xxGUyCkItZ57uveDHKvFtb9+MIDMgTd27xOuTYYyHS7m5x7w4M1Z9du8IzxHXlQ/UobQAsTUuGusSQloOpZR1cs3s6p4+vLpl63tNjLFy2xYpFf3xL1Dl1Kf6w3qPiyYs5NmxwJcpAAABlAAAAAxyc2Etc2hhMi01MTIAAAGAK6d2jj8qv89wqRuE2bUFKKJDH4aIs7PGzKclTjZFomlkGvjRF/bsdDeUgwWdJ98j2TPdUvsAMlQrDS1e0OrDicen6eHrFhirpQxVLsAxj/c56nLedvzpbA/BLh8cFcq1vUZ1QHb2WOgOqWRcRbH/3TZhlA+gJ46kKs3QEw9uYy6m906xGwCWRiBUetfll5hS1sWCbAP2LLnA/OJUbIK9vKynombePRApY3LuZ8Hr0JCGgeBnfsesFbWLN6Gb+jT0KR4ah7O39lqecmvdUOR5XcMaSp+sgPpdBr7CzA5lkZnoI/M2J7AV1P5SX/q7/khJMKHuKwAsYf5kNAQdnEnwrqNTp//+qIWe5KjAtc0N5UOF5aK0e1iNaBxSHZA08psRLCCUf3PW3zMIlphUF7qIrRfV+s5fUMW0iIS2iUqI8dTrD0OH0wU10ERKQPixNCqtxBSbJzOyhDWPkTNfBshS8zA2/OVfug0zuxaINpAnZaiCcMnyCjATuWtvWpad6yF9 key_rsa_signed
|
||||
1
vendor/libssh2/tests/key_rsa_signed.pub
vendored
Normal file
1
vendor/libssh2/tests/key_rsa_signed.pub
vendored
Normal file
@@ -0,0 +1 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCwMtW6rz83hgCKqV1Xf2KPgtWA5pkVA3jY4CosgWsV8rjwSpq+AMmB1wzVdTT/zrEEyy2iLoIwiAXQ7wlpo1QQWklnChIdlbaxg+F0UullsYIYoExrL+9YMwRGwmd00yIe/POHlBCa10qeBWfdMmjt5ZDlakPVYwFjvK5lZ0UW1FM1ucqX5HoIPhVONfReZonCP+jwvin44IMaqtdaSy4k71Qq7RuRbMYeTzpNaxv2CbxubvY5E7wlDrT47e25Dn/XeoV2VEX9T87ZAMnwmeyDbKW2Dv48l4Zze3Y8veUojfH3NlA/F9+1PwdTlqKsf45E/VVLyTTtn1KJy2hLyuav8Qt6Wgew41G2F9alDJab11urcogRiHyI/oPo0c6Km1vieF7IfW72yE5TFTZtbzSNS+W0GCo1xh4TUx8bBNXHO4+mDFt2gNCgX+Hf64FlPqM0kaZSUtBVKrWSupgTbMSXfHbRV5NJvSdGpPUWeFD1ifxYcPhxwJlznTXVQumEglDueIMsnE8yKEYjREtuao8/r9+ORtqf9OPZsT9j+bwROevLFnKZkzfD9xYQyU2aMrRDuo8R6SD7SiI6tXRwlohdflXA6ng9RTNyqVROQDOJ94bGPD5b4Bbnm31s2GhhWjoByQGlkNW4BRDEJmgG9sE8ztAxl7d8CV2V93BOisaPkw== key_rsa_signed
|
||||
45
vendor/libssh2/tests/mansyntax.sh
vendored
Executable file
45
vendor/libssh2/tests/mansyntax.sh
vendored
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) The libssh2 project and its contributors.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
# Written by Mikhail Gusarov
|
||||
#
|
||||
# Run syntax checks for all manpages in the documentation tree.
|
||||
#
|
||||
# Requirement on macOS: brew install man-db
|
||||
#
|
||||
|
||||
command -v gman >/dev/null 2>&1 && man() { gman "$@"; }
|
||||
|
||||
dstdir="${builddir:-$PWD}"
|
||||
mandir="$(dirname "$0")/../docs"
|
||||
|
||||
ec=0
|
||||
|
||||
#
|
||||
# Only test if suitable man is available
|
||||
#
|
||||
if command -v grep >/dev/null 2>&1 && \
|
||||
man --help 2>/dev/null | grep -q warnings; then
|
||||
|
||||
trap 'rm -f "$dstdir/man3"' EXIT HUP INT TERM
|
||||
|
||||
ln -sf "$mandir" "$dstdir/man3"
|
||||
|
||||
for manpage in "$mandir"/libssh2_*.*; do
|
||||
echo "$manpage"
|
||||
warnings=$(LANG=en_US.UTF-8 MANWIDTH=80 man -M "$dstdir" --warnings \
|
||||
-E UTF-8 -l "$manpage" >/dev/null 2>&1)
|
||||
if [ -n "$warnings" ]; then
|
||||
echo "$warnings"
|
||||
ec=1
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo 'mansyntax: Required tool not found, skipping tests.'
|
||||
fi
|
||||
|
||||
exit "$ec"
|
||||
490
vendor/libssh2/tests/openssh_fixture.c
vendored
Normal file
490
vendor/libssh2/tests/openssh_fixture.c
vendored
Normal file
@@ -0,0 +1,490 @@
|
||||
/* Copyright (C) Alexander Lamaison
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the copyright holder nor the names
|
||||
* of any other contributors may be used to endorse or
|
||||
* promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "session_fixture.h"
|
||||
#include "openssh_fixture.h"
|
||||
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#if defined(_WIN32) && defined(_WIN64)
|
||||
#define LIBSSH2_SOCKET_MASK "%lld"
|
||||
#else
|
||||
#define LIBSSH2_SOCKET_MASK "%d"
|
||||
#endif
|
||||
|
||||
#ifdef LIBSSH2_WINDOWS_UWP
|
||||
#define popen(x, y) (NULL)
|
||||
#define pclose(x) (-1)
|
||||
#elif defined(_WIN32)
|
||||
#define popen _popen
|
||||
#define pclose _pclose
|
||||
#endif
|
||||
|
||||
static int have_docker = 0;
|
||||
|
||||
int openssh_fixture_have_docker(void)
|
||||
{
|
||||
return have_docker;
|
||||
}
|
||||
|
||||
static int run_command_varg(char **output, const char *command, va_list args)
|
||||
LIBSSH2_PRINTF(2, 0);
|
||||
|
||||
static int run_command_varg(char **output, const char *command, va_list args)
|
||||
{
|
||||
static const char redirect_stderr[] = "%s 2>&1";
|
||||
|
||||
FILE *pipe;
|
||||
char command_buf[BUFSIZ];
|
||||
char buf[BUFSIZ + sizeof(redirect_stderr)];
|
||||
int ret;
|
||||
size_t buf_len;
|
||||
|
||||
if(output) {
|
||||
*output = NULL;
|
||||
}
|
||||
|
||||
/* Format the command string */
|
||||
ret = vsnprintf(command_buf, sizeof(command_buf), command, args);
|
||||
if(ret < 0 || ret >= BUFSIZ) {
|
||||
fprintf(stderr, "Unable to format command (%s)\n", command);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Rewrite the command to redirect stderr to stdout to we can output it */
|
||||
if(strlen(command_buf) + strlen(redirect_stderr) >= sizeof(buf)) {
|
||||
fprintf(stderr, "Unable to rewrite command (%s)\n", command);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = snprintf(buf, sizeof(buf), redirect_stderr, command_buf);
|
||||
if(ret < 0 || ret >= BUFSIZ) {
|
||||
fprintf(stderr, "Unable to rewrite command (%s)\n", command);
|
||||
return -1;
|
||||
}
|
||||
|
||||
fprintf(stdout, "Command: %s\n", command_buf);
|
||||
pipe = popen(buf, "r");
|
||||
if(!pipe) {
|
||||
fprintf(stderr, "Unable to execute command '%s'\n", command);
|
||||
return -1;
|
||||
}
|
||||
buf[0] = 0;
|
||||
buf_len = 0;
|
||||
while(buf_len < (sizeof(buf) - 1) &&
|
||||
fgets(&buf[buf_len], (int)(sizeof(buf) - buf_len), pipe)) {
|
||||
buf_len = strlen(buf);
|
||||
}
|
||||
|
||||
ret = pclose(pipe);
|
||||
if(ret) {
|
||||
fprintf(stderr, "Error running command '%s' (exit %d): %s\n",
|
||||
command, ret, buf);
|
||||
}
|
||||
|
||||
if(output) {
|
||||
/* command output may contain a trailing newline, so we trim
|
||||
* whitespace here */
|
||||
size_t end = strlen(buf);
|
||||
while(end > 0 && isspace((int)buf[end - 1])) {
|
||||
buf[end - 1] = '\0';
|
||||
}
|
||||
|
||||
*output = strdup(buf);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int run_command(char **output, const char *command, ...)
|
||||
LIBSSH2_PRINTF(2, 3);
|
||||
|
||||
static int run_command(char **output, const char *command, ...)
|
||||
{
|
||||
va_list args;
|
||||
int ret;
|
||||
|
||||
va_start(args, command);
|
||||
ret = run_command_varg(output, command, args);
|
||||
va_end(args);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const char *openssh_server_image(void)
|
||||
{
|
||||
return getenv("OPENSSH_SERVER_IMAGE");
|
||||
}
|
||||
|
||||
static int build_openssh_server_docker_image(void)
|
||||
{
|
||||
if(have_docker) {
|
||||
const char *container_image_name = openssh_server_image();
|
||||
if(container_image_name) {
|
||||
int ret = run_command(NULL, "docker pull %s",
|
||||
container_image_name);
|
||||
if(ret == 0) {
|
||||
ret = run_command(NULL, "docker tag %s libssh2/openssh_server",
|
||||
container_image_name);
|
||||
if(ret == 0) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
return run_command(NULL,
|
||||
"docker build --quiet -t libssh2/openssh_server %s",
|
||||
srcdir_path("openssh_server"));
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static const char *openssh_server_port(void)
|
||||
{
|
||||
return getenv("OPENSSH_SERVER_PORT");
|
||||
}
|
||||
|
||||
static int start_openssh_server(char **container_id_out)
|
||||
{
|
||||
if(have_docker) {
|
||||
const char *container_host_port = openssh_server_port();
|
||||
if(container_host_port) {
|
||||
return run_command(container_id_out,
|
||||
"docker run --rm -d -p %s:22 "
|
||||
"libssh2/openssh_server",
|
||||
container_host_port);
|
||||
}
|
||||
|
||||
return run_command(container_id_out,
|
||||
"docker run --rm -d -p 22 "
|
||||
"libssh2/openssh_server");
|
||||
}
|
||||
else {
|
||||
*container_id_out = strdup("");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int stop_openssh_server(char *container_id)
|
||||
{
|
||||
if(have_docker) {
|
||||
return run_command(NULL, "docker stop %s", container_id);
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static const char *docker_machine_name(void)
|
||||
{
|
||||
return getenv("DOCKER_MACHINE_NAME");
|
||||
}
|
||||
|
||||
static int is_running_inside_a_container(void)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return 0;
|
||||
#else
|
||||
const char *cgroup_filename = "/proc/self/cgroup";
|
||||
FILE *f;
|
||||
char *line = NULL;
|
||||
size_t len = 0;
|
||||
ssize_t read;
|
||||
int found = 0;
|
||||
f = fopen(cgroup_filename, "r");
|
||||
if(!f) {
|
||||
/* Don't go further, we are not in a container */
|
||||
return 0;
|
||||
}
|
||||
while((read = getline(&line, &len, f)) != -1) {
|
||||
if(strstr(line, "docker")) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
free(line);
|
||||
return found;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void portable_sleep(unsigned int seconds)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
Sleep(seconds);
|
||||
#else
|
||||
sleep(seconds);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int ip_address_from_container(char *container_id, char **ip_address_out)
|
||||
{
|
||||
const char *active_docker_machine = docker_machine_name();
|
||||
if(active_docker_machine) {
|
||||
|
||||
/* This can be flaky when tests run in parallel (see
|
||||
https://github.com/docker/machine/issues/2612), so we retry a few
|
||||
times with exponential backoff if it fails */
|
||||
int attempt_no = 0;
|
||||
unsigned int wait_time = 500;
|
||||
for(;;) {
|
||||
int ret = run_command(ip_address_out, "docker-machine ip %s",
|
||||
active_docker_machine);
|
||||
if(ret == 0) {
|
||||
return 0;
|
||||
}
|
||||
else if(attempt_no > 5) {
|
||||
fprintf(
|
||||
stderr,
|
||||
"Unable to get IP from docker-machine after %d attempts\n",
|
||||
attempt_no);
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
portable_sleep(wait_time);
|
||||
++attempt_no;
|
||||
wait_time *= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(is_running_inside_a_container()) {
|
||||
return run_command(ip_address_out,
|
||||
"docker inspect --format "
|
||||
"\"{{ .NetworkSettings.IPAddress }}\""
|
||||
" %s",
|
||||
container_id);
|
||||
}
|
||||
else {
|
||||
return run_command(ip_address_out,
|
||||
"docker inspect --format "
|
||||
"\"{{ index (index (index "
|
||||
".NetworkSettings.Ports "
|
||||
"\\\"22/tcp\\\") 0) \\\"HostIp\\\" }}\" %s",
|
||||
container_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int port_from_container(char *container_id, char **port_out)
|
||||
{
|
||||
if(is_running_inside_a_container()) {
|
||||
*port_out = strdup("22");
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
return run_command(port_out,
|
||||
"docker inspect --format "
|
||||
"\"{{ index (index (index .NetworkSettings.Ports "
|
||||
"\\\"22/tcp\\\") 0) \\\"HostPort\\\" }}\" %s",
|
||||
container_id);
|
||||
}
|
||||
}
|
||||
|
||||
static libssh2_socket_t open_socket_to_container(char *container_id)
|
||||
{
|
||||
char *ip_address = NULL;
|
||||
char *port_string = NULL;
|
||||
uint32_t hostaddr;
|
||||
libssh2_socket_t sock;
|
||||
struct sockaddr_in sin;
|
||||
unsigned int counter;
|
||||
libssh2_socket_t ret = LIBSSH2_INVALID_SOCKET;
|
||||
|
||||
if(have_docker) {
|
||||
int res;
|
||||
res = ip_address_from_container(container_id, &ip_address);
|
||||
if(res) {
|
||||
fprintf(stderr, "Failed to get IP address for container %s\n",
|
||||
container_id);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
res = port_from_container(container_id, &port_string);
|
||||
if(res) {
|
||||
fprintf(stderr, "Failed to get port for container %s\n",
|
||||
container_id);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
else {
|
||||
const char *env;
|
||||
env = getenv("OPENSSH_SERVER_HOST");
|
||||
if(!env) {
|
||||
env = "127.0.0.1";
|
||||
}
|
||||
ip_address = strdup(env);
|
||||
env = openssh_server_port();
|
||||
if(!env) {
|
||||
env = "4711";
|
||||
}
|
||||
port_string = strdup(env);
|
||||
}
|
||||
|
||||
/* 0.0.0.0 is returned by Docker for Windows, because the container
|
||||
is reachable from anywhere. But we cannot connect to 0.0.0.0,
|
||||
instead we assume localhost and try to connect to 127.0.0.1. */
|
||||
if(ip_address && strcmp(ip_address, "0.0.0.0") == 0) {
|
||||
free(ip_address);
|
||||
ip_address = strdup("127.0.0.1");
|
||||
}
|
||||
|
||||
hostaddr = inet_addr(ip_address);
|
||||
if(hostaddr == (uint32_t)(-1)) {
|
||||
fprintf(stderr, "Failed to convert %s host address\n", ip_address);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if(sock == LIBSSH2_INVALID_SOCKET) {
|
||||
fprintf(stderr,
|
||||
"Failed to open socket (" LIBSSH2_SOCKET_MASK ")\n", sock);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
sin.sin_family = AF_INET;
|
||||
sin.sin_port = htons((unsigned short)strtol(port_string, NULL, 0));
|
||||
sin.sin_addr.s_addr = hostaddr;
|
||||
|
||||
for(counter = 0; counter < 3; ++counter) {
|
||||
if(connect(sock, (struct sockaddr*)(&sin),
|
||||
sizeof(struct sockaddr_in))) {
|
||||
fprintf(stderr,
|
||||
"Connection to %s:%s attempt #%d failed: retrying...\n",
|
||||
ip_address, port_string, counter);
|
||||
portable_sleep(1 + 2*counter);
|
||||
}
|
||||
else {
|
||||
ret = sock;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(ret == LIBSSH2_INVALID_SOCKET) {
|
||||
fprintf(stderr, "Failed to connect to %s:%s\n",
|
||||
ip_address, port_string);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
free(ip_address);
|
||||
free(port_string);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void close_socket_to_container(libssh2_socket_t sock)
|
||||
{
|
||||
if(sock != LIBSSH2_INVALID_SOCKET) {
|
||||
shutdown(sock, 2 /* SHUT_RDWR */);
|
||||
#ifdef _WIN32
|
||||
closesocket(sock);
|
||||
#else
|
||||
close(sock);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static char *running_container_id = NULL;
|
||||
|
||||
int start_openssh_fixture(void)
|
||||
{
|
||||
int ret;
|
||||
#ifdef _WIN32
|
||||
WSADATA wsadata;
|
||||
|
||||
ret = WSAStartup(MAKEWORD(2, 0), &wsadata);
|
||||
if(ret) {
|
||||
fprintf(stderr, "WSAStartup failed with error: %d\n", ret);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
have_docker = !getenv("OPENSSH_NO_DOCKER");
|
||||
|
||||
ret = build_openssh_server_docker_image();
|
||||
if(!ret) {
|
||||
return start_openssh_server(&running_container_id);
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "Failed to build docker image\n");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
void stop_openssh_fixture(void)
|
||||
{
|
||||
if(running_container_id) {
|
||||
stop_openssh_server(running_container_id);
|
||||
free(running_container_id);
|
||||
running_container_id = NULL;
|
||||
}
|
||||
else if(have_docker) {
|
||||
fprintf(stderr, "Cannot stop container - none started\n");
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
WSACleanup();
|
||||
#endif
|
||||
}
|
||||
|
||||
libssh2_socket_t open_socket_to_openssh_server(void)
|
||||
{
|
||||
return open_socket_to_container(running_container_id);
|
||||
}
|
||||
|
||||
void close_socket_to_openssh_server(libssh2_socket_t sock)
|
||||
{
|
||||
close_socket_to_container(sock);
|
||||
}
|
||||
49
vendor/libssh2/tests/openssh_fixture.h
vendored
Normal file
49
vendor/libssh2/tests/openssh_fixture.h
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
/* Copyright (C) Alexander Lamaison
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the copyright holder nor the names
|
||||
* of any other contributors may be used to endorse or
|
||||
* promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef LIBSSH2_TESTS_OPENSSH_FIXTURE_H
|
||||
#define LIBSSH2_TESTS_OPENSSH_FIXTURE_H
|
||||
|
||||
int start_openssh_fixture(void);
|
||||
void stop_openssh_fixture(void);
|
||||
libssh2_socket_t open_socket_to_openssh_server(void);
|
||||
void close_socket_to_openssh_server(libssh2_socket_t sock);
|
||||
int openssh_fixture_have_docker(void);
|
||||
|
||||
#endif
|
||||
3
vendor/libssh2/tests/openssh_server/.gitattributes
vendored
Normal file
3
vendor/libssh2/tests/openssh_server/.gitattributes
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# OpenSSH requires LF EOLs in key files, even on Windows, where
|
||||
# a git checkout may set CRLF EOLs by default.
|
||||
* text eol=lf
|
||||
64
vendor/libssh2/tests/openssh_server/Dockerfile
vendored
Normal file
64
vendor/libssh2/tests/openssh_server/Dockerfile
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
# Copyright (C) Alexander Lamaison <alexander.lamaison@gmail.com>
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
FROM debian:testing-slim
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y openssh-server \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN [ -d /var/run/sshd ] || mkdir /var/run/sshd
|
||||
|
||||
# Chmodding because, when building on Windows, files are copied in with
|
||||
# -rwxr-xr-x permissions.
|
||||
#
|
||||
# Copying to a temp location, then moving because chmodding the copied file has
|
||||
# no effect (Docker AUFS-related bug maybe?)
|
||||
|
||||
# Host keys
|
||||
COPY ssh_host_rsa_key /tmp/etc/ssh/ssh_host_rsa_key
|
||||
RUN install -m 0600 /tmp/etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key
|
||||
|
||||
COPY ssh_host_ecdsa_key /tmp/etc/ssh/ssh_host_ecdsa_key
|
||||
RUN install -m 0600 /tmp/etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key
|
||||
|
||||
COPY ssh_host_ed25519_key /tmp/etc/ssh/ssh_host_ed25519_key
|
||||
RUN install -m 0600 /tmp/etc/ssh/ssh_host_ed25519_key /etc/ssh/ssh_host_ed25519_key
|
||||
|
||||
# Trusted CA keys
|
||||
COPY ca_ecdsa /tmp/etc/ssh/ca_ecdsa
|
||||
RUN install -m 0600 /tmp/etc/ssh/ca_ecdsa /etc/ssh/ca_ecdsa
|
||||
|
||||
COPY ca_rsa /tmp/etc/ssh/ca_rsa
|
||||
RUN install -m 0600 /tmp/etc/ssh/ca_rsa /etc/ssh/ca_rsa
|
||||
|
||||
COPY ca_user_keys.pub /tmp/etc/ssh/ca_user_keys.pub
|
||||
RUN install -m 0600 /tmp/etc/ssh/ca_user_keys.pub /etc/ssh/ca_user_keys.pub
|
||||
|
||||
# User
|
||||
RUN adduser --disabled-password --gecos 'Test user for libssh2 integration tests' libssh2
|
||||
RUN echo 'libssh2:my test password' | chpasswd
|
||||
|
||||
# Config
|
||||
RUN sed -i 's/KbdInteractiveAuthentication no/KbdInteractiveAuthentication yes/' /etc/ssh/sshd_config
|
||||
COPY sshd_config /tmp/etc/ssh/sshd_config
|
||||
RUN cat /tmp/etc/ssh/sshd_config >> /etc/ssh/sshd_config
|
||||
RUN echo 'TrustedUserCAKeys /etc/ssh/ca_user_keys.pub' >> /etc/ssh/sshd_config
|
||||
|
||||
|
||||
# SSH login fix. Otherwise user is kicked off after login
|
||||
RUN sed 's/session\s*required\s*pam_loginuid.so/session optional pam_loginuid.so/g' -i /etc/pam.d/sshd
|
||||
|
||||
USER libssh2
|
||||
|
||||
RUN mkdir -p /home/libssh2/.ssh
|
||||
RUN mkdir -p /home/libssh2/sandbox
|
||||
|
||||
COPY authorized_keys /tmp/libssh2/.ssh/authorized_keys
|
||||
RUN install -m 0600 /tmp/libssh2/.ssh/authorized_keys /home/libssh2/.ssh/authorized_keys
|
||||
|
||||
USER root
|
||||
|
||||
EXPOSE 22
|
||||
# -e gives logs via 'docker logs'
|
||||
CMD ["/usr/sbin/sshd", "-D", "-e"]
|
||||
8
vendor/libssh2/tests/openssh_server/authorized_keys
vendored
Normal file
8
vendor/libssh2/tests/openssh_server/authorized_keys
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
ssh-dss AAAAB3NzaC1kc3MAAACBAK2Jh2Ck+8W1+LsFrjgOIH7XHySiONPSdG+faFTZprinh9cjyR3odzntVA7+UuFH14WnGM/ub6MbAXjrxDo1TzGILvW5x6nQ6hdLu7xFygihZ8sO1mIMOVqGdlNbTiYHl8XGjbLt1iXfW8ThM91LGGqmS+cgEiy0wWHYzsOXTDz9AAAAFQD/ebunYNTluoBrEYIoq3LMtQPbcwAAAIEAjPBzkUKcmfMAmb0eO/QAVXmX+L8NC6Vn2m4QguQ2IcJ8NH6VMnxXEBHsnemCOa9jN55G+LnX17PViuKS0O3rqQiSdA5wcHyCHKBT519/v1KQNymDwudfnFvdxUyAAG6MDSxKlpbXDCbrhFd2+ahC9a7rKalRPSXR0R2hhWRvjK0AAACAJ+CGwV/1S4j1GVwa6pSP0nj4V86GWXosTTBg7GT+rKWu8lrxIcr6FzLWgFi/gHoMrgnKWGxO1yF7vkoYM5Yfo84oBYiH+MgpiBuOrZrgzacHsA66JJbUfrESRFWZl2blIPr6Gyjj6cVGgMabK3yCiTRi0v7hwffpm0rKyKv7Goo= awl03@bounty
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAnak1T7zHJ+hVRFBDQ9pf1KVzmd5gaNc7y7NPmL13aOG3sYeJevi1x1WM/R3tb8XnUnzZUX9GJN0MYovvZsw9bknG1mDP72LFbGp/gzPddGIKHBBpvceDaJ85sM/ME3XOtD7uuXQuNAuEHwEzSMMiSIEMcQS+lXIcMLr5xPLEkyNvqsO5RqSjMTLHKHgY8gLWx7oQ1avokhwuDxF7P3Pqtj+rW2Te6vR0i1H6EyFPsBkzkgNXb33cus8M1CnTmYTSgJgmHO2LLcGpjQ5sL8T/PWIWHaSqTnkrFXEMysgoteXnAYILjzyBaqq2WV4KA3TluGdAP2p8gC32QtKm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T6E7VEMQudeN4iI75WYGxrYU1HCOTnsYk/9LCdM7O6ntJIlzul3CwXsD6+B35hu5AJb91RNbHYWUz key_rsa_aes256gcm
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFEg0II3zbc1yWGhRzIc5KwTRlmx10RQP0sS63+1oMPi
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICHxEyUTOVHXvdMFARedFQ+H9DW/n8Zy3daKKRqnTDMq
|
||||
ecdsa-sha2-nistp384 AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzODQAAABhBOiyJJwf+hFJrOkik9IQVxjhhVnI1vKl4BGLj03erLvw4TXXwoZzlPx6J936fU9JvvPw+d8PA4viMEfFbmdbHREKhwi3u1vZrfj0mB8SXw96AcZwX8PAL556wgom+/Qx+Q==
|
||||
12
vendor/libssh2/tests/openssh_server/ca_ecdsa
vendored
Normal file
12
vendor/libssh2/tests/openssh_server/ca_ecdsa
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
-----BEGIN OPENSSH PRIVATE KEY-----
|
||||
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAArAAAABNlY2RzYS
|
||||
1zaGEyLW5pc3RwNTIxAAAACG5pc3RwNTIxAAAAhQQAfv15s+G2xg56J+audKAM4G9qOTFr
|
||||
bZRo0CTwvkb/oHrf9/2RSWqYsx/0m5mYCZVlecnZqwRHAOolXbc/Yb4cGjsALUj3UDirsn
|
||||
YR7Ve+SwnunkpvW/H3a98sA3sS+HCpd5RbpfWClSBOI9JEAlPtS1CrEQ7EmO7hmlFOH2cL
|
||||
0qfHCyYAAAEA763VSe+t1UkAAAATZWNkc2Etc2hhMi1uaXN0cDUyMQAAAAhuaXN0cDUyMQ
|
||||
AAAIUEAH79ebPhtsYOeifmrnSgDOBvajkxa22UaNAk8L5G/6B63/f9kUlqmLMf9JuZmAmV
|
||||
ZXnJ2asERwDqJV23P2G+HBo7AC1I91A4q7J2Ee1XvksJ7p5Kb1vx92vfLAN7EvhwqXeUW6
|
||||
X1gpUgTiPSRAJT7UtQqxEOxJju4ZpRTh9nC9KnxwsmAAAAQgD8VJwi9RHYN13CAfhvdmjW
|
||||
xVjH55J5jDjPlENU2Z+cnm01SQ+9mPFEY4wDSvfiovD1VstNJX/P97WbHw+e5XL+HwAAAA
|
||||
JDQQ==
|
||||
-----END OPENSSH PRIVATE KEY-----
|
||||
1
vendor/libssh2/tests/openssh_server/ca_ecdsa.pub
vendored
Normal file
1
vendor/libssh2/tests/openssh_server/ca_ecdsa.pub
vendored
Normal file
@@ -0,0 +1 @@
|
||||
ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAB+/Xmz4bbGDnon5q50oAzgb2o5MWttlGjQJPC+Rv+get/3/ZFJapizH/SbmZgJlWV5ydmrBEcA6iVdtz9hvhwaOwAtSPdQOKuydhHtV75LCe6eSm9b8fdr3ywDexL4cKl3lFul9YKVIE4j0kQCU+1LUKsRDsSY7uGaUU4fZwvSp8cLJg== CA
|
||||
38
vendor/libssh2/tests/openssh_server/ca_rsa
vendored
Normal file
38
vendor/libssh2/tests/openssh_server/ca_rsa
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
-----BEGIN OPENSSH PRIVATE KEY-----
|
||||
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn
|
||||
NhAAAAAwEAAQAAAYEAxIgbEZbIoQoNJyRjalEYbMwmcNRcGZg6ZA+uC+hxX9lPxhVxYAwb
|
||||
WCWfM3YLmvkQPRf0DYateDlHpiV9/R4IAKMfwHMINbyj5ulj2AG9wzMs10+MLN9kmxXeZX
|
||||
f7EK6iVHjMWhS7tX9NnmNFLbUHuPpzI6DODHvfEIaO084KQyIJ/Z5bONko7eijPZrqkwSF
|
||||
b+FEsIvSLBZ/ueHtAhI34Ihcl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KEpYOd91REX7j+NOVhRUqAOVbW2DmT6Lt7aaPF5RLKEvBV
|
||||
oBR+VDyejOOBbUsimdeAriwL8jS/FwbM/NveRk3eeDsjGejl9oNqI0VsGogd5YuMC7ue3f
|
||||
aNoNL9GK1i7Gkl2RgQ9K86PUOiK14n10CgZoYQ6K9LYaciZZ+GMGJO2TX1XMMx7vVNLVFv
|
||||
+zcpm8rKEYGT0AAAAGY2FfcnNhAQIDBAU=
|
||||
-----END OPENSSH PRIVATE KEY-----
|
||||
1
vendor/libssh2/tests/openssh_server/ca_rsa.pub
vendored
Normal file
1
vendor/libssh2/tests/openssh_server/ca_rsa.pub
vendored
Normal file
@@ -0,0 +1 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDEiBsRlsihCg0nJGNqURhszCZw1FwZmDpkD64L6HFf2U/GFXFgDBtYJZ8zdgua+RA9F/QNhq14OUemJX39HggAox/Acwg1vKPm6WPYAb3DMyzXT4ws32SbFd5ld/sQrqJUeMxaFLu1f02eY0UttQe4+nMjoM4Me98Qho7TzgpDIgn9nls42Sjt6KM9muqTBIVv4USwi9IsFn+54e0CEjfgiFyU8/8bH6vp1rtMPA6m4vuidyt2pP7PHFnUnikQGsaG4ldO/D/G0FFtMqPXeC1wQXI5RHnRns9TiI6Ep3r3h64ZI5iBYZeG16Fk+nuGvtp+WLWE5m01vfEHc5o+p09j+Ni1mQ5pmUq3AOM/MZMh+eCkTstnCyng/bHEZTIKQi1nnu694Mcq8W1v34wgMyBN3bvE65NhjIdLubnHvDgzVn127wjPEdeVD9ShtACxNS4a6xJCWg6llHVyzezqnj68umXre02MsXLbFikV/fEvUOXUp/rDeo+LJizk2bHAlyk= ca_rsa
|
||||
2
vendor/libssh2/tests/openssh_server/ca_user_keys.pub
vendored
Normal file
2
vendor/libssh2/tests/openssh_server/ca_user_keys.pub
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAB+/Xmz4bbGDnon5q50oAzgb2o5MWttlGjQJPC+Rv+get/3/ZFJapizH/SbmZgJlWV5ydmrBEcA6iVdtz9hvhwaOwAtSPdQOKuydhHtV75LCe6eSm9b8fdr3ywDexL4cKl3lFul9YKVIE4j0kQCU+1LUKsRDsSY7uGaUU4fZwvSp8cLJg== CA
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDEiBsRlsihCg0nJGNqURhszCZw1FwZmDpkD64L6HFf2U/GFXFgDBtYJZ8zdgua+RA9F/QNhq14OUemJX39HggAox/Acwg1vKPm6WPYAb3DMyzXT4ws32SbFd5ld/sQrqJUeMxaFLu1f02eY0UttQe4+nMjoM4Me98Qho7TzgpDIgn9nls42Sjt6KM9muqTBIVv4USwi9IsFn+54e0CEjfgiFyU8/8bH6vp1rtMPA6m4vuidyt2pP7PHFnUnikQGsaG4ldO/D/G0FFtMqPXeC1wQXI5RHnRns9TiI6Ep3r3h64ZI5iBYZeG16Fk+nuGvtp+WLWE5m01vfEHc5o+p09j+Ni1mQ5pmUq3AOM/MZMh+eCkTstnCyng/bHEZTIKQi1nnu694Mcq8W1v34wgMyBN3bvE65NhjIdLubnHvDgzVn127wjPEdeVD9ShtACxNS4a6xJCWg6llHVyzezqnj68umXre02MsXLbFikV/fEvUOXUp/rDeo+LJizk2bHAlyk= ca_rsa
|
||||
5
vendor/libssh2/tests/openssh_server/ssh_host_ecdsa_key
vendored
Normal file
5
vendor/libssh2/tests/openssh_server/ssh_host_ecdsa_key
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIKdqGrp+52U1ehslMI4fX0cmvgHFmKSkMzQGmj6B07ecoAoGCCqGSM49
|
||||
AwEHoUQDQgAEL7+zLJ4okP10LZkf1DuIkZF5HhgzetQIyxLKeTJeiN19IKUYIxjs
|
||||
m9aW3fQRKNi/GhN9JEbHpa9qpgr+8+hhDg==
|
||||
-----END EC PRIVATE KEY-----
|
||||
7
vendor/libssh2/tests/openssh_server/ssh_host_ed25519_key
vendored
Normal file
7
vendor/libssh2/tests/openssh_server/ssh_host_ed25519_key
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
-----BEGIN OPENSSH PRIVATE KEY-----
|
||||
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
|
||||
QyNTUxOQAAACCMbXcoNmUVxO9FMMj1VB91MnwwVfBl+XDxet+j+oY6JgAAAJg8nvUxPJ71
|
||||
MQAAAAtzc2gtZWQyNTUxOQAAACCMbXcoNmUVxO9FMMj1VB91MnwwVfBl+XDxet+j+oY6Jg
|
||||
AAAECnhCuTDYdz3kUn48BXkaCXXdbKdH7wSIQ/CUx1cbnR0Ixtdyg2ZRXE70UwyPVUH3Uy
|
||||
fDBV8GX5cPF636P6hjomAAAAEHdpbGxAaUN1YmUubG9jYWwBAgMEBQ==
|
||||
-----END OPENSSH PRIVATE KEY-----
|
||||
27
vendor/libssh2/tests/openssh_server/ssh_host_rsa_key
vendored
Normal file
27
vendor/libssh2/tests/openssh_server/ssh_host_rsa_key
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIEoQIBAAKCAQEArrr/JuJmaZligyfS8vcNur+mWR2ddDQtVdhHzdKUUoR6/Om6
|
||||
cvxpe61H1YZO1xCpLUBXmkki4HoNtYOpPB2W4V+8U4BDeVBD5crypEOE1+7BAm99
|
||||
fnEDxYIOZq2/jTP0yQmzCpWYS3COyFmkOL7sfX1wQMeW5zQT2WKcxC6FSWbhDqrB
|
||||
eNEGi687hJJoJ7YXgY/IdiYW5NcOuqRSWljjGS3dAJsHHWk4nJbhjEDXbPaeduMA
|
||||
wQU9i6ELfP3r+q6wdu0P4jWaoo3De1aYxnToV/ldXykpipON4NPamsb6Ph2qlJQK
|
||||
ypq7J4iQgkII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kHRHsXkcS9Q7ohyzc6G2Hf3mGdb8RQ8HQ9
|
||||
lsiWZESwqdf+SlvOVNND27EQFV01V2gnC/JnxgfWTaJVjOf07ky4CWycdQZyHmaT
|
||||
Ko8CgYB58jOyXMdo2ggOCG/HX2H92KPPpFUBFCX27fCue8BZLD5quIltpXupx5oj
|
||||
EyltgvPcmNDgvdSadkHvP5s6nykS+n5we+d9yIIJF/BfETWsXjR3ooip+trqiirw
|
||||
0aHqUDFcYn9unm2wtrMYYViiDLRijNwLZ2sG0JIU4JHyseh+NA==
|
||||
-----END RSA PRIVATE KEY-----
|
||||
4
vendor/libssh2/tests/openssh_server/sshd_config
vendored
Normal file
4
vendor/libssh2/tests/openssh_server/sshd_config
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
HostKeyAlgorithms +ssh-rsa
|
||||
PubkeyAcceptedKeyTypes +ssh-rsa,ssh-rsa-cert-v01@openssh.com
|
||||
MACs +hmac-sha1,hmac-sha1-96,hmac-sha2-256,hmac-sha2-512,hmac-md5,hmac-md5-96,umac-64@openssh.com,umac-128@openssh.com,hmac-sha1-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-md5-etm@openssh.com,hmac-md5-96-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com
|
||||
Ciphers +3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
|
||||
2
vendor/libssh2/tests/ossfuzz/.gitignore
vendored
Normal file
2
vendor/libssh2/tests/ossfuzz/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*.a
|
||||
ssh2_client_fuzzer
|
||||
34
vendor/libssh2/tests/ossfuzz/Makefile.am
vendored
Normal file
34
vendor/libssh2/tests/ossfuzz/Makefile.am
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
AM_CPPFLAGS = -I$(top_builddir)/include
|
||||
LDADD = $(top_builddir)/src/libssh2.la
|
||||
|
||||
if USE_OSSFUZZ_FLAG
|
||||
FUZZ_FLAG = $(LIB_FUZZING_ENGINE)
|
||||
else
|
||||
if USE_OSSFUZZ_STATIC
|
||||
LDADD += $(LIB_FUZZING_ENGINE)
|
||||
FUZZ_FLAG =
|
||||
else
|
||||
LDADD += libstandaloneengine.a
|
||||
FUZZ_FLAG =
|
||||
endif
|
||||
endif
|
||||
|
||||
noinst_PROGRAMS =
|
||||
noinst_LIBRARIES =
|
||||
|
||||
if USE_OSSFUZZERS
|
||||
noinst_PROGRAMS += \
|
||||
ssh2_client_fuzzer
|
||||
|
||||
noinst_LIBRARIES += \
|
||||
libstandaloneengine.a
|
||||
endif
|
||||
|
||||
ssh2_client_fuzzer_SOURCES = ssh2_client_fuzzer.cc testinput.h
|
||||
ssh2_client_fuzzer_CXXFLAGS = $(AM_CXXFLAGS) $(FUZZ_FLAG)
|
||||
ssh2_client_fuzzer_LDFLAGS = $(AM_LDFLAGS) -static
|
||||
|
||||
libstandaloneengine_a_SOURCES = standaloneengine.cc
|
||||
libstandaloneengine_a_CXXFLAGS = $(AM_CXXFLAGS)
|
||||
|
||||
EXTRA_DIST = ossfuzz.sh
|
||||
33
vendor/libssh2/tests/ossfuzz/ossfuzz.sh
vendored
Executable file
33
vendor/libssh2/tests/ossfuzz/ossfuzz.sh
vendored
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eu
|
||||
|
||||
# This script is called by the oss-fuzz main project when compiling the fuzz
|
||||
# targets. This script is regression tested by ci/ossfuzz.sh.
|
||||
|
||||
# Save off the current folder as the build root.
|
||||
export BUILD_ROOT="$PWD"
|
||||
|
||||
echo "CC: $CC"
|
||||
echo "CXX: $CXX"
|
||||
echo "LIB_FUZZING_ENGINE: $LIB_FUZZING_ENGINE"
|
||||
echo "CFLAGS: $CFLAGS"
|
||||
echo "CXXFLAGS: $CXXFLAGS"
|
||||
echo "OUT: $OUT"
|
||||
|
||||
MAKEFLAGS+="-j$(nproc)"
|
||||
export MAKEFLAGS
|
||||
|
||||
# Install dependencies
|
||||
apt-get -y install automake libtool libssl-dev zlib1g-dev
|
||||
|
||||
# Compile the fuzzer.
|
||||
autoreconf -fi
|
||||
./configure --disable-shared \
|
||||
--enable-ossfuzzers \
|
||||
--disable-examples-build \
|
||||
--enable-debug
|
||||
make V=1
|
||||
|
||||
# Copy the fuzzer to the output directory.
|
||||
cp -v tests/ossfuzz/ssh2_client_fuzzer "$OUT/"
|
||||
97
vendor/libssh2/tests/ossfuzz/ssh2_client_fuzzer.cc
vendored
Normal file
97
vendor/libssh2/tests/ossfuzz/ssh2_client_fuzzer.cc
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
/* Copyright (C) The libssh2 project and its contributors.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
#include <libssh2.h>
|
||||
#include "testinput.h"
|
||||
|
||||
#define FUZZ_ASSERT(COND) \
|
||||
if(!(COND)) \
|
||||
{ \
|
||||
fprintf(stderr, "Assertion failed: " #COND "\n%s", \
|
||||
strerror(errno)); \
|
||||
assert((COND)); \
|
||||
}
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
{
|
||||
int socket_fds[2] = {-1, -1};
|
||||
ssize_t written;
|
||||
int rc;
|
||||
LIBSSH2_SESSION *session = NULL;
|
||||
int handshake_completed = 0;
|
||||
|
||||
rc = libssh2_init(0);
|
||||
|
||||
if(rc) {
|
||||
fprintf(stderr, "libssh2 initialization failed (%d)\n", rc);
|
||||
goto EXIT_LABEL;
|
||||
}
|
||||
|
||||
// Create a socket pair so data can be sent in.
|
||||
rc = socketpair(AF_UNIX, SOCK_STREAM, 0, socket_fds);
|
||||
FUZZ_ASSERT(rc == 0);
|
||||
|
||||
written = send(socket_fds[1], data, size, 0);
|
||||
|
||||
if(written != size)
|
||||
{
|
||||
// Handle whatever error case we're in.
|
||||
fprintf(stderr, "send() of %zu bytes returned %zu (%d)\n",
|
||||
size,
|
||||
written,
|
||||
errno);
|
||||
goto EXIT_LABEL;
|
||||
}
|
||||
|
||||
rc = shutdown(socket_fds[1], SHUT_WR);
|
||||
if(rc)
|
||||
{
|
||||
fprintf(stderr, "socket shutdown failed (%d)\n", rc);
|
||||
goto EXIT_LABEL;
|
||||
}
|
||||
|
||||
// Create a session and start the handshake using the fuzz data passed in.
|
||||
session = libssh2_session_init();
|
||||
if(session) {
|
||||
libssh2_session_set_blocking(session, 1);
|
||||
}
|
||||
else {
|
||||
goto EXIT_LABEL;
|
||||
}
|
||||
|
||||
if(libssh2_session_handshake(session, socket_fds[0])) {
|
||||
goto EXIT_LABEL;
|
||||
}
|
||||
|
||||
// If we get here the handshake actually completed.
|
||||
handshake_completed = 1;
|
||||
|
||||
EXIT_LABEL:
|
||||
|
||||
if(session)
|
||||
{
|
||||
if(handshake_completed)
|
||||
{
|
||||
libssh2_session_disconnect(session,
|
||||
"Normal Shutdown, Thank you for playing");
|
||||
}
|
||||
|
||||
libssh2_session_free(session);
|
||||
}
|
||||
|
||||
libssh2_exit();
|
||||
|
||||
close(socket_fds[0]);
|
||||
close(socket_fds[1]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
77
vendor/libssh2/tests/ossfuzz/standaloneengine.cc
vendored
Normal file
77
vendor/libssh2/tests/ossfuzz/standaloneengine.cc
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
/* Copyright (C) The libssh2 project and its contributors.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "testinput.h"
|
||||
|
||||
/**
|
||||
* Main procedure for standalone fuzzing engine.
|
||||
*
|
||||
* Reads filenames from the argument array. For each filename, read the file
|
||||
* into memory and then call the fuzzing interface with the data.
|
||||
*/
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int ii;
|
||||
for(ii = 1; ii < argc; ii++)
|
||||
{
|
||||
FILE *infile;
|
||||
printf("[%s] ", argv[ii]);
|
||||
|
||||
/* Try and open the file. */
|
||||
infile = fopen(argv[ii], "rb");
|
||||
if(infile)
|
||||
{
|
||||
uint8_t *buffer = NULL;
|
||||
size_t buffer_len;
|
||||
|
||||
printf("Opened.. ");
|
||||
|
||||
/* Get the length of the file. */
|
||||
fseek(infile, 0L, SEEK_END);
|
||||
buffer_len = ftell(infile);
|
||||
|
||||
/* Reset the file indicator to the beginning of the file. */
|
||||
fseek(infile, 0L, SEEK_SET);
|
||||
|
||||
/* Allocate a buffer for the file contents. */
|
||||
buffer = (uint8_t *)calloc(buffer_len, sizeof(uint8_t));
|
||||
if(buffer)
|
||||
{
|
||||
/* Read all the text from the file into the buffer. */
|
||||
fread(buffer, sizeof(uint8_t), buffer_len, infile);
|
||||
printf("Read %zu bytes, fuzzing.. ", buffer_len);
|
||||
|
||||
/* Call the fuzzer with the data. */
|
||||
LLVMFuzzerTestOneInput(buffer, buffer_len);
|
||||
|
||||
printf("complete.");
|
||||
|
||||
/* Free the buffer as it's no longer needed. */
|
||||
free(buffer);
|
||||
buffer = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr,
|
||||
"[%s] Failed to allocate %zu bytes \n",
|
||||
argv[ii],
|
||||
buffer_len);
|
||||
}
|
||||
|
||||
/* Close the file as it's no longer needed. */
|
||||
fclose(infile);
|
||||
infile = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Failed to open the file. Maybe wrong name or wrong permissions? */
|
||||
fprintf(stderr, "[%s] Open failed. \n", argv[ii]);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
7
vendor/libssh2/tests/ossfuzz/testinput.h
vendored
Normal file
7
vendor/libssh2/tests/ossfuzz/testinput.h
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/* Copyright (C) The libssh2 project and its contributors.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
#include <inttypes.h>
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
|
||||
79
vendor/libssh2/tests/runner.c
vendored
Normal file
79
vendor/libssh2/tests/runner.c
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
/* Copyright (C) Alexander Lamaison
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the copyright holder nor the names
|
||||
* of any other contributors may be used to endorse or
|
||||
* promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "runner.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int exit_code;
|
||||
int retries = 0, retry = 0;
|
||||
|
||||
#ifdef LIBSSH2_WINCNG
|
||||
/* FIXME: Retry tests with WinCNG due to flakiness in hostkey
|
||||
verification: https://github.com/libssh2/libssh2/issues/804 */
|
||||
retries += 2;
|
||||
#endif
|
||||
|
||||
do {
|
||||
int skipped, rc;
|
||||
LIBSSH2_SESSION *session = start_session_fixture(&skipped, &rc);
|
||||
if(session) {
|
||||
exit_code = (test(session) == 0) ? 0 : 1;
|
||||
}
|
||||
else if(skipped) {
|
||||
fprintf(stderr, "Test skipped.\n");
|
||||
exit_code = 0;
|
||||
}
|
||||
else {
|
||||
exit_code = 1;
|
||||
}
|
||||
stop_session_fixture();
|
||||
if(exit_code == 0 ||
|
||||
#ifdef LIBSSH2_WINCNG
|
||||
rc != LIBSSH2_ERROR_KEY_EXCHANGE_FAILURE ||
|
||||
#endif
|
||||
++retry > retries) {
|
||||
break;
|
||||
}
|
||||
fprintf(stderr, "Test failed (%d). Retrying... %d / %d\n",
|
||||
rc, retry, retries);
|
||||
} while(1);
|
||||
|
||||
return exit_code;
|
||||
}
|
||||
49
vendor/libssh2/tests/runner.h
vendored
Normal file
49
vendor/libssh2/tests/runner.h
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
/* Copyright (C) Alexander Lamaison
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the copyright holder nor the names
|
||||
* of any other contributors may be used to endorse or
|
||||
* promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef LIBSSH2_TESTS_RUNNER_H
|
||||
#define LIBSSH2_TESTS_RUNNER_H
|
||||
|
||||
/* Most tests need these */
|
||||
#include "session_fixture.h"
|
||||
#include <stdio.h>
|
||||
|
||||
int test(LIBSSH2_SESSION *session);
|
||||
|
||||
#endif
|
||||
538
vendor/libssh2/tests/session_fixture.c
vendored
Normal file
538
vendor/libssh2/tests/session_fixture.c
vendored
Normal file
@@ -0,0 +1,538 @@
|
||||
/* Copyright (C) Alexander Lamaison
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the copyright holder nor the names
|
||||
* of any other contributors may be used to endorse or
|
||||
* promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "session_fixture.h"
|
||||
#include "openssh_fixture.h"
|
||||
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h> /* for getenv() */
|
||||
#include <assert.h>
|
||||
|
||||
static LIBSSH2_SESSION *connected_session = NULL;
|
||||
static libssh2_socket_t connected_socket = LIBSSH2_INVALID_SOCKET;
|
||||
|
||||
static int connect_to_server(void)
|
||||
{
|
||||
int rc;
|
||||
connected_socket = open_socket_to_openssh_server();
|
||||
if(connected_socket == LIBSSH2_INVALID_SOCKET) {
|
||||
return LIBSSH2_ERROR_SOCKET_NONE;
|
||||
}
|
||||
|
||||
rc = libssh2_session_handshake(connected_session, connected_socket);
|
||||
if(rc) {
|
||||
print_last_session_error("libssh2_session_handshake");
|
||||
return libssh2_session_last_errno(connected_session);
|
||||
}
|
||||
|
||||
return LIBSSH2_ERROR_NONE;
|
||||
}
|
||||
|
||||
/* List of crypto protocols for which tests are skipped */
|
||||
static char const *skip_crypt[] = {
|
||||
#ifdef LIBSSH2_MBEDTLS
|
||||
/* Due to a bug with mbedTLS support, these crypt methods fail.
|
||||
Until that bug is fixed, don't run them there to avoid this
|
||||
known issue causing red tests.
|
||||
See: https://github.com/libssh2/libssh2/issues/793
|
||||
*/
|
||||
"3des-cbc",
|
||||
"aes128-cbc",
|
||||
"aes192-cbc",
|
||||
"aes256-cbc",
|
||||
"aes128-gcm@openssh.com",
|
||||
"aes256-gcm@openssh.com",
|
||||
"rijndael-cbc@lysator.liu.se",
|
||||
#endif
|
||||
|
||||
#if !LIBSSH2_3DES
|
||||
"3des-cbc",
|
||||
#endif
|
||||
|
||||
#if !LIBSSH2_AES_GCM
|
||||
/* Support for AES-GCM hasn't been added to these back-ends yet */
|
||||
"aes128-gcm@openssh.com",
|
||||
"aes256-gcm@openssh.com",
|
||||
#endif
|
||||
|
||||
NULL
|
||||
};
|
||||
|
||||
/* List of MAC protocols for which tests are skipped */
|
||||
static char const *skip_mac[] = {
|
||||
#if !LIBSSH2_MD5
|
||||
"hmac-md5",
|
||||
"hmac-md5-96",
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
|
||||
LIBSSH2_SESSION *start_session_fixture(int *skipped, int *err)
|
||||
{
|
||||
int rc;
|
||||
|
||||
const char *crypt = getenv("FIXTURE_TEST_CRYPT");
|
||||
const char *mac = getenv("FIXTURE_TEST_MAC");
|
||||
|
||||
*skipped = 0;
|
||||
*err = LIBSSH2_ERROR_NONE;
|
||||
|
||||
if(crypt) {
|
||||
char const * const *sk;
|
||||
for(sk = skip_crypt; *sk; ++sk) {
|
||||
if(strcmp(*sk, crypt) == 0) {
|
||||
fprintf(stderr, "unsupported crypt algorithm (%s) skipped.\n",
|
||||
crypt);
|
||||
*skipped = 1;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(mac) {
|
||||
char const * const *sk;
|
||||
for(sk = skip_mac; *sk; ++sk) {
|
||||
if(strcmp(*sk, mac) == 0) {
|
||||
fprintf(stderr, "unsupported MAC algorithm (%s) skipped.\n",
|
||||
mac);
|
||||
*skipped = 1;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rc = start_openssh_fixture();
|
||||
if(rc) {
|
||||
return NULL;
|
||||
}
|
||||
rc = libssh2_init(0);
|
||||
if(rc) {
|
||||
fprintf(stderr, "libssh2_init failed (%d)\n", rc);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
connected_session = libssh2_session_init_ex(NULL, NULL, NULL, NULL);
|
||||
if(!connected_session) {
|
||||
fprintf(stderr, "libssh2_session_init_ex failed\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(getenv("FIXTURE_TRACE_ALL_CONNECT")) {
|
||||
libssh2_trace(connected_session, ~0);
|
||||
fprintf(stdout, "Trace all enabled for connect_to_server.\n");
|
||||
}
|
||||
else if(getenv("FIXTURE_TRACE_ALL")) {
|
||||
libssh2_trace(connected_session, ~0);
|
||||
fprintf(stdout, "Trace all enabled.\n");
|
||||
}
|
||||
|
||||
/* Override crypt algorithm for the test */
|
||||
if(crypt) {
|
||||
if(libssh2_session_method_pref(connected_session,
|
||||
LIBSSH2_METHOD_CRYPT_CS, crypt) ||
|
||||
libssh2_session_method_pref(connected_session,
|
||||
LIBSSH2_METHOD_CRYPT_SC, crypt)) {
|
||||
fprintf(stderr, "libssh2_session_method_pref CRYPT failed "
|
||||
"(probably disabled in the build): '%s'\n", crypt);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Override mac algorithm for the test */
|
||||
if(mac) {
|
||||
if(libssh2_session_method_pref(connected_session,
|
||||
LIBSSH2_METHOD_MAC_CS, mac) ||
|
||||
libssh2_session_method_pref(connected_session,
|
||||
LIBSSH2_METHOD_MAC_SC, mac)) {
|
||||
fprintf(stderr, "libssh2_session_method_pref MAC failed "
|
||||
"(probably disabled in the build): '%s'\n", mac);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
libssh2_session_set_blocking(connected_session, 1);
|
||||
|
||||
rc = connect_to_server();
|
||||
if(rc != LIBSSH2_ERROR_NONE) {
|
||||
*err = rc;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(getenv("FIXTURE_TRACE_ALL_CONNECT")) {
|
||||
libssh2_trace(connected_session, 0);
|
||||
}
|
||||
|
||||
return connected_session;
|
||||
}
|
||||
|
||||
void print_last_session_error(const char *function)
|
||||
{
|
||||
if(connected_session) {
|
||||
char *message;
|
||||
int rc =
|
||||
libssh2_session_last_error(connected_session, &message, NULL, 0);
|
||||
fprintf(stderr, "%s failed (%d): %s\n", function, rc, message);
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "No session\n");
|
||||
}
|
||||
}
|
||||
|
||||
void stop_session_fixture(void)
|
||||
{
|
||||
if(connected_session) {
|
||||
libssh2_session_disconnect(connected_session, "test ended");
|
||||
libssh2_session_free(connected_session);
|
||||
connected_session = NULL;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "Cannot stop session - none started\n");
|
||||
}
|
||||
|
||||
close_socket_to_openssh_server(connected_socket);
|
||||
connected_socket = LIBSSH2_INVALID_SOCKET;
|
||||
|
||||
srcdir_path(NULL); /* cleanup allocated filepath */
|
||||
|
||||
libssh2_exit();
|
||||
|
||||
stop_openssh_fixture();
|
||||
}
|
||||
|
||||
|
||||
/* Return a static string that contains a file path relative to the srcdir
|
||||
* variable, if found.
|
||||
*/
|
||||
#define NUMPATHS 32
|
||||
char *srcdir_path(const char *file)
|
||||
{
|
||||
static char *filepath[NUMPATHS];
|
||||
static int curpath;
|
||||
char *p = getenv("srcdir");
|
||||
if(file) {
|
||||
int len;
|
||||
if(curpath >= NUMPATHS) {
|
||||
fprintf(stderr, "srcdir_path ran out of filepath slots.\n");
|
||||
}
|
||||
assert(curpath < NUMPATHS);
|
||||
if(p) {
|
||||
len = snprintf(NULL, 0, "%s/%s", p, file);
|
||||
if(len > 2) {
|
||||
filepath[curpath] = calloc(1, (size_t)len + 1);
|
||||
snprintf(filepath[curpath], (size_t)len + 1, "%s/%s", p, file);
|
||||
}
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
len = snprintf(NULL, 0, "%s", file);
|
||||
if(len > 0) {
|
||||
filepath[curpath] = calloc(1, (size_t)len + 1);
|
||||
snprintf(filepath[curpath], (size_t)len + 1, "%s", file);
|
||||
}
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return filepath[curpath++];
|
||||
}
|
||||
else {
|
||||
int i;
|
||||
for(i = 0; i < curpath; ++i) {
|
||||
free(filepath[curpath]);
|
||||
}
|
||||
curpath = 0;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static const char *kbd_password;
|
||||
|
||||
static void kbd_callback(const char *name, int name_len,
|
||||
const char *instruct, int instruct_len,
|
||||
int num_prompts,
|
||||
const LIBSSH2_USERAUTH_KBDINT_PROMPT *prompts,
|
||||
LIBSSH2_USERAUTH_KBDINT_RESPONSE *responses,
|
||||
void **abstract)
|
||||
{
|
||||
int i;
|
||||
(void)abstract;
|
||||
|
||||
fprintf(stdout, "Kb-int name: %.*s\n", name_len, name);
|
||||
fprintf(stdout, "Kb-int instruction: %.*s\n", instruct_len, instruct);
|
||||
for(i = 0; i < num_prompts; ++i) {
|
||||
fprintf(stdout, "Kb-int prompt %d: %.*s\n", i,
|
||||
(int)prompts[i].length, prompts[i].text);
|
||||
}
|
||||
|
||||
if(num_prompts == 1) {
|
||||
responses[0].text = strdup(kbd_password);
|
||||
responses[0].length = (unsigned int)strlen(kbd_password);
|
||||
}
|
||||
}
|
||||
|
||||
int test_auth_keyboard(LIBSSH2_SESSION *session, int flags,
|
||||
const char *username,
|
||||
const char *password)
|
||||
{
|
||||
int rc;
|
||||
|
||||
const char *userauth_list =
|
||||
libssh2_userauth_list(session, username,
|
||||
(unsigned int)strlen(username));
|
||||
if(!userauth_list) {
|
||||
print_last_session_error("libssh2_userauth_list");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(!strstr(userauth_list, "keyboard-interactive")) {
|
||||
fprintf(stderr,
|
||||
"'keyboard-interactive' was expected in userauth list: %s\n",
|
||||
userauth_list);
|
||||
return 1;
|
||||
}
|
||||
|
||||
kbd_password = password;
|
||||
|
||||
rc = libssh2_userauth_keyboard_interactive_ex(session, username,
|
||||
(unsigned int)strlen(username),
|
||||
kbd_callback);
|
||||
|
||||
kbd_password = NULL;
|
||||
|
||||
if((flags & TEST_AUTH_SHOULDFAIL) != 0) {
|
||||
if(rc == 0) {
|
||||
fprintf(stderr, "Keyboard-interactive auth succeeded "
|
||||
"with wrong response\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(rc) {
|
||||
print_last_session_error(
|
||||
"libssh2_userauth_keyboard_interactive_ex");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_auth_password(LIBSSH2_SESSION *session, int flags,
|
||||
const char *username,
|
||||
const char *password)
|
||||
{
|
||||
int rc;
|
||||
|
||||
const char *userauth_list =
|
||||
libssh2_userauth_list(session, username,
|
||||
(unsigned int)strlen(username));
|
||||
if(!userauth_list) {
|
||||
print_last_session_error("libssh2_userauth_list");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(!strstr(userauth_list, "password")) {
|
||||
fprintf(stderr, "'password' was expected in userauth list: %s\n",
|
||||
userauth_list);
|
||||
return 1;
|
||||
}
|
||||
|
||||
rc = libssh2_userauth_password_ex(session, username,
|
||||
(unsigned int)strlen(username),
|
||||
password,
|
||||
(unsigned int)strlen(password),
|
||||
NULL);
|
||||
|
||||
if((flags & TEST_AUTH_SHOULDFAIL) != 0) {
|
||||
if(rc == 0) {
|
||||
fprintf(stderr, "Password auth succeeded with wrong password\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(rc) {
|
||||
print_last_session_error("libssh2_userauth_password_ex");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(libssh2_userauth_authenticated(session) == 0) {
|
||||
fprintf(stderr, "Password auth appeared to succeed but "
|
||||
"libssh2_userauth_authenticated returned 0\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int read_file(const char *path, char **out_buffer, size_t *out_len)
|
||||
{
|
||||
FILE *fp;
|
||||
char *buffer;
|
||||
ssize_t len;
|
||||
|
||||
if(!out_buffer || !out_len || !path) {
|
||||
fprintf(stderr, "invalid params.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
*out_buffer = NULL;
|
||||
*out_len = 0;
|
||||
|
||||
fp = fopen(path, "r");
|
||||
|
||||
if(!fp) {
|
||||
fprintf(stderr, "File could not be read: %s\n", path);
|
||||
return 1;
|
||||
}
|
||||
|
||||
fseek(fp, 0L, SEEK_END);
|
||||
len = ftell(fp);
|
||||
if(len < 0) {
|
||||
fclose(fp);
|
||||
fprintf(stderr, "Could not determine input size of: %s\n", path);
|
||||
return 1;
|
||||
}
|
||||
rewind(fp);
|
||||
|
||||
buffer = calloc(1, (size_t)len + 1);
|
||||
if(!buffer) {
|
||||
fclose(fp);
|
||||
fprintf(stderr, "Could not alloc memory.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(1 != fread(buffer, (size_t)len, 1, fp)) {
|
||||
fclose(fp);
|
||||
free(buffer);
|
||||
fprintf(stderr, "Could not read file into memory.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
||||
*out_buffer = buffer;
|
||||
*out_len = (size_t)len;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_auth_pubkey(LIBSSH2_SESSION *session, int flags,
|
||||
const char *username,
|
||||
const char *password,
|
||||
const char *fn_pub,
|
||||
const char *fn_priv)
|
||||
{
|
||||
int rc;
|
||||
const char *userauth_list;
|
||||
|
||||
/* Ignore our hard-wired Dockerfile user when not running under Docker */
|
||||
if(!openssh_fixture_have_docker() && strcmp(username, "libssh2") == 0) {
|
||||
username = getenv("USER");
|
||||
if(!username) {
|
||||
#ifdef _WIN32
|
||||
username = getenv("USERNAME");
|
||||
#else
|
||||
username = getenv("LOGNAME");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
userauth_list = libssh2_userauth_list(session, username,
|
||||
(unsigned int)strlen(username));
|
||||
if(!userauth_list) {
|
||||
print_last_session_error("libssh2_userauth_list");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(!strstr(userauth_list, "publickey")) {
|
||||
fprintf(stderr, "'publickey' was expected in userauth list: %s\n",
|
||||
userauth_list);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if((flags & TEST_AUTH_FROMMEM) != 0) {
|
||||
char *buffer = NULL;
|
||||
size_t len = 0;
|
||||
|
||||
if(read_file(srcdir_path(fn_priv), &buffer, &len)) {
|
||||
fprintf(stderr, "Reading key file failed.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
rc = libssh2_userauth_publickey_frommemory(session,
|
||||
username, strlen(username),
|
||||
NULL, 0,
|
||||
buffer, len,
|
||||
NULL);
|
||||
|
||||
free(buffer);
|
||||
}
|
||||
else {
|
||||
rc = libssh2_userauth_publickey_fromfile_ex(session, username,
|
||||
(unsigned int)strlen(username),
|
||||
srcdir_path(fn_pub),
|
||||
srcdir_path(fn_priv),
|
||||
password);
|
||||
}
|
||||
|
||||
if((flags & TEST_AUTH_SHOULDFAIL) != 0) {
|
||||
if(rc == 0) {
|
||||
fprintf(stderr, "Public-key auth succeeded with wrong key\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(rc) {
|
||||
print_last_session_error("libssh2_userauth_publickey_fromfile_ex");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
69
vendor/libssh2/tests/session_fixture.h
vendored
Normal file
69
vendor/libssh2/tests/session_fixture.h
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
/* Copyright (C) Alexander Lamaison
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the copyright holder nor the names
|
||||
* of any other contributors may be used to endorse or
|
||||
* promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef LIBSSH2_TESTS_SESSION_FIXTURE_H
|
||||
#define LIBSSH2_TESTS_SESSION_FIXTURE_H
|
||||
|
||||
#define LIBSSH2_TESTS
|
||||
|
||||
#include "libssh2_priv.h"
|
||||
|
||||
LIBSSH2_SESSION *start_session_fixture(int *skipped, int *err);
|
||||
void stop_session_fixture(void);
|
||||
void print_last_session_error(const char *function);
|
||||
char *srcdir_path(const char *file);
|
||||
|
||||
#define TEST_AUTH_SHOULDFAIL 1
|
||||
#define TEST_AUTH_FROMMEM 2
|
||||
|
||||
int test_auth_keyboard(LIBSSH2_SESSION *session, int flags,
|
||||
const char *username,
|
||||
const char *password);
|
||||
|
||||
int test_auth_password(LIBSSH2_SESSION *session, int flags,
|
||||
const char *username,
|
||||
const char *password);
|
||||
|
||||
int test_auth_pubkey(LIBSSH2_SESSION *session, int flags,
|
||||
const char *username,
|
||||
const char *password,
|
||||
const char *fn_pub,
|
||||
const char *fn_priv);
|
||||
|
||||
#endif
|
||||
24
vendor/libssh2/tests/test_aa_warmup.c
vendored
Normal file
24
vendor/libssh2/tests/test_aa_warmup.c
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/* Copyright (C) Viktor Szakats
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
/* Warm-up test. Always return success.
|
||||
Workaround for CI/docker/etc flakiness on the first run. */
|
||||
|
||||
#include "runner.h"
|
||||
|
||||
int test(LIBSSH2_SESSION *session)
|
||||
{
|
||||
size_t len = 0;
|
||||
int type = 0;
|
||||
const char *hostkey = libssh2_session_hostkey(session, &len, &type);
|
||||
|
||||
(void)hostkey;
|
||||
|
||||
fprintf(stdout,
|
||||
"libssh2_session_hostkey returned len, type: %ld, %d\n",
|
||||
(long)len, type);
|
||||
|
||||
return 0; /* always return success */
|
||||
}
|
||||
57
vendor/libssh2/tests/test_agent_forward_ok.c
vendored
Normal file
57
vendor/libssh2/tests/test_agent_forward_ok.c
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
/* Copyright (C) The libssh2 project and its contributors.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "runner.h"
|
||||
|
||||
static const char *username = "libssh2"; /* set in Dockerfile */
|
||||
static const char *key_file_private = "key_rsa";
|
||||
static const char *key_file_public = "key_rsa.pub"; /* set in Dockerfile */
|
||||
|
||||
int test(LIBSSH2_SESSION *session)
|
||||
{
|
||||
int rc;
|
||||
LIBSSH2_CHANNEL *channel;
|
||||
|
||||
const char *userauth_list =
|
||||
libssh2_userauth_list(session, username,
|
||||
(unsigned int)strlen(username));
|
||||
if(!userauth_list) {
|
||||
print_last_session_error("libssh2_userauth_list");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(!strstr(userauth_list, "publickey")) {
|
||||
fprintf(stderr, "'publickey' was expected in userauth list: %s\n",
|
||||
userauth_list);
|
||||
return 1;
|
||||
}
|
||||
|
||||
rc = libssh2_userauth_publickey_fromfile_ex(session, username,
|
||||
(unsigned int)strlen(username),
|
||||
srcdir_path(key_file_public),
|
||||
srcdir_path(key_file_private),
|
||||
NULL);
|
||||
if(rc) {
|
||||
print_last_session_error("libssh2_userauth_publickey_fromfile_ex");
|
||||
return 1;
|
||||
}
|
||||
|
||||
channel = libssh2_channel_open_session(session);
|
||||
#if 0
|
||||
if(!channel) {
|
||||
printf("Error opening channel\n");
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
rc = libssh2_channel_request_auth_agent(channel);
|
||||
if(rc) {
|
||||
fprintf(stderr, "Auth agent request for agent forwarding failed, "
|
||||
"error code %d\n", rc);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
13
vendor/libssh2/tests/test_auth_keyboard_fail.c
vendored
Normal file
13
vendor/libssh2/tests/test_auth_keyboard_fail.c
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
/* Copyright (C) The libssh2 project and its contributors.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "runner.h"
|
||||
|
||||
int test(LIBSSH2_SESSION *session)
|
||||
{
|
||||
return test_auth_keyboard(session, TEST_AUTH_SHOULDFAIL,
|
||||
"libssh2", /* set in Dockerfile */
|
||||
"I am the wrong password");
|
||||
}
|
||||
331
vendor/libssh2/tests/test_auth_keyboard_info_request.c
vendored
Normal file
331
vendor/libssh2/tests/test_auth_keyboard_info_request.c
vendored
Normal file
@@ -0,0 +1,331 @@
|
||||
/* Copyright (C) Xaver Loppenstedt
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the copyright holder nor the names
|
||||
* of any other contributors may be used to endorse or
|
||||
* promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "libssh2_priv.h"
|
||||
#include "userauth_kbd_packet.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define PASS 0
|
||||
#define FAIL -1
|
||||
|
||||
struct expected {
|
||||
int rc;
|
||||
int last_error_code;
|
||||
const char *last_error_message;
|
||||
};
|
||||
struct test_case {
|
||||
const char *data;
|
||||
unsigned int data_len;
|
||||
struct expected expected;
|
||||
};
|
||||
|
||||
#define TEST_CASES_LEN 16
|
||||
static const struct test_case
|
||||
test_cases[TEST_CASES_LEN] = {
|
||||
/* too small */
|
||||
{
|
||||
NULL, 0,
|
||||
{FAIL, -38,
|
||||
"userauth keyboard data buffer too small to get length"}},
|
||||
/* too small */
|
||||
{
|
||||
"1234", 4,
|
||||
{FAIL, -38,
|
||||
"userauth keyboard data buffer too small to get length"}},
|
||||
/* smallest valid packet possible */
|
||||
{
|
||||
"<"
|
||||
"\0\0\0\0"
|
||||
"\0\0\0\0"
|
||||
"\0\0\0\0"
|
||||
"\0\0\0\0", 17,
|
||||
{PASS, 0, ""}},
|
||||
/* overrun name */
|
||||
{
|
||||
"<"
|
||||
"\0\0\0\x7f"
|
||||
"\0\0\0\0"
|
||||
"\0\0\0\0"
|
||||
"\0\0\0\0", 17,
|
||||
{FAIL, -6,
|
||||
"Unable to decode keyboard-interactive 'name' request field"}},
|
||||
/* overrun instruction */
|
||||
{
|
||||
"<"
|
||||
"\0\0\0\0"
|
||||
"\0\0\0\x7f"
|
||||
"\0\0\0\0"
|
||||
"\0\0\0\0", 17,
|
||||
{FAIL, -6,
|
||||
"Unable to decode keyboard-interactive 'instruction' "
|
||||
"request field"}},
|
||||
/* overrun language */
|
||||
{
|
||||
"<"
|
||||
"\0\0\0\0"
|
||||
"\0\0\0\0"
|
||||
"\0\0\0\x7f"
|
||||
"\0\0\0\0", 17,
|
||||
{FAIL, -6,
|
||||
"Unable to decode keyboard-interactive 'language tag' "
|
||||
"request field"}},
|
||||
/* underrun prompt number */
|
||||
{
|
||||
"<"
|
||||
"\0\0\0\x01"
|
||||
"\0\0\0\0"
|
||||
"\0\0\0\0"
|
||||
"\0\0\0\0", 17,
|
||||
{FAIL, -38,
|
||||
"Unable to decode keyboard-interactive number of "
|
||||
"keyboard prompts"}},
|
||||
/* too many prompts */
|
||||
{
|
||||
"<"
|
||||
"\0\0\0\0"
|
||||
"\0\0\0\0"
|
||||
"\0\0\0\0"
|
||||
"\0\0\0\x7f", 17,
|
||||
{FAIL, -41, "Too many replies for keyboard-interactive prompts"}},
|
||||
/* empty prompt */
|
||||
{
|
||||
"<"
|
||||
"\0\0\0\0"
|
||||
"\0\0\0\0"
|
||||
"\0\0\0\0"
|
||||
"\0\0\0\x01"
|
||||
"\0\0\0\0"
|
||||
"\0", 22,
|
||||
{PASS, 0, ""}},
|
||||
/* copied from OpenSSH */
|
||||
{
|
||||
"<"
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x01"
|
||||
"\0\0\0\x0aPassword: \0", 32,
|
||||
{PASS, 0, ""}},
|
||||
/* overrun in prompt text */
|
||||
{
|
||||
"<"
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x01"
|
||||
"\0\0\0\x7bPassword: \0", 32,
|
||||
{FAIL, -6,
|
||||
"Unable to decode keyboard-interactive "
|
||||
"prompt message"}},
|
||||
/* no echo prompt boolean */
|
||||
{
|
||||
"<"
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x01"
|
||||
"\0\0\0\x0bPassword: \0", 32,
|
||||
{FAIL, -38, "Unable to decode user auth keyboard prompt echo"}},
|
||||
/* two prompts */
|
||||
{
|
||||
"<"
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x02"
|
||||
"\0\0\0\x0aPassword: \0"
|
||||
"\0\0\0\x07Token: \1", 44,
|
||||
{PASS, 0, ""}},
|
||||
/* example from RFC 4256 */
|
||||
{
|
||||
"<"
|
||||
"\0\0\0\x19""CRYPTOCard Authentication"
|
||||
"\0\0\0\x1b""The challenge is '14315716'"
|
||||
"\0\0\0\x05""en-US"
|
||||
"\0\0\0\x01"
|
||||
"\0\0\0\x0aResponse: "
|
||||
"\x01"
|
||||
, 89,
|
||||
{PASS, 0, ""}},
|
||||
/* three prompts, 3rd missing */
|
||||
{
|
||||
"<"
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x03"
|
||||
"\0\0\0\x0aPassword: \0"
|
||||
"\0\0\0\x07Token: \1", 44,
|
||||
{FAIL, -6, "Unable to decode keyboard-interactive prompt message"}},
|
||||
/* overflow language on 32 bit platform */
|
||||
{
|
||||
"<"
|
||||
"\0\0\0\x19"
|
||||
"\0\0\0\x01"
|
||||
"\0\0\0\x05""PWN3D\0\1\2\3\4\5\6\7\1\2\3"
|
||||
"\x01"
|
||||
"\0\0\0\x1b""The challenge is '14315716'"
|
||||
"\xff\xff\xff\xc4""en-US"
|
||||
"\0\0\0\x01"
|
||||
"\0\0\0\x0aResponse: "
|
||||
"\x01",
|
||||
89,
|
||||
{FAIL, -6,
|
||||
"Unable to decode keyboard-interactive 'language tag' "
|
||||
"request field"}},
|
||||
};
|
||||
|
||||
#define FAILED_MALLOC_TEST_CASES_LEN 2
|
||||
static const struct test_case
|
||||
failed_malloc_test_cases[FAILED_MALLOC_TEST_CASES_LEN] = {
|
||||
/* malloc fail */
|
||||
{
|
||||
"<"
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x01"
|
||||
"\0\0\0\x0aPassword: \0", 32,
|
||||
{FAIL, -6,
|
||||
"Unable to allocate memory for "
|
||||
"keyboard-interactive prompts array"}},
|
||||
/* malloc fail */
|
||||
{
|
||||
"<"
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x01"
|
||||
"\0\0\0\x0aPassword: \0", 32,
|
||||
{FAIL, -6,
|
||||
"Unable to allocate memory for "
|
||||
"keyboard-interactive responses array"
|
||||
}}
|
||||
};
|
||||
|
||||
static int alloc_count = 0;
|
||||
static int free_count = 0;
|
||||
|
||||
/* libssh2_default_alloc
|
||||
*/
|
||||
static
|
||||
LIBSSH2_ALLOC_FUNC(test_alloc)
|
||||
{
|
||||
int *threshold_int_ptr = *abstract;
|
||||
alloc_count++;
|
||||
if(*abstract && *threshold_int_ptr == alloc_count) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return malloc(count);
|
||||
}
|
||||
|
||||
/* libssh2_default_free
|
||||
*/
|
||||
static
|
||||
LIBSSH2_FREE_FUNC(test_free)
|
||||
{
|
||||
(void)abstract;
|
||||
free_count++;
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
static
|
||||
int test_case(int num,
|
||||
const char *data, unsigned int data_len, void *abstract,
|
||||
struct expected expected)
|
||||
{
|
||||
int rc;
|
||||
char *message;
|
||||
int error_code;
|
||||
LIBSSH2_SESSION *session;
|
||||
|
||||
alloc_count = 0;
|
||||
free_count = 0;
|
||||
|
||||
session = libssh2_session_init_ex(test_alloc, test_free, NULL, abstract);
|
||||
if(!session) {
|
||||
fprintf(stderr, "libssh2_session_init_ex failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
session->userauth_kybd_data = LIBSSH2_ALLOC(session, data_len);
|
||||
session->userauth_kybd_data_len = data_len;
|
||||
memcpy(session->userauth_kybd_data, data, data_len);
|
||||
|
||||
rc = userauth_keyboard_interactive_decode_info_request(session);
|
||||
|
||||
if(rc != expected.rc) {
|
||||
fprintf(stdout,
|
||||
"Test case %d: expected return code to be %d got %d\n",
|
||||
num, expected.rc, rc);
|
||||
return 1;
|
||||
}
|
||||
|
||||
error_code = libssh2_session_last_error(session, &message, NULL, 0);
|
||||
|
||||
if(expected.last_error_code != error_code) {
|
||||
fprintf(stdout,
|
||||
"Test case %d: expected last error code to be "
|
||||
"\"%d\" got \"%d\"\n",
|
||||
num, expected.last_error_code, error_code);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(strcmp(expected.last_error_message, message) != 0) {
|
||||
fprintf(stdout,
|
||||
"Test case %d: expected last error message to be "
|
||||
"\"%s\" got \"%s\"\n",
|
||||
num, expected.last_error_message, message);
|
||||
return 1;
|
||||
}
|
||||
libssh2_session_free(session);
|
||||
|
||||
fprintf(stderr, "Test case %d passed\n", num);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int ret = 0;
|
||||
int i;
|
||||
|
||||
for(i = 0; i < TEST_CASES_LEN; i++) {
|
||||
if(test_case(i + 1,
|
||||
test_cases[i].data,
|
||||
test_cases[i].data_len,
|
||||
NULL,
|
||||
test_cases[i].expected))
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
for(i = 0; i < FAILED_MALLOC_TEST_CASES_LEN; i++) {
|
||||
int tc = i + TEST_CASES_LEN + 1;
|
||||
int malloc_call_num = 3 + i;
|
||||
if(test_case(tc,
|
||||
failed_malloc_test_cases[i].data,
|
||||
failed_malloc_test_cases[i].data_len,
|
||||
&malloc_call_num,
|
||||
failed_malloc_test_cases[i].expected))
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
13
vendor/libssh2/tests/test_auth_keyboard_ok.c
vendored
Normal file
13
vendor/libssh2/tests/test_auth_keyboard_ok.c
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
/* Copyright (C) The libssh2 project and its contributors.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "runner.h"
|
||||
|
||||
int test(LIBSSH2_SESSION *session)
|
||||
{
|
||||
return test_auth_keyboard(session, 0,
|
||||
"libssh2", /* set in Dockerfile */
|
||||
"my test password"); /* set in Dockerfile */
|
||||
}
|
||||
13
vendor/libssh2/tests/test_auth_password_fail_password.c
vendored
Normal file
13
vendor/libssh2/tests/test_auth_password_fail_password.c
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
/* Copyright (C) The libssh2 project and its contributors.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "runner.h"
|
||||
|
||||
int test(LIBSSH2_SESSION *session)
|
||||
{
|
||||
return test_auth_password(session, TEST_AUTH_SHOULDFAIL,
|
||||
"libssh2", /* set in Dockerfile */
|
||||
"I am the wrong password");
|
||||
}
|
||||
13
vendor/libssh2/tests/test_auth_password_fail_username.c
vendored
Normal file
13
vendor/libssh2/tests/test_auth_password_fail_username.c
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
/* Copyright (C) The libssh2 project and its contributors.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "runner.h"
|
||||
|
||||
int test(LIBSSH2_SESSION *session)
|
||||
{
|
||||
return test_auth_password(session, TEST_AUTH_SHOULDFAIL,
|
||||
"I am the wrong username",
|
||||
"my test password"); /* set in Dockerfile */
|
||||
}
|
||||
13
vendor/libssh2/tests/test_auth_password_ok.c
vendored
Normal file
13
vendor/libssh2/tests/test_auth_password_ok.c
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
/* Copyright (C) The libssh2 project and its contributors.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "runner.h"
|
||||
|
||||
int test(LIBSSH2_SESSION *session)
|
||||
{
|
||||
return test_auth_password(session, 0,
|
||||
"libssh2", /* set in Dockerfile */
|
||||
"my test password"); /* set in Dockerfile */
|
||||
}
|
||||
15
vendor/libssh2/tests/test_auth_pubkey_fail.c
vendored
Normal file
15
vendor/libssh2/tests/test_auth_pubkey_fail.c
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
/* Copyright (C) The libssh2 project and its contributors.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "runner.h"
|
||||
|
||||
int test(LIBSSH2_SESSION *session)
|
||||
{
|
||||
return test_auth_pubkey(session, TEST_AUTH_SHOULDFAIL,
|
||||
"libssh2", /* set in Dockerfile */
|
||||
NULL,
|
||||
"key_dsa_wrong.pub", /* Not authorized on server */
|
||||
"key_dsa_wrong");
|
||||
}
|
||||
21
vendor/libssh2/tests/test_auth_pubkey_ok_dsa.c
vendored
Normal file
21
vendor/libssh2/tests/test_auth_pubkey_ok_dsa.c
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/* Copyright (C) The libssh2 project and its contributors.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "runner.h"
|
||||
|
||||
int test(LIBSSH2_SESSION *session)
|
||||
{
|
||||
#if LIBSSH2_DSA
|
||||
/* set in Dockerfile */
|
||||
return test_auth_pubkey(session, 0,
|
||||
"libssh2",
|
||||
NULL,
|
||||
"key_dsa.pub",
|
||||
"key_dsa");
|
||||
#else
|
||||
(void)session;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
21
vendor/libssh2/tests/test_auth_pubkey_ok_ecdsa.c
vendored
Normal file
21
vendor/libssh2/tests/test_auth_pubkey_ok_ecdsa.c
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/* Copyright (C) The libssh2 project and its contributors.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "runner.h"
|
||||
|
||||
int test(LIBSSH2_SESSION *session)
|
||||
{
|
||||
#if LIBSSH2_ECDSA
|
||||
/* set in Dockerfile */
|
||||
return test_auth_pubkey(session, 0,
|
||||
"libssh2",
|
||||
NULL,
|
||||
"key_ecdsa.pub",
|
||||
"key_ecdsa");
|
||||
#else
|
||||
(void)session;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
22
vendor/libssh2/tests/test_auth_pubkey_ok_ecdsa_signed.c
vendored
Normal file
22
vendor/libssh2/tests/test_auth_pubkey_ok_ecdsa_signed.c
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/* Copyright (C) The libssh2 project and its contributors.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "runner.h"
|
||||
|
||||
int test(LIBSSH2_SESSION *session)
|
||||
{
|
||||
#if LIBSSH2_ECDSA && \
|
||||
(defined(LIBSSH2_OPENSSL) || defined(LIBSSH2_WOLFSSL))
|
||||
/* set in Dockerfile */
|
||||
return test_auth_pubkey(session, 0,
|
||||
"libssh2",
|
||||
NULL,
|
||||
"key_ecdsa_signed-cert.pub",
|
||||
"key_ecdsa_signed");
|
||||
#else
|
||||
(void)session;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
21
vendor/libssh2/tests/test_auth_pubkey_ok_ed25519.c
vendored
Normal file
21
vendor/libssh2/tests/test_auth_pubkey_ok_ed25519.c
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/* Copyright (C) The libssh2 project and its contributors.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "runner.h"
|
||||
|
||||
int test(LIBSSH2_SESSION *session)
|
||||
{
|
||||
#if LIBSSH2_ED25519
|
||||
/* set in Dockerfile */
|
||||
return test_auth_pubkey(session, 0,
|
||||
"libssh2",
|
||||
NULL,
|
||||
"key_ed25519.pub",
|
||||
"key_ed25519");
|
||||
#else
|
||||
(void)session;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
21
vendor/libssh2/tests/test_auth_pubkey_ok_ed25519_encrypted.c
vendored
Normal file
21
vendor/libssh2/tests/test_auth_pubkey_ok_ed25519_encrypted.c
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/* Copyright (C) The libssh2 project and its contributors.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "runner.h"
|
||||
|
||||
int test(LIBSSH2_SESSION *session)
|
||||
{
|
||||
#if LIBSSH2_ED25519
|
||||
/* set in Dockerfile */
|
||||
return test_auth_pubkey(session, 0,
|
||||
"libssh2",
|
||||
"libssh2",
|
||||
"key_ed25519_encrypted.pub",
|
||||
"key_ed25519_encrypted");
|
||||
#else
|
||||
(void)session;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
21
vendor/libssh2/tests/test_auth_pubkey_ok_ed25519_mem.c
vendored
Normal file
21
vendor/libssh2/tests/test_auth_pubkey_ok_ed25519_mem.c
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/* Copyright (C) The libssh2 project and its contributors.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "runner.h"
|
||||
|
||||
int test(LIBSSH2_SESSION *session)
|
||||
{
|
||||
#if LIBSSH2_ED25519
|
||||
/* set in Dockerfile */
|
||||
return test_auth_pubkey(session, TEST_AUTH_FROMMEM,
|
||||
"libssh2",
|
||||
NULL,
|
||||
NULL,
|
||||
"key_ed25519");
|
||||
#else
|
||||
(void)session;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
21
vendor/libssh2/tests/test_auth_pubkey_ok_rsa.c
vendored
Normal file
21
vendor/libssh2/tests/test_auth_pubkey_ok_rsa.c
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/* Copyright (C) The libssh2 project and its contributors.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "runner.h"
|
||||
|
||||
int test(LIBSSH2_SESSION *session)
|
||||
{
|
||||
#if LIBSSH2_RSA_SHA1
|
||||
/* set in Dockerfile */
|
||||
return test_auth_pubkey(session, 0,
|
||||
"libssh2",
|
||||
NULL,
|
||||
"key_rsa.pub",
|
||||
"key_rsa");
|
||||
#else
|
||||
(void)session;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
22
vendor/libssh2/tests/test_auth_pubkey_ok_rsa_aes256gcm.c
vendored
Normal file
22
vendor/libssh2/tests/test_auth_pubkey_ok_rsa_aes256gcm.c
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/* Copyright (C) The libssh2 project and its contributors.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "runner.h"
|
||||
|
||||
int test(LIBSSH2_SESSION *session)
|
||||
{
|
||||
#if LIBSSH2_RSA_SHA1 && LIBSSH2_AES_GCM && \
|
||||
(defined(LIBSSH2_OPENSSL) || defined(LIBSSH2_WOLFSSL))
|
||||
/* set in Dockerfile */
|
||||
return test_auth_pubkey(session, 0,
|
||||
"libssh2",
|
||||
"libssh2",
|
||||
"key_rsa_aes256gcm.pub",
|
||||
"key_rsa_aes256gcm");
|
||||
#else
|
||||
(void)session;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
21
vendor/libssh2/tests/test_auth_pubkey_ok_rsa_encrypted.c
vendored
Normal file
21
vendor/libssh2/tests/test_auth_pubkey_ok_rsa_encrypted.c
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/* Copyright (C) The libssh2 project and its contributors.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "runner.h"
|
||||
|
||||
int test(LIBSSH2_SESSION *session)
|
||||
{
|
||||
#if LIBSSH2_RSA_SHA1 && LIBSSH2_MD5_PEM
|
||||
/* set in Dockerfile */
|
||||
return test_auth_pubkey(session, 0,
|
||||
"libssh2",
|
||||
"libssh2",
|
||||
"key_rsa_encrypted.pub",
|
||||
"key_rsa_encrypted");
|
||||
#else
|
||||
(void)session;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
22
vendor/libssh2/tests/test_auth_pubkey_ok_rsa_openssh.c
vendored
Normal file
22
vendor/libssh2/tests/test_auth_pubkey_ok_rsa_openssh.c
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/* Copyright (C) The libssh2 project and its contributors.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "runner.h"
|
||||
|
||||
int test(LIBSSH2_SESSION *session)
|
||||
{
|
||||
#if LIBSSH2_RSA_SHA1 && \
|
||||
(defined(LIBSSH2_OPENSSL) || defined(LIBSSH2_WOLFSSL))
|
||||
/* set in Dockerfile */
|
||||
return test_auth_pubkey(session, 0,
|
||||
"libssh2",
|
||||
NULL,
|
||||
"key_rsa_openssh.pub",
|
||||
"key_rsa_openssh");
|
||||
#else
|
||||
(void)session;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
22
vendor/libssh2/tests/test_auth_pubkey_ok_rsa_sha2_256_signed.c
vendored
Normal file
22
vendor/libssh2/tests/test_auth_pubkey_ok_rsa_sha2_256_signed.c
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/* Copyright (C) The libssh2 project and its contributors.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "runner.h"
|
||||
|
||||
int test(LIBSSH2_SESSION *session)
|
||||
{
|
||||
#if LIBSSH2_RSA_SHA2 && \
|
||||
(defined(LIBSSH2_OPENSSL) || defined(LIBSSH2_WOLFSSL))
|
||||
/* set in Dockerfile */
|
||||
return test_auth_pubkey(session, 0,
|
||||
"libssh2",
|
||||
NULL,
|
||||
"key_rsa_sha2_256_signed-cert.pub",
|
||||
"key_rsa_sha2_256_signed");
|
||||
#else
|
||||
(void)session;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
22
vendor/libssh2/tests/test_auth_pubkey_ok_rsa_signed.c
vendored
Normal file
22
vendor/libssh2/tests/test_auth_pubkey_ok_rsa_signed.c
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/* Copyright (C) The libssh2 project and its contributors.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "runner.h"
|
||||
|
||||
int test(LIBSSH2_SESSION *session)
|
||||
{
|
||||
#if LIBSSH2_RSA_SHA1 && \
|
||||
(defined(LIBSSH2_OPENSSL) || defined(LIBSSH2_WOLFSSL))
|
||||
/* set in Dockerfile */
|
||||
return test_auth_pubkey(session, 0,
|
||||
"libssh2",
|
||||
NULL,
|
||||
"key_rsa_signed-cert.pub",
|
||||
"key_rsa_signed");
|
||||
#else
|
||||
(void)session;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
74
vendor/libssh2/tests/test_hostkey.c
vendored
Normal file
74
vendor/libssh2/tests/test_hostkey.c
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
/* Copyright (C) The libssh2 project and its contributors.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "runner.h"
|
||||
|
||||
static const char *EXPECTED_RSA_HOSTKEY =
|
||||
"AAAAB3NzaC1yc2EAAAABIwAAAQEArrr/JuJmaZligyfS8vcNur+mWR2ddDQtVdhHzdKU"
|
||||
"UoR6/Om6cvxpe61H1YZO1xCpLUBXmkki4HoNtYOpPB2W4V+8U4BDeVBD5crypEOE1+7B"
|
||||
"Am99fnEDxYIOZq2/jTP0yQmzCpWYS3COyFmkOL7sfX1wQMeW5zQT2WKcxC6FSWbhDqrB"
|
||||
"eNEGi687hJJoJ7YXgY/IdiYW5NcOuqRSWljjGS3dAJsHHWk4nJbhjEDXbPaeduMAwQU9"
|
||||
"i6ELfP3r+q6wdu0P4jWaoo3De1aYxnToV/ldXykpipON4NPamsb6Ph2qlJQKypq7J4iQ"
|
||||
"gkIIbCU1A31+4ExvcIVoxLQw/aTSbw==";
|
||||
|
||||
static const char *EXPECTED_ECDSA_HOSTKEY =
|
||||
"AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBC+/syyeKJD9dC2ZH"
|
||||
"9Q7iJGReR4YM3rUCMsSynkyXojdfSClGCMY7JvWlt30ESjYvxoTfSRGx6WvaqYK/vPoYQ4=";
|
||||
|
||||
static const char *EXPECTED_ED25519_HOSTKEY =
|
||||
"AAAAC3NzaC1lZDI1NTE5AAAAIIxtdyg2ZRXE70UwyPVUH3UyfDBV8GX5cPF636P6hjom";
|
||||
|
||||
int test(LIBSSH2_SESSION *session)
|
||||
{
|
||||
int rc;
|
||||
size_t len;
|
||||
int type;
|
||||
size_t expected_len = 0;
|
||||
char *expected_hostkey = NULL;
|
||||
|
||||
const char *hostkey = libssh2_session_hostkey(session, &len, &type);
|
||||
if(!hostkey) {
|
||||
print_last_session_error("libssh2_session_hostkey");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(type == LIBSSH2_HOSTKEY_TYPE_ED25519) {
|
||||
rc = _libssh2_base64_decode(session, &expected_hostkey, &expected_len,
|
||||
EXPECTED_ED25519_HOSTKEY,
|
||||
strlen(EXPECTED_ED25519_HOSTKEY));
|
||||
}
|
||||
else if(type == LIBSSH2_HOSTKEY_TYPE_ECDSA_256) {
|
||||
rc = _libssh2_base64_decode(session, &expected_hostkey, &expected_len,
|
||||
EXPECTED_ECDSA_HOSTKEY,
|
||||
strlen(EXPECTED_ECDSA_HOSTKEY));
|
||||
}
|
||||
else if(type == LIBSSH2_HOSTKEY_TYPE_RSA) {
|
||||
rc = _libssh2_base64_decode(session, &expected_hostkey, &expected_len,
|
||||
EXPECTED_RSA_HOSTKEY,
|
||||
strlen(EXPECTED_RSA_HOSTKEY));
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "Unexpected type of hostkey: %i\n", type);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(rc) {
|
||||
print_last_session_error("_libssh2_base64_decode");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(len != expected_len) {
|
||||
fprintf(stderr, "Hostkey does not have the expected length %ld!=%ld\n",
|
||||
(unsigned long)len, (unsigned long)expected_len);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(memcmp(hostkey, expected_hostkey, len) != 0) {
|
||||
fprintf(stderr, "Hostkeys do not match\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
221
vendor/libssh2/tests/test_hostkey_hash.c
vendored
Normal file
221
vendor/libssh2/tests/test_hostkey_hash.c
vendored
Normal file
@@ -0,0 +1,221 @@
|
||||
/* Copyright (C) The libssh2 project and its contributors.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "runner.h"
|
||||
|
||||
static const char *EXPECTED_RSA_HOSTKEY =
|
||||
"AAAAB3NzaC1yc2EAAAABIwAAAQEArrr/JuJmaZligyfS8vcNur+mWR2ddDQtVdhHzdKU"
|
||||
"UoR6/Om6cvxpe61H1YZO1xCpLUBXmkki4HoNtYOpPB2W4V+8U4BDeVBD5crypEOE1+7B"
|
||||
"Am99fnEDxYIOZq2/jTP0yQmzCpWYS3COyFmkOL7sfX1wQMeW5zQT2WKcxC6FSWbhDqrB"
|
||||
"eNEGi687hJJoJ7YXgY/IdiYW5NcOuqRSWljjGS3dAJsHHWk4nJbhjEDXbPaeduMAwQU9"
|
||||
"i6ELfP3r+q6wdu0P4jWaoo3De1aYxnToV/ldXykpipON4NPamsb6Ph2qlJQKypq7J4iQ"
|
||||
"gkIIbCU1A31+4ExvcIVoxLQw/aTSbw==";
|
||||
|
||||
static const char *EXPECTED_ECDSA_HOSTKEY =
|
||||
"AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBC+/syyeKJD9dC2ZH"
|
||||
"9Q7iJGReR4YM3rUCMsSynkyXojdfSClGCMY7JvWlt30ESjYvxoTfSRGx6WvaqYK/vPoYQ4=";
|
||||
|
||||
static const char *EXPECTED_ED25519_HOSTKEY =
|
||||
"AAAAC3NzaC1lZDI1NTE5AAAAIIxtdyg2ZRXE70UwyPVUH3UyfDBV8GX5cPF636P6hjom";
|
||||
|
||||
#if LIBSSH2_MD5
|
||||
static const char *EXPECTED_RSA_MD5_HASH_DIGEST =
|
||||
"0C0ED1A5BB10275F76924CE187CE5C5E";
|
||||
#endif
|
||||
|
||||
static const char *EXPECTED_RSA_SHA1_HASH_DIGEST =
|
||||
"F3CD59E2913F4422B80F7B0A82B2B89EAE449387";
|
||||
|
||||
static const char *EXPECTED_RSA_SHA256_HASH_DIGEST =
|
||||
"92E3DA49DF3C7F99A828F505ED8239397A5D1F62914459760F878F7510F563A3";
|
||||
|
||||
#if LIBSSH2_MD5
|
||||
static const char *EXPECTED_ECDSA_MD5_HASH_DIGEST =
|
||||
"0402E4D897580BBC911379CBD88BCD3D";
|
||||
#endif
|
||||
|
||||
static const char *EXPECTED_ECDSA_SHA1_HASH_DIGEST =
|
||||
"12FDAD1E3B31B10BABB00F2A8D1B9A62C326BD2F";
|
||||
|
||||
static const char *EXPECTED_ECDSA_SHA256_HASH_DIGEST =
|
||||
"56FCD975B166C3F0342D0036E44C311A86C0EAE40713B53FC776369BAE7F5264";
|
||||
|
||||
static const char *EXPECTED_ED25519_SHA256_HASH_DIGEST =
|
||||
"2638B020F6121FA750A7F4754B718419F621814C6E779D68ADF26AA68814ADDF";
|
||||
|
||||
#if LIBSSH2_MD5
|
||||
static const size_t MD5_HASH_SIZE = 16;
|
||||
#endif
|
||||
static const size_t SHA1_HASH_SIZE = 20;
|
||||
static const size_t SHA256_HASH_SIZE = 32;
|
||||
|
||||
static void calculate_digest(const char *hash, size_t hash_len, char *buffer,
|
||||
size_t buffer_len)
|
||||
{
|
||||
size_t i;
|
||||
char *p = buffer;
|
||||
char *end = buffer + buffer_len;
|
||||
|
||||
for(i = 0; i < hash_len && p < end; ++i) {
|
||||
p += snprintf(p, (size_t)(end - p), "%02X", (unsigned char)hash[i]);
|
||||
}
|
||||
}
|
||||
|
||||
int test(LIBSSH2_SESSION *session)
|
||||
{
|
||||
char buf[BUFSIZ];
|
||||
|
||||
const char *hostkey;
|
||||
#if LIBSSH2_MD5
|
||||
const char *md5_hash;
|
||||
#endif
|
||||
const char *sha1_hash;
|
||||
const char *sha256_hash;
|
||||
int type;
|
||||
size_t len;
|
||||
|
||||
/* these are the host keys under test, they are currently unused */
|
||||
(void)EXPECTED_RSA_HOSTKEY;
|
||||
(void)EXPECTED_ECDSA_HOSTKEY;
|
||||
(void)EXPECTED_ED25519_HOSTKEY;
|
||||
|
||||
hostkey = libssh2_session_hostkey(session, &len, &type);
|
||||
if(!hostkey) {
|
||||
print_last_session_error("libssh2_session_hostkey");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(type == LIBSSH2_HOSTKEY_TYPE_ED25519) {
|
||||
|
||||
sha256_hash = libssh2_hostkey_hash(session,
|
||||
LIBSSH2_HOSTKEY_HASH_SHA256);
|
||||
if(!sha256_hash) {
|
||||
print_last_session_error(
|
||||
"libssh2_hostkey_hash(LIBSSH2_HOSTKEY_HASH_SHA256)");
|
||||
return 1;
|
||||
}
|
||||
|
||||
calculate_digest(sha256_hash, SHA256_HASH_SIZE, buf, BUFSIZ);
|
||||
|
||||
if(strcmp(buf, EXPECTED_ED25519_SHA256_HASH_DIGEST) != 0) {
|
||||
fprintf(stderr,
|
||||
"ED25519 SHA256 hash not as expected - digest %s != %s\n",
|
||||
buf, EXPECTED_ED25519_SHA256_HASH_DIGEST);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if(type == LIBSSH2_HOSTKEY_TYPE_ECDSA_256) {
|
||||
|
||||
#if LIBSSH2_MD5
|
||||
md5_hash = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_MD5);
|
||||
if(!md5_hash) {
|
||||
print_last_session_error(
|
||||
"libssh2_hostkey_hash(LIBSSH2_HOSTKEY_HASH_MD5)");
|
||||
return 1;
|
||||
}
|
||||
|
||||
calculate_digest(md5_hash, MD5_HASH_SIZE, buf, BUFSIZ);
|
||||
|
||||
if(strcmp(buf, EXPECTED_ECDSA_MD5_HASH_DIGEST) != 0) {
|
||||
fprintf(stderr,
|
||||
"ECDSA MD5 hash not as expected - digest %s != %s\n",
|
||||
buf, EXPECTED_ECDSA_MD5_HASH_DIGEST);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
sha1_hash = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||
if(!sha1_hash) {
|
||||
print_last_session_error(
|
||||
"libssh2_hostkey_hash(LIBSSH2_HOSTKEY_HASH_SHA1)");
|
||||
return 1;
|
||||
}
|
||||
|
||||
calculate_digest(sha1_hash, SHA1_HASH_SIZE, buf, BUFSIZ);
|
||||
|
||||
if(strcmp(buf, EXPECTED_ECDSA_SHA1_HASH_DIGEST) != 0) {
|
||||
fprintf(stderr,
|
||||
"ECDSA SHA1 hash not as expected - digest %s != %s\n",
|
||||
buf, EXPECTED_ECDSA_SHA1_HASH_DIGEST);
|
||||
return 1;
|
||||
}
|
||||
|
||||
sha256_hash = libssh2_hostkey_hash(session,
|
||||
LIBSSH2_HOSTKEY_HASH_SHA256);
|
||||
if(!sha256_hash) {
|
||||
print_last_session_error(
|
||||
"libssh2_hostkey_hash(LIBSSH2_HOSTKEY_HASH_SHA256)");
|
||||
return 1;
|
||||
}
|
||||
|
||||
calculate_digest(sha256_hash, SHA256_HASH_SIZE, buf, BUFSIZ);
|
||||
|
||||
if(strcmp(buf, EXPECTED_ECDSA_SHA256_HASH_DIGEST) != 0) {
|
||||
fprintf(stderr,
|
||||
"ECDSA SHA256 hash not as expected - digest %s != %s\n",
|
||||
buf, EXPECTED_ECDSA_SHA256_HASH_DIGEST);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if(type == LIBSSH2_HOSTKEY_TYPE_RSA) {
|
||||
|
||||
#if LIBSSH2_MD5
|
||||
md5_hash = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_MD5);
|
||||
if(!md5_hash) {
|
||||
print_last_session_error(
|
||||
"libssh2_hostkey_hash(LIBSSH2_HOSTKEY_HASH_MD5)");
|
||||
return 1;
|
||||
}
|
||||
|
||||
calculate_digest(md5_hash, MD5_HASH_SIZE, buf, BUFSIZ);
|
||||
|
||||
if(strcmp(buf, EXPECTED_RSA_MD5_HASH_DIGEST) != 0) {
|
||||
fprintf(stderr,
|
||||
"MD5 hash not as expected - digest %s != %s\n",
|
||||
buf, EXPECTED_RSA_MD5_HASH_DIGEST);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
sha1_hash = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||
if(!sha1_hash) {
|
||||
print_last_session_error(
|
||||
"libssh2_hostkey_hash(LIBSSH2_HOSTKEY_HASH_SHA1)");
|
||||
return 1;
|
||||
}
|
||||
|
||||
calculate_digest(sha1_hash, SHA1_HASH_SIZE, buf, BUFSIZ);
|
||||
|
||||
if(strcmp(buf, EXPECTED_RSA_SHA1_HASH_DIGEST) != 0) {
|
||||
fprintf(stderr,
|
||||
"SHA1 hash not as expected - digest %s != %s\n",
|
||||
buf, EXPECTED_RSA_SHA1_HASH_DIGEST);
|
||||
return 1;
|
||||
}
|
||||
|
||||
sha256_hash = libssh2_hostkey_hash(session,
|
||||
LIBSSH2_HOSTKEY_HASH_SHA256);
|
||||
if(!sha256_hash) {
|
||||
print_last_session_error(
|
||||
"libssh2_hostkey_hash(LIBSSH2_HOSTKEY_HASH_SHA256)");
|
||||
return 1;
|
||||
}
|
||||
|
||||
calculate_digest(sha256_hash, SHA256_HASH_SIZE, buf, BUFSIZ);
|
||||
|
||||
if(strcmp(buf, EXPECTED_RSA_SHA256_HASH_DIGEST) != 0) {
|
||||
fprintf(stderr,
|
||||
"SHA256 hash not as expected - digest %s != %s\n",
|
||||
buf, EXPECTED_RSA_SHA256_HASH_DIGEST);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "Unexpected type of hostkey: %i\n", type);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
131
vendor/libssh2/tests/test_read.c
vendored
Normal file
131
vendor/libssh2/tests/test_read.c
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
/* Copyright (C) The libssh2 project and its contributors.
|
||||
*
|
||||
* libssh2 test receiving large amounts of data through a channel
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "runner.h"
|
||||
#include "openssh_fixture.h"
|
||||
|
||||
#include <stdlib.h> /* for getenv() */
|
||||
|
||||
/* set in Dockerfile */
|
||||
static const char *username = "libssh2";
|
||||
static const char *key_file_private = "key_rsa";
|
||||
static const char *key_file_public = "key_rsa.pub";
|
||||
|
||||
int test(LIBSSH2_SESSION *session)
|
||||
{
|
||||
int rc;
|
||||
unsigned long xfer_bytes = 0;
|
||||
LIBSSH2_CHANNEL *channel;
|
||||
|
||||
/* Size and number of blocks to transfer
|
||||
* This needs to be large to increase the chance of timing effects causing
|
||||
* different code paths to be hit in the unframing code, but not so long
|
||||
* that the integration tests take too long. 5 seconds of run time is
|
||||
* probably a reasonable compromise. The block size is an odd number to
|
||||
* increase the chance that various internal buffer and block boundaries
|
||||
* are overlapped. */
|
||||
const unsigned long xfer_bs = 997;
|
||||
unsigned long xfer_count = 140080;
|
||||
|
||||
char remote_command[256];
|
||||
const char *env;
|
||||
const char *userauth_list;
|
||||
|
||||
/* Ignore our hard-wired Dockerfile user when not running under Docker */
|
||||
if(!openssh_fixture_have_docker()) {
|
||||
username = getenv("USER");
|
||||
#ifdef _WIN32
|
||||
if(!username)
|
||||
username = getenv("USERNAME");
|
||||
#endif
|
||||
}
|
||||
|
||||
userauth_list = libssh2_userauth_list(session, username,
|
||||
(unsigned int)strlen(username));
|
||||
if(!userauth_list) {
|
||||
print_last_session_error("libssh2_userauth_list");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(!strstr(userauth_list, "publickey")) {
|
||||
fprintf(stderr, "'publickey' was expected in userauth list: %s\n",
|
||||
userauth_list);
|
||||
return 1;
|
||||
}
|
||||
|
||||
rc = libssh2_userauth_publickey_fromfile_ex(session, username,
|
||||
(unsigned int)strlen(username),
|
||||
srcdir_path(key_file_public),
|
||||
srcdir_path(key_file_private),
|
||||
NULL);
|
||||
if(rc) {
|
||||
print_last_session_error("libssh2_userauth_publickey_fromfile_ex");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Request a session channel on which to run a shell */
|
||||
channel = libssh2_channel_open_session(session);
|
||||
if(!channel) {
|
||||
fprintf(stderr, "Unable to open a session\n");
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
env = getenv("FIXTURE_XFER_COUNT");
|
||||
if(env) {
|
||||
xfer_count = (unsigned long)strtol(env, NULL, 0);
|
||||
fprintf(stderr, "Custom xfer_count: %lu\n", xfer_count);
|
||||
}
|
||||
|
||||
/* command to transfer the desired amount of data */
|
||||
snprintf(remote_command, sizeof(remote_command),
|
||||
"dd if=/dev/zero bs=%lu count=%lu status=none",
|
||||
xfer_bs, xfer_count);
|
||||
|
||||
/* Send the command to transfer data */
|
||||
if(libssh2_channel_exec(channel, remote_command)) {
|
||||
fprintf(stderr, "Unable to request command on channel\n");
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
/* Read data */
|
||||
while(!libssh2_channel_eof(channel)) {
|
||||
char buf[1024];
|
||||
ssize_t err = libssh2_channel_read(channel, buf, sizeof(buf));
|
||||
if(err < 0)
|
||||
fprintf(stderr, "Unable to read response: %ld\n", (long)err);
|
||||
else {
|
||||
unsigned int i;
|
||||
for(i = 0; i < (unsigned long)err; ++i) {
|
||||
if(buf[i]) {
|
||||
fprintf(stderr, "Bad data received\n");
|
||||
/* Test will fail below due to bad data length */
|
||||
break;
|
||||
}
|
||||
}
|
||||
xfer_bytes += i;
|
||||
}
|
||||
}
|
||||
|
||||
/* Shut down */
|
||||
if(libssh2_channel_close(channel))
|
||||
fprintf(stderr, "Unable to close channel\n");
|
||||
|
||||
if(channel) {
|
||||
libssh2_channel_free(channel);
|
||||
channel = NULL;
|
||||
}
|
||||
|
||||
shutdown:
|
||||
|
||||
/* Test check */
|
||||
if(xfer_bytes != xfer_count * xfer_bs) {
|
||||
fprintf(stderr, "Not enough bytes received: %lu not %lu\n",
|
||||
xfer_bytes, xfer_count * xfer_bs);
|
||||
return 1; /* error */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
36
vendor/libssh2/tests/test_read_algos.test
vendored
Executable file
36
vendor/libssh2/tests/test_read_algos.test
vendored
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright (C) Viktor Szakats
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
# https://testanything.org/tap-specification.html
|
||||
|
||||
testbin="./test_read${EXEEXT:-}"
|
||||
|
||||
d="$(dirname "$0")"
|
||||
algos="$(tr -d $"\r" < "${d}/test_read_algos.txt")"
|
||||
|
||||
count=1
|
||||
total="$(echo "${algos}" | wc -l | tr -d ' ')"
|
||||
|
||||
echo "${count}..${total}"
|
||||
|
||||
while read -r test; do
|
||||
if [[ "${test}" = *'mac-'* ]]; then
|
||||
if FIXTURE_TEST_MAC="${test}" "${testbin}"; then
|
||||
res='ok'
|
||||
else
|
||||
res='not ok'
|
||||
fi
|
||||
else
|
||||
if FIXTURE_TEST_CRYPT="${test}" "${testbin}"; then
|
||||
res='ok'
|
||||
else
|
||||
res='not ok'
|
||||
fi
|
||||
fi
|
||||
echo "${res} ${count} - test_read-${test}"
|
||||
((count++))
|
||||
done <<< "${algos}"
|
||||
18
vendor/libssh2/tests/test_read_algos.txt
vendored
Normal file
18
vendor/libssh2/tests/test_read_algos.txt
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
3des-cbc
|
||||
aes128-cbc
|
||||
aes128-ctr
|
||||
aes128-gcm@openssh.com
|
||||
aes192-cbc
|
||||
aes192-ctr
|
||||
aes256-cbc
|
||||
aes256-ctr
|
||||
aes256-gcm@openssh.com
|
||||
hmac-md5
|
||||
hmac-md5-96
|
||||
hmac-sha1
|
||||
hmac-sha1-96
|
||||
hmac-sha1-etm@openssh.com
|
||||
hmac-sha2-256
|
||||
hmac-sha2-256-etm@openssh.com
|
||||
hmac-sha2-512
|
||||
hmac-sha2-512-etm@openssh.com
|
||||
96
vendor/libssh2/tests/test_simple.c
vendored
Normal file
96
vendor/libssh2/tests/test_simple.c
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
/* Copyright (C) The Written Word, Inc.
|
||||
* Copyright (C) Simon Josefsson
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the copyright holder nor the names
|
||||
* of any other contributors may be used to endorse or
|
||||
* promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "libssh2_priv.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static int test_libssh2_base64_decode(LIBSSH2_SESSION *session)
|
||||
{
|
||||
char *data;
|
||||
size_t datalen;
|
||||
const char *src = "Zm5vcmQ=";
|
||||
int ret;
|
||||
|
||||
ret = _libssh2_base64_decode(session, &data, &datalen,
|
||||
src, strlen(src));
|
||||
if(ret)
|
||||
return ret;
|
||||
|
||||
if(datalen != 5 || strcmp(data, "fnord") != 0) {
|
||||
fprintf(stderr,
|
||||
"_libssh2_base64_decode() failed (%d, %.*s)\n",
|
||||
(unsigned int)datalen, (unsigned int)datalen, data);
|
||||
return 1;
|
||||
}
|
||||
|
||||
free(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
LIBSSH2_SESSION *session;
|
||||
int rc;
|
||||
(void)argv;
|
||||
(void)argc;
|
||||
|
||||
rc = libssh2_init(LIBSSH2_INIT_NO_CRYPTO);
|
||||
if(rc) {
|
||||
fprintf(stderr, "libssh2_init() failed: %d\n", rc);
|
||||
return 1;
|
||||
}
|
||||
|
||||
session = libssh2_session_init();
|
||||
if(!session) {
|
||||
fprintf(stderr, "libssh2_session_init() failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
test_libssh2_base64_decode(session);
|
||||
|
||||
libssh2_session_free(session);
|
||||
|
||||
libssh2_exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
277
vendor/libssh2/tests/test_ssh2.c
vendored
Normal file
277
vendor/libssh2/tests/test_ssh2.c
vendored
Normal file
@@ -0,0 +1,277 @@
|
||||
/* Copyright (C) The libssh2 project and its contributors.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* Self test, based on example/ssh2.c.
|
||||
*/
|
||||
|
||||
#include "libssh2_setup.h"
|
||||
#include <libssh2.h>
|
||||
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h> /* for getenv() */
|
||||
|
||||
static const char *hostname = "127.0.0.1";
|
||||
static const int port_number = 4711;
|
||||
static const char *pubkey = "key_rsa.pub";
|
||||
static const char *privkey = "key_rsa";
|
||||
static const char *username = "username";
|
||||
static const char *password = "password";
|
||||
|
||||
static void portable_sleep(unsigned int seconds)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
Sleep(seconds);
|
||||
#else
|
||||
sleep(seconds);
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
uint32_t hostaddr;
|
||||
libssh2_socket_t sock;
|
||||
int i, auth_pw = 0;
|
||||
struct sockaddr_in sin;
|
||||
const char *fingerprint;
|
||||
char *userauthlist;
|
||||
int rc;
|
||||
LIBSSH2_SESSION *session = NULL;
|
||||
LIBSSH2_CHANNEL *channel;
|
||||
unsigned int counter;
|
||||
|
||||
#ifdef _WIN32
|
||||
WSADATA wsadata;
|
||||
|
||||
rc = WSAStartup(MAKEWORD(2, 0), &wsadata);
|
||||
if(rc) {
|
||||
fprintf(stderr, "WSAStartup failed with error: %d\n", rc);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
#ifdef _WIN32
|
||||
#define LIBSSH2_FALLBACK_USER_ENV "USERNAME"
|
||||
#else
|
||||
#define LIBSSH2_FALLBACK_USER_ENV "LOGNAME"
|
||||
#endif
|
||||
|
||||
if(getenv("USER"))
|
||||
username = getenv("USER");
|
||||
else if(getenv(LIBSSH2_FALLBACK_USER_ENV))
|
||||
username = getenv(LIBSSH2_FALLBACK_USER_ENV);
|
||||
|
||||
if(getenv("PRIVKEY"))
|
||||
privkey = getenv("PRIVKEY");
|
||||
|
||||
if(getenv("PUBKEY"))
|
||||
pubkey = getenv("PUBKEY");
|
||||
|
||||
hostaddr = inet_addr(hostname);
|
||||
if(hostaddr == (uint32_t)(-1)) {
|
||||
fprintf(stderr, "Failed to convert %s host address\n", hostname);
|
||||
return 1;
|
||||
}
|
||||
|
||||
rc = libssh2_init(0);
|
||||
if(rc) {
|
||||
fprintf(stderr, "libssh2 initialization failed (%d)\n", rc);
|
||||
return 1;
|
||||
}
|
||||
|
||||
rc = 1;
|
||||
|
||||
sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if(sock == LIBSSH2_INVALID_SOCKET) {
|
||||
fprintf(stderr, "failed to create socket.\n");
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
sin.sin_family = AF_INET;
|
||||
sin.sin_port = htons((unsigned short)port_number);
|
||||
sin.sin_addr.s_addr = hostaddr;
|
||||
|
||||
for(counter = 0; counter < 3; ++counter) {
|
||||
if(connect(sock, (struct sockaddr*)(&sin),
|
||||
sizeof(struct sockaddr_in))) {
|
||||
fprintf(stderr,
|
||||
"Connection to %s:%d attempt #%d failed: retrying...\n",
|
||||
hostname, port_number, counter);
|
||||
portable_sleep(1 + 2*counter);
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(sock == LIBSSH2_INVALID_SOCKET) {
|
||||
fprintf(stderr, "Failed to connect to %s:%d\n",
|
||||
hostname, port_number);
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
/* Create a session instance and start it up. This will trade welcome
|
||||
* banners, exchange keys, and setup crypto, compression, and MAC layers
|
||||
*/
|
||||
session = libssh2_session_init();
|
||||
if(!session) {
|
||||
fprintf(stderr, "Could not initialize SSH session.\n");
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
if(getenv("FIXTURE_TRACE_ALL_CONNECT") ||
|
||||
getenv("FIXTURE_TRACE_ALL")) {
|
||||
libssh2_trace(session, ~0);
|
||||
fprintf(stdout, "Trace all enabled.\n");
|
||||
}
|
||||
|
||||
libssh2_session_set_blocking(session, 1);
|
||||
|
||||
{
|
||||
int retries = 0, retry = 0;
|
||||
#ifdef LIBSSH2_WINCNG
|
||||
/* FIXME: Retry tests with WinCNG due to flakiness in hostkey
|
||||
verification: https://github.com/libssh2/libssh2/issues/804 */
|
||||
retries += 2;
|
||||
#endif
|
||||
do {
|
||||
rc = libssh2_session_handshake(session, sock);
|
||||
if(rc == 0) {
|
||||
break;
|
||||
}
|
||||
fprintf(stderr, "Failure establishing SSH session: %d\n", rc);
|
||||
if(
|
||||
#ifdef LIBSSH2_WINCNG
|
||||
rc != LIBSSH2_ERROR_KEY_EXCHANGE_FAILURE ||
|
||||
#endif
|
||||
++retry > retries) {
|
||||
break;
|
||||
}
|
||||
fprintf(stderr, "Retrying... %d / %d\n", retry, retries);
|
||||
} while(1);
|
||||
}
|
||||
|
||||
rc = 1;
|
||||
|
||||
/* At this point we have not yet authenticated. The first thing to do
|
||||
* is check the hostkey's fingerprint against our known hosts Your app
|
||||
* may have it hard coded, may go to a file, may present it to the
|
||||
* user, that's your call
|
||||
*/
|
||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||
fprintf(stderr, "Fingerprint: ");
|
||||
for(i = 0; i < 20; i++) {
|
||||
fprintf(stderr, "%02X ", (unsigned char)fingerprint[i]);
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
/* check what authentication methods are available */
|
||||
userauthlist = libssh2_userauth_list(session, username,
|
||||
(unsigned int)strlen(username));
|
||||
if(userauthlist) {
|
||||
fprintf(stderr, "Authentication methods: %s\n", userauthlist);
|
||||
if(strstr(userauthlist, "password")) {
|
||||
auth_pw |= 1;
|
||||
}
|
||||
if(strstr(userauthlist, "keyboard-interactive")) {
|
||||
auth_pw |= 2;
|
||||
}
|
||||
if(strstr(userauthlist, "publickey")) {
|
||||
auth_pw |= 4;
|
||||
}
|
||||
|
||||
if(auth_pw & 4) {
|
||||
/* Authenticate by public key */
|
||||
if(libssh2_userauth_publickey_fromfile(session, username,
|
||||
pubkey, privkey,
|
||||
password)) {
|
||||
fprintf(stderr, "Authentication by public key failed.\n");
|
||||
goto shutdown;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "Authentication by public key succeeded.\n");
|
||||
}
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "No supported authentication methods found.\n");
|
||||
goto shutdown;
|
||||
}
|
||||
}
|
||||
|
||||
/* Request a session channel on which to run a shell */
|
||||
channel = libssh2_channel_open_session(session);
|
||||
if(!channel) {
|
||||
fprintf(stderr, "Unable to open a session\n");
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
/* Some environment variables may be set,
|
||||
* It's up to the server which ones it'll allow though
|
||||
*/
|
||||
libssh2_channel_setenv(channel, "FOO", "bar");
|
||||
|
||||
/* Request a terminal with 'vanilla' terminal emulation
|
||||
* See /etc/termcap for more options. This is useful when opening
|
||||
* an interactive shell.
|
||||
*/
|
||||
if(libssh2_channel_request_pty(channel, "vanilla")) {
|
||||
fprintf(stderr, "Failed requesting pty\n");
|
||||
goto skip_shell;
|
||||
}
|
||||
|
||||
/* Open a SHELL on that pty */
|
||||
if(libssh2_channel_shell(channel)) {
|
||||
fprintf(stderr, "Unable to request shell on allocated pty\n");
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
rc = 0;
|
||||
|
||||
skip_shell:
|
||||
|
||||
if(channel) {
|
||||
libssh2_channel_free(channel);
|
||||
channel = NULL;
|
||||
}
|
||||
|
||||
shutdown:
|
||||
|
||||
if(session) {
|
||||
libssh2_session_disconnect(session, "Normal Shutdown");
|
||||
libssh2_session_free(session);
|
||||
}
|
||||
|
||||
if(sock != LIBSSH2_INVALID_SOCKET) {
|
||||
shutdown(sock, 2 /* SHUT_RDWR */);
|
||||
#ifdef _WIN32
|
||||
closesocket(sock);
|
||||
#else
|
||||
close(sock);
|
||||
#endif
|
||||
}
|
||||
|
||||
fprintf(stderr, "all done\n");
|
||||
|
||||
libssh2_exit();
|
||||
|
||||
#ifdef _WIN32
|
||||
WSACleanup();
|
||||
#endif
|
||||
|
||||
return rc;
|
||||
}
|
||||
169
vendor/libssh2/tests/test_sshd.test
vendored
Executable file
169
vendor/libssh2/tests/test_sshd.test
vendored
Executable file
@@ -0,0 +1,169 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright (C) Simon Josefsson
|
||||
# Copyright (C) Viktor Szakats
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
# Start sshd, invoke test(s), saving exit code, kill sshd, and
|
||||
# return exit code.
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
# https://testanything.org/tap-specification.html
|
||||
|
||||
d="$(dirname "$0")"
|
||||
uname="$(uname)"
|
||||
|
||||
# Load list of tests
|
||||
|
||||
if [ -n "${1:-}" ]; then
|
||||
# for CMake or manual
|
||||
tests="$*"
|
||||
via_args=1
|
||||
else
|
||||
# for autotools
|
||||
via_args=0
|
||||
# Load list of SSHD tests from Makefile.inc
|
||||
tests=''
|
||||
load=0
|
||||
while read -r l; do
|
||||
if [[ "${l}" = 'SSHD_TESTS ='* ]]; then
|
||||
load=1
|
||||
elif [ "${load}" = '1' ]; then
|
||||
[[ "${l}" =~ [a-z0-9_]+ ]] && tests+="${tests:+ }./${BASH_REMATCH[0]}${EXEEXT:-}"
|
||||
[[ ! "${l}" = *"\\" ]] && break
|
||||
fi
|
||||
done <<< "$(tr -d $"\r" < "${d}/Makefile.inc")"
|
||||
fi
|
||||
|
||||
if [ -n "${SSHD_TESTS_LIMIT_TO:-}" ]; then
|
||||
tests="$(echo "${tests}" | cut -d ' ' -f -"${SSHD_TESTS_LIMIT_TO}")"
|
||||
echo "# limiting tests to the first ${SSHD_TESTS_LIMIT_TO}."
|
||||
fi
|
||||
|
||||
# Init and start sshd
|
||||
|
||||
d="$(cd "${d}" || exit; pwd)" # sshd needs absolute paths
|
||||
|
||||
SSHD="${SSHD:-/usr/sbin/sshd}"
|
||||
[[ "${uname}" = *'_NT'* ]] && SSHD="$(cygpath "${SSHD}")"
|
||||
ver="$("${SSHD}" -V 2>&1 || true)"
|
||||
if [[ "${ver}" =~ OpenSSH_[a-zA-Z0-9_\ .,]+ ]]; then
|
||||
ver="${BASH_REMATCH[0]}"
|
||||
else
|
||||
ver=''
|
||||
fi
|
||||
echo "# sshd executable: '${SSHD}' (${ver})"
|
||||
|
||||
# for our test clients:
|
||||
[ -z "${PRIVKEY:-}" ] && export PRIVKEY="${d}/key_rsa"
|
||||
[ -z "${PUBKEY:-}" ] && export PUBKEY="${d}/key_rsa.pub"
|
||||
cakeys="${d}/openssh_server/ca_user_keys.pub"
|
||||
|
||||
logfsrv="$(mktemp)"; readonly logfsrv
|
||||
logfcli="$(mktemp)"; readonly logfcli
|
||||
|
||||
echo "# sshd log: '${logfsrv}'"
|
||||
|
||||
SSHD_FLAGS="${SSHD_FLAGS:-}"
|
||||
if [ -n "${DEBUG:-}" ]; then
|
||||
SSHD_FLAGS+=' -d -d'
|
||||
else
|
||||
SSHD_FLAGS+=" -E ${logfsrv}"
|
||||
fi
|
||||
|
||||
chmod go-rwx \
|
||||
"${d}"/openssh_server/ssh_host_* \
|
||||
"${cakeys}"
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
"${SSHD}" \
|
||||
-f "${SSHD_FIXTURE_CONFIG:-${d}/openssh_server/sshd_config}" \
|
||||
-o 'Port 4711' \
|
||||
-o 'StrictModes no' \
|
||||
-h "${d}/openssh_server/ssh_host_rsa_key" \
|
||||
-h "${d}/openssh_server/ssh_host_ecdsa_key" \
|
||||
-h "${d}/openssh_server/ssh_host_ed25519_key" \
|
||||
-o 'PidFile sshd.pid' \
|
||||
-o "AuthorizedKeysFile ${PUBKEY} ${d}/openssh_server/authorized_keys" \
|
||||
-o "TrustedUserCAKeys ${cakeys}" \
|
||||
-o 'PermitRootLogin yes' \
|
||||
-D \
|
||||
${SSHD_FLAGS} &
|
||||
sshdpid=$!
|
||||
|
||||
trap 'kill "${sshdpid}"; echo "# signal killing sshd"; exit 1;' EXIT HUP INT TERM
|
||||
|
||||
: "started sshd (${sshdpid})"
|
||||
|
||||
SSH="$(command -v "${SSH:-ssh}" || true)"
|
||||
if [ -n "${SSH}" ]; then
|
||||
echo "# ssh executable: '${SSH}' ($("${SSH}" -V 2>&1 || true))"
|
||||
echo "# ssh log: '${logfcli}'"
|
||||
chmod go-rwx "${PRIVKEY}"
|
||||
if [[ "${uname}" = *'_NT'* ]]; then
|
||||
export MSYS2_ARG_CONV_EXCL='/reset'
|
||||
icacls "${PRIVKEY}" /reset
|
||||
icacls "${PRIVKEY}" /grant:r "${USERNAME}:(R)"
|
||||
icacls "${PRIVKEY}" /inheritance:r
|
||||
fi
|
||||
count=1
|
||||
# shellcheck disable=SC2086
|
||||
while ! "${SSH:-ssh}" -q -a -k \
|
||||
-F /dev/null \
|
||||
-o 'BatchMode yes' \
|
||||
-o 'StrictHostKeyChecking no' \
|
||||
-o 'UserKnownHostsFile /dev/null' \
|
||||
-o 'ConnectTimeout 3' \
|
||||
-i "${PRIVKEY}" \
|
||||
-p 4711 ${SSH_FLAGS:-} localhost exit 2>>"${logfcli}"; do
|
||||
((count++))
|
||||
if [[ "${count}" -gt 8 ]]; then
|
||||
echo '# giving up waiting for sshd. Tests are expected to fail.'
|
||||
echo '# sshd log:'
|
||||
sed 's/^/# /' < "${logfsrv}"
|
||||
echo '# ssh test connect log:'
|
||||
sed 's/^/# /' < "${logfcli}"
|
||||
break
|
||||
fi
|
||||
echo '# waiting for sshd...'
|
||||
sleep 1
|
||||
done
|
||||
else
|
||||
echo '# giving time for sshd to launch...'
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
# Run tests
|
||||
|
||||
ec=0
|
||||
count=1
|
||||
total="$(echo "${tests}" | wc -w | tr -d ' ')"
|
||||
anyerror=0
|
||||
|
||||
echo "${count}..${total}"
|
||||
|
||||
export OPENSSH_NO_DOCKER=1
|
||||
|
||||
for test in ${tests}; do
|
||||
if "${test}"; then
|
||||
res='ok'
|
||||
else
|
||||
testerr=$?
|
||||
anyerror=1
|
||||
[ "${via_args}" = '1' ] && [ "${total}" = '1' ] && ec="${testerr}"
|
||||
res='not ok'
|
||||
fi
|
||||
echo "${res} ${count} - sshd-$(basename "${test}")"
|
||||
((count++))
|
||||
done
|
||||
|
||||
# Stop sshd
|
||||
|
||||
: "killing sshd (${sshdpid})"
|
||||
kill "${sshdpid}" > /dev/null 2>&1
|
||||
trap '' EXIT HUP INT TERM
|
||||
|
||||
[ "${via_args}" = '1' ] && [ "${total}" != '1' ] && ec="${anyerror}"
|
||||
|
||||
exit "${ec}"
|
||||
Reference in New Issue
Block a user