Skip to content
This repository was archived by the owner on Jan 26, 2026. It is now read-only.

Commit d4a109f

Browse files
committed
Merge commit 'c91f5306105b23539baa500f94259881bf16cf97'
2 parents d7cd322 + c91f530 commit d4a109f

99 files changed

Lines changed: 6520 additions & 4144 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitlab-ci.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,15 @@ fedora/openssl_1.1.x/x86-64/release:
6060
- obj/
6161

6262
# Address sanitizer doesn't mix well with LD_PRELOAD used in the testsuite
63-
.fedora/address-sanitizer:
63+
# so, this is only enabled for unit tests right now.
64+
# TODO: add -DCLIENT_TESTING=ON -DSERVER_TESTING=ON
65+
fedora/address-sanitizer:
6466
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
6567
script:
6668
- mkdir -p obj && cd obj && cmake
67-
-DCMAKE_C_FLAGS="-O2 -g -fsanitize=address"
68-
-DCMAKE_LINK_FLAGS="-fsanitize=address -static-libasan"
69+
-DCMAKE_BUILD_TYPE=AddressSanitizer
6970
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON --DWITH_PCAP=ON
70-
-DUNIT_TESTING=ON -DCLIENT_TESTING=ON -DSERVER_TESTING=ON .. &&
71+
-DUNIT_TESTING=ON .. &&
7172
make -j$(nproc) && ctest --output-on-failure
7273
tags:
7374
- shared

CMakeLists.txt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
cmake_minimum_required(VERSION 3.3.0)
22
cmake_policy(SET CMP0048 NEW)
33

4-
project(libssh VERSION 0.8.2 LANGUAGES C)
4+
# Specify search path for CMake modules to be loaded by include()
5+
# and find_package()
6+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
7+
8+
# Add defaults for cmake
9+
# Those need to be set before the project() call.
10+
include(DefineCMakeDefaults)
11+
include(DefineCompilerFlags)
12+
13+
project(libssh VERSION 0.8.3 LANGUAGES C)
514

615
# global needed variable
716
set(APPLICATION_NAME ${PROJECT_NAME})
@@ -13,16 +22,12 @@ set(APPLICATION_NAME ${PROJECT_NAME})
1322
# Increment AGE. Set REVISION to 0
1423
# If the source code was changed, but there were no interface changes:
1524
# Increment REVISION.
16-
set(LIBRARY_VERSION "4.6.0")
25+
set(LIBRARY_VERSION "4.7.0")
1726
set(LIBRARY_SOVERSION "4")
1827

1928
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
20-
set(CMAKE_MODULE_PATH
21-
${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules
22-
)
2329

2430
# add definitions
25-
include(DefineCMakeDefaults)
2631
include(DefinePlatformDefaults)
2732
include(DefineInstallationPaths)
2833
include(DefineOptions.cmake)

ChangeLog

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
ChangeLog
22
==========
33

4+
version 0.8.3 (released 2018-09-21)
5+
* Added support for rsa-sha2
6+
* Added support to parse private keys in openssh container format
7+
(other than ed25519)
8+
* Added support for diffie-hellman-group18-sha512 and
9+
diffie-hellman-group16-sha512
10+
* Added ssh_get_fingerprint_hash()
11+
* Added ssh_pki_export_privkey_base64()
12+
* Added support for Match keyword in config file
13+
* Improved performance and reduced memory footprint for sftp
14+
* Fixed ecdsa publickey auth
15+
* Fixed reading a closed channel
16+
* Added support to announce posix-rename@openssh.com and
17+
hardlink@openssh.com in the sftp server
18+
419
version 0.8.2 (released 2018-08-30)
520
* Added sha256 fingerprints for pubkeys
621
* Improved compiler flag detection

CompilerChecks.cmake

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ if (UNIX)
1717
endif()
1818

1919
add_c_compiler_flag("-std=gnu99" SUPPORTED_COMPILER_FLAGS)
20-
add_c_compiler_flag("-pedantic" SUPPORTED_COMPILER_FLAGS)
21-
add_c_compiler_flag("-pedantic-errors" SUPPORTED_COMPILER_FLAGS)
20+
add_c_compiler_flag("-Wpedantic" SUPPORTED_COMPILER_FLAGS)
2221
add_c_compiler_flag("-Wall" SUPPORTED_COMPILER_FLAGS)
2322
add_c_compiler_flag("-Wshadow" SUPPORTED_COMPILER_FLAGS)
2423
add_c_compiler_flag("-Wmissing-prototypes" SUPPORTED_COMPILER_FLAGS)
@@ -63,9 +62,19 @@ if (UNIX)
6362
endif()
6463
endif()
6564

66-
check_c_compiler_flag_ssp("-fstack-protector" WITH_STACK_PROTECTOR)
67-
if (WITH_STACK_PROTECTOR)
68-
list(APPEND SUPPORTED_COMPILER_FLAGS "-fstack-protector")
65+
check_c_compiler_flag_ssp("-fstack-protector-strong" WITH_STACK_PROTECTOR_STRONG)
66+
if (WITH_STACK_PROTECTOR_STRONG)
67+
list(APPEND SUPPORTED_COMPILER_FLAGS "-fstack-protector-strong")
68+
else (WITH_STACK_PROTECTOR_STRONG)
69+
check_c_compiler_flag_ssp("-fstack-protector" WITH_STACK_PROTECTOR)
70+
if (WITH_STACK_PROTECTOR)
71+
list(APPEND SUPPORTED_COMPILER_FLAGS "-fstack-protector")
72+
endif()
73+
endif (WITH_STACK_PROTECTOR_STRONG)
74+
75+
check_c_compiler_flag_ssp("-fstack-clash-protection" WITH_STACK_CLASH_PROTECTION)
76+
if (WITH_STACK_CLASH_PROTECTION)
77+
list(APPEND SUPPORTED_COMPILER_FLAGS "-fstack-clash-protection")
6978
endif()
7079

7180
if (PICKY_DEVELOPER)

ConfigureChecks.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ include(CheckSymbolExists)
44
include(CheckFunctionExists)
55
include(CheckLibraryExists)
66
include(CheckTypeSize)
7-
include(CheckCXXSourceCompiles)
7+
include(CheckStructHasMember)
88
include(TestBigEndian)
99

1010
set(PACKAGE ${PROJECT_NAME})
@@ -156,7 +156,8 @@ check_function_exists(explicit_bzero HAVE_EXPLICIT_BZERO)
156156
check_function_exists(memset_s HAVE_MEMSET_S)
157157

158158
if (HAVE_GLOB_H)
159-
check_function_exists(glob HAVE_GLOB)
159+
check_struct_has_member(glob_t gl_flags glob.h HAVE_GLOB_GL_FLAGS_MEMBER)
160+
check_function_exists(glob HAVE_GLOB)
160161
endif (HAVE_GLOB_H)
161162

162163
if (NOT WIN32)

DefineOptions.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ else (WITH_ZLIB)
2727
set(WITH_LIBZ OFF)
2828
endif (WITH_ZLIB)
2929

30-
if(WITH_BENCHMARKS)
30+
if (WITH_BENCHMARKS)
3131
set(UNIT_TESTING ON)
32-
endif(WITH_BENCHMARKS)
32+
set(CLIENT_TESTING ON)
33+
endif()
3334

3435
if (WITH_STATIC_LIB)
3536
set(BUILD_STATIC_LIB ON)

cmake/Modules/AddCMockaTest.cmake

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,14 @@
1-
# - ADD_CHECK_TEST(test_name test_source linklib1 ... linklibN)
1+
# - add_cmocka_test(test_name test_source linklib1 ... linklibN)
22

33
# Copyright (c) 2007 Daniel Gollub <dgollub@suse.de>
4-
# Copyright (c) 2007-2010 Andreas Schneider <asn@cryptomilk.org>
4+
# Copyright (c) 2007-2018 Andreas Schneider <asn@cryptomilk.org>
55
#
66
# Redistribution and use is allowed according to the terms of the BSD license.
77
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
88

99
enable_testing()
1010
include(CTest)
1111

12-
if(CMAKE_COMPILER_IS_GNUCC AND NOT MINGW)
13-
# Profiling
14-
set(CMAKE_C_FLAGS_PROFILING "-g -O0 -Wall -W -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wwrite-strings -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Compiler Flags")
15-
set(CMAKE_SHARED_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags")
16-
set(CMAKE_MODULE_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags")
17-
set(CMAKE_EXEC_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags")
18-
19-
# Address Sanitizer
20-
set(CMAKE_C_FLAGS_ADDRESSSANITIZER "-g -O1 -fsanitize=address -fno-omit-frame-pointer" CACHE STRING "Address sanitizer compiler flags")
21-
set(CMAKE_SHARED_LINKER_FLAGS_ADDRESSSANITIZER "-fsanitize=address" CACHE STRING "Address sanitizer shared linker flags")
22-
set(CMAKE_MODULE_LINKER_FLAGS_ADDRESSSANITIZER "-fsanitize=address" CACHE STRING "Address sanitizer module linker flags")
23-
set(CMAKE_EXEC_LINKER_FLAGS_ADDRESSSANITIZER "-fsanitize=address" CACHE STRING "Address sanitizer executable linker flags")
24-
endif(CMAKE_COMPILER_IS_GNUCC AND NOT MINGW)
25-
2612
if (CMAKE_CROSSCOMPILING)
2713
if (WIN32)
2814
find_program(WINE_EXECUTABLE
@@ -31,8 +17,10 @@ if (CMAKE_CROSSCOMPILING)
3117
endif()
3218
endif()
3319

34-
function (ADD_CMOCKA_TEST _testName _testSource)
20+
function(ADD_CMOCKA_TEST _testName _testSource)
3521
add_executable(${_testName} ${_testSource})
22+
3623
target_link_libraries(${_testName} ${ARGN})
24+
3725
add_test(${_testName} ${TARGET_SYSTEM_EMULATOR} ${CMAKE_CURRENT_BINARY_DIR}/${_testName}${CMAKE_EXECUTABLE_SUFFIX})
3826
endfunction (ADD_CMOCKA_TEST)

cmake/Modules/DefineCMakeDefaults.cmake

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,5 @@ set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
1414
# since cmake 2.4.0
1515
set(CMAKE_COLOR_MAKEFILE ON)
1616

17-
# Define the generic version of the libraries here
18-
set(GENERIC_LIB_VERSION "0.1.0")
19-
set(GENERIC_LIB_SOVERSION "0")
20-
21-
# Set the default build type to release with debug info
22-
if (NOT CMAKE_BUILD_TYPE)
23-
set(CMAKE_BUILD_TYPE RelWithDebInfo
24-
CACHE STRING
25-
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
26-
)
27-
endif (NOT CMAKE_BUILD_TYPE)
28-
2917
# Create the compile command database for clang by default
3018
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
if (UNIX AND NOT WIN32)
2+
# Activate with: -DCMAKE_BUILD_TYPE=Profiling
3+
set(CMAKE_C_FLAGS_PROFILING "-g -O0 -fprofile-arcs -ftest-coverage"
4+
CACHE STRING "Flags used by the C compiler during PROFILING builds.")
5+
set(CMAKE_CXX_FLAGS_PROFILING "-g -O0 -fprofile-arcs -ftest-coverage"
6+
CACHE STRING "Flags used by the CXX compiler during PROFILING builds.")
7+
set(CMAKE_SHARED_LINKER_FLAGS_PROFILING "-fprofile-arcs -ftest-coverage"
8+
CACHE STRING "Flags used by the linker during the creation of shared libraries during PROFILING builds.")
9+
set(CMAKE_MODULE_LINKER_FLAGS_PROFILING "-fprofile-arcs -ftest-coverage"
10+
CACHE STRING "Flags used by the linker during the creation of shared libraries during PROFILING builds.")
11+
set(CMAKE_EXEC_LINKER_FLAGS_PROFILING "-fprofile-arcs -ftest-coverage"
12+
CACHE STRING "Flags used by the linker during PROFILING builds.")
13+
14+
# Activate with: -DCMAKE_BUILD_TYPE=AddressSanitizer
15+
set(CMAKE_C_FLAGS_ADDRESSSANITIZER "-g -O1 -fsanitize=address -fno-omit-frame-pointer"
16+
CACHE STRING "Flags used by the C compiler during ADDRESSSANITIZER builds.")
17+
set(CMAKE_CXX_FLAGS_ADDRESSSANITIZER "-g -O1 -fsanitize=address -fno-omit-frame-pointer"
18+
CACHE STRING "Flags used by the CXX compiler during ADDRESSSANITIZER builds.")
19+
set(CMAKE_SHARED_LINKER_FLAGS_ADDRESSSANITIZER "-fsanitize=address"
20+
CACHE STRING "Flags used by the linker during the creation of shared libraries during ADDRESSSANITIZER builds.")
21+
set(CMAKE_MODULE_LINKER_FLAGS_ADDRESSSANITIZER "-fsanitize=address"
22+
CACHE STRING "Flags used by the linker during the creation of shared libraries during ADDRESSSANITIZER builds.")
23+
set(CMAKE_EXEC_LINKER_FLAGS_ADDRESSSANITIZER "-fsanitize=address"
24+
CACHE STRING "Flags used by the linker during ADDRESSSANITIZER builds.")
25+
endif()

config.h.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@
8989
/* Define to 1 if you have DSA */
9090
#cmakedefine HAVE_DSA 1
9191

92+
/* Define to 1 if you have gl_flags as a glob_t sturct member */
93+
#cmakedefine HAVE_GLOB_GL_FLAGS_MEMBER 1
94+
9295
/*************************** FUNCTIONS ***************************/
9396

9497
/* Define to 1 if you have the `EVP_aes128_ctr' function. */

0 commit comments

Comments
 (0)