mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-04 12:20:42 +09:00
Compare commits
18 Commits
0b4b71cc11
...
libssh-0.8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e949e135b6 | ||
|
|
1510b63d20 | ||
|
|
0db4d9bd46 | ||
|
|
1e17e084bf | ||
|
|
a2c14c5ec5 | ||
|
|
b99849c831 | ||
|
|
c7d4286ca1 | ||
|
|
434e2b7212 | ||
|
|
acf0f0fa6e | ||
|
|
220e6b66e8 | ||
|
|
c4d4731ddf | ||
|
|
139ccaa78c | ||
|
|
c42410b560 | ||
|
|
120f11812d | ||
|
|
500486d501 | ||
|
|
6708debd4c | ||
|
|
852a8b4875 | ||
|
|
9c6b4ecb48 |
@@ -1,7 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.2.0)
|
||||
cmake_policy(SET CMP0048 NEW)
|
||||
|
||||
project(libssh VERSION 0.8.0 LANGUAGES C)
|
||||
project(libssh VERSION 0.8.1 LANGUAGES C)
|
||||
|
||||
# global needed variable
|
||||
set(APPLICATION_NAME ${PROJECT_NAME})
|
||||
@@ -13,7 +13,7 @@ set(APPLICATION_NAME ${PROJECT_NAME})
|
||||
# Increment AGE. Set REVISION to 0
|
||||
# If the source code was changed, but there were no interface changes:
|
||||
# Increment REVISION.
|
||||
set(LIBRARY_VERSION "4.5.0")
|
||||
set(LIBRARY_VERSION "4.5.1")
|
||||
set(LIBRARY_SOVERSION "4")
|
||||
|
||||
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
|
||||
|
||||
@@ -10,7 +10,7 @@ set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
|
||||
|
||||
# SOURCE GENERATOR
|
||||
set(CPACK_SOURCE_GENERATOR "TXZ")
|
||||
set(CPACK_SOURCE_IGNORE_FILES "~$;[.]swp$;/[.]git/;.gitignore;build;obj*;tags;cscope.*")
|
||||
set(CPACK_SOURCE_IGNORE_FILES "~$;[.]swp$;/[.]git/;.gitignore;/build*;/obj*;tags;cscope.*")
|
||||
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
|
||||
|
||||
### NSIS INSTALLER
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
ChangeLog
|
||||
==========
|
||||
|
||||
version 0.8.1 (released 2018-08-13)
|
||||
* Fixed version number in the header
|
||||
* Fixed version number in pkg-config and cmake config
|
||||
* Fixed library initialization
|
||||
* Fixed attribute detection
|
||||
|
||||
version 0.8.0 (released 2018-08-10)
|
||||
* Removed support for deprecated SSHv1 protocol
|
||||
* Added new connector API for clients
|
||||
|
||||
@@ -7,8 +7,8 @@ include(CheckTypeSize)
|
||||
include(CheckCXXSourceCompiles)
|
||||
include(TestBigEndian)
|
||||
|
||||
set(PACKAGE ${APPLICATION_NAME})
|
||||
set(VERSION ${APPLICATION_VERSION})
|
||||
set(PACKAGE ${PROJECT_NAME})
|
||||
set(VERSION ${PROJECT_VERSION})
|
||||
set(DATADIR ${DATA_INSTALL_DIR})
|
||||
set(LIBDIR ${LIB_INSTALL_DIR})
|
||||
set(PLUGINDIR "${PLUGIN_INSTALL_DIR}-${LIBRARY_SOVERSION}")
|
||||
@@ -267,25 +267,47 @@ int main(void) {
|
||||
return 0;
|
||||
}" HAVE_MSC_THREAD_LOCAL_STORAGE)
|
||||
|
||||
###########################################################
|
||||
# For detecting attributes we need to treat warnings as
|
||||
# errors
|
||||
if (UNIX)
|
||||
set(CMAKE_REQUIRED_FLAGS "-Werror")
|
||||
endif (UNIX)
|
||||
|
||||
check_c_source_compiles("
|
||||
void test_constructor_attribute(void) __attribute__ ((constructor));
|
||||
|
||||
void test_constructor_attribute(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
return 0;
|
||||
}" HAVE_CONSTRUCTOR_ATTRIBUTE)
|
||||
|
||||
check_c_source_compiles("
|
||||
void test_destructor_attribute(void) __attribute__ ((destructor));
|
||||
|
||||
void test_destructor_attribute(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
return 0;
|
||||
}" HAVE_DESTRUCTOR_ATTRIBUTE)
|
||||
|
||||
check_c_source_compiles("
|
||||
#define FALL_THROUGH __attribute__((fallthrough))
|
||||
|
||||
enum direction_e {
|
||||
UP = 0,
|
||||
DOWN,
|
||||
};
|
||||
|
||||
int main(void) {
|
||||
enum direction_e key = UP;
|
||||
int i = 10;
|
||||
int j = 0;
|
||||
int i = 2;
|
||||
|
||||
switch (key) {
|
||||
case UP:
|
||||
i = 5;
|
||||
switch (i) {
|
||||
case 0:
|
||||
FALL_THROUGH;
|
||||
case DOWN:
|
||||
j = i * 2;
|
||||
case 1:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -332,11 +354,17 @@ int main(void) {
|
||||
return 0;
|
||||
}" HAVE_COMPILER__FUNCTION__)
|
||||
|
||||
# Stop treating warnings as errors
|
||||
unset(CMAKE_REQUIRED_FLAGS)
|
||||
|
||||
check_c_source_compiles("
|
||||
void chacha_keysetup(struct chacha_ctx *x, const u_char *k, u_int kbits)
|
||||
__attribute__((__bounded__(__minbytes__, 2, CHACHA_MINKEYLEN)));
|
||||
int main(void) { return 0; }" HAVE_GCC_BOUNDED_ATTRIBUTE)
|
||||
#define ARRAY_LEN 16
|
||||
void test_attr(const unsigned char *k)
|
||||
__attribute__((__bounded__(__minbytes__, 2, 16)));
|
||||
|
||||
int main(void) {
|
||||
return 0;
|
||||
}" HAVE_GCC_BOUNDED_ATTRIBUTE)
|
||||
|
||||
if (WITH_DEBUG_CRYPTO)
|
||||
set(DEBUG_CRYPTO 1)
|
||||
|
||||
@@ -29,8 +29,12 @@ if(WITH_BENCHMARKS)
|
||||
set(UNIT_TESTING ON)
|
||||
endif(WITH_BENCHMARKS)
|
||||
|
||||
if (WITH_STATIC_LIB)
|
||||
set(BUILD_STATIC_LIB ON)
|
||||
endif (WITH_STATIC_LIB)
|
||||
|
||||
if (UNIT_TESTING)
|
||||
set(WITH_STATIC_LIB ON)
|
||||
set(BUILD_STATIC_LIB ON)
|
||||
endif (UNIT_TESTING)
|
||||
|
||||
if (WITH_NACL)
|
||||
|
||||
@@ -21,17 +21,16 @@
|
||||
#
|
||||
|
||||
if (WIN32)
|
||||
set(_NSIS_ROOT_HINTS
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\NSIS;Default]")
|
||||
set(_x86 "(x86)")
|
||||
|
||||
set(_NSIS_ROOT_PATHS
|
||||
$ENV{PROGRAMFILES}/NSIS)
|
||||
"$ENV{ProgramFiles}/NSIS"
|
||||
"$ENV{ProgramFiles${_x86}}/NSIS"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\NSIS;Default]")
|
||||
|
||||
find_path(NSIS_ROOT_PATH
|
||||
NAMES
|
||||
Include/Library.nsh
|
||||
HINTS
|
||||
${_NSIS_ROOT_HINTS}
|
||||
PATHS
|
||||
${_NSIS_ROOT_PATHS}
|
||||
)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/* Name of package */
|
||||
#cmakedefine PACKAGE "${APPLICATION_NAME}"
|
||||
#cmakedefine PACKAGE "${PROJECT_NAME}"
|
||||
|
||||
/* Version number of package */
|
||||
#cmakedefine VERSION "${APPLICATION_VERSION}"
|
||||
#cmakedefine VERSION "${PROJECT_VERSION}"
|
||||
|
||||
#cmakedefine LOCALEDIR "${LOCALE_INSTALL_DIR}"
|
||||
#cmakedefine DATADIR "${DATADIR}"
|
||||
@@ -193,6 +193,9 @@
|
||||
|
||||
#cmakedefine HAVE_FALLTHROUGH_ATTRIBUTE 1
|
||||
|
||||
#cmakedefine HAVE_CONSTRUCTOR_ATTRIBUTE 1
|
||||
#cmakedefine HAVE_DESTRUCTOR_ATTRIBUTE 1
|
||||
|
||||
#cmakedefine HAVE_GCC_VOLATILE_MEMORY_PROTECTION 1
|
||||
#cmakedefine HAVE_GCC_NARG_MACRO 1
|
||||
|
||||
|
||||
@@ -78,8 +78,8 @@
|
||||
|
||||
/* libssh version */
|
||||
#define LIBSSH_VERSION_MAJOR 0
|
||||
#define LIBSSH_VERSION_MINOR 7
|
||||
#define LIBSSH_VERSION_MICRO 90
|
||||
#define LIBSSH_VERSION_MINOR 8
|
||||
#define LIBSSH_VERSION_MICRO 1
|
||||
|
||||
#define LIBSSH_VERSION_INT SSH_VERSION_INT(LIBSSH_VERSION_MAJOR, \
|
||||
LIBSSH_VERSION_MINOR, \
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <pthread.h>
|
||||
#define SSH_MUTEX pthread_mutex_t
|
||||
|
||||
#if defined _GNU_SOURCE
|
||||
#if defined(PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP)
|
||||
#define SSH_MUTEX_STATIC_INIT PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
|
||||
#else
|
||||
#define SSH_MUTEX_STATIC_INIT PTHREAD_MUTEX_INITIALIZER
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
set(PACKAGE_VERSION @APPLICATION_VERSION@)
|
||||
set(PACKAGE_VERSION @PROJECT_VERSION@)
|
||||
|
||||
# Check whether the requested PACKAGE_FIND_VERSION is compatible
|
||||
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Name: ${APPLICATION_NAME}
|
||||
Name: ${PROJECT_NAME}
|
||||
Description: The SSH Library
|
||||
Version: ${APPLICATION_VERSION}
|
||||
Version: ${PROJECT_VERSION}
|
||||
Libs: -L${LIB_INSTALL_DIR} -lssh
|
||||
Cflags: -I${INCLUDE_INSTALL_DIR}
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
Name: ${APPLICATION_NAME}_threads
|
||||
Description: The SSH Library Thread Extension
|
||||
Version: ${APPLICATION_VERSION}
|
||||
Libs: -L${LIB_INSTALL_DIR} -lssh_threads
|
||||
Cflags: -I${INCLUDE_INSTALL_DIR}
|
||||
|
||||
@@ -1 +1 @@
|
||||
4.5.0
|
||||
4.5.1
|
||||
0
src/ABI/libssh-4.5.1.symbols
Normal file
0
src/ABI/libssh-4.5.1.symbols
Normal file
@@ -106,12 +106,12 @@ set(LIBSSH_SHARED_LIBRARY
|
||||
CACHE INTERNAL "libssh shared library"
|
||||
)
|
||||
|
||||
if (WITH_STATIC_LIB)
|
||||
if (BUILD_STATIC_LIB)
|
||||
set(LIBSSH_STATIC_LIBRARY
|
||||
ssh_static
|
||||
CACHE INTERNAL "libssh static library"
|
||||
)
|
||||
endif (WITH_STATIC_LIB)
|
||||
endif (BUILD_STATIC_LIB)
|
||||
|
||||
set(libssh_SRCS
|
||||
agent.c
|
||||
@@ -340,7 +340,7 @@ install(
|
||||
COMPONENT libraries
|
||||
)
|
||||
|
||||
if (WITH_STATIC_LIB)
|
||||
if (BUILD_STATIC_LIB)
|
||||
add_library(${LIBSSH_STATIC_LIBRARY} STATIC ${libssh_SRCS})
|
||||
|
||||
if (MSVC)
|
||||
@@ -370,14 +370,14 @@ if (WITH_STATIC_LIB)
|
||||
)
|
||||
endif (WIN32)
|
||||
|
||||
install(
|
||||
TARGETS
|
||||
${LIBSSH_STATIC_LIBRARY}
|
||||
DESTINATION
|
||||
${LIB_INSTALL_DIR}/${OUTPUT_SUFFIX}
|
||||
COMPONENT
|
||||
libraries
|
||||
)
|
||||
endif (WITH_STATIC_LIB)
|
||||
if (WITH_STATIC_LIB)
|
||||
install(TARGETS
|
||||
${LIBSSH_STATIC_LIBRARY}
|
||||
DESTINATION
|
||||
${LIB_INSTALL_DIR}/${OUTPUT_SUFFIX}
|
||||
COMPONENT
|
||||
libraries)
|
||||
endif (WITH_STATIC_LIB)
|
||||
endif (BUILD_STATIC_LIB)
|
||||
|
||||
message(STATUS "Threads_FOUND=${Threads_FOUND}")
|
||||
|
||||
72
src/init.c
72
src/init.c
@@ -32,8 +32,17 @@
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONSTRUCTOR_ATTRIBUTE
|
||||
#define CONSTRUCTOR_ATTRIBUTE __attribute__((constructor))
|
||||
#else
|
||||
#define CONSTRUCTOR_ATTRIBUTE
|
||||
#endif /* HAVE_CONSTRUCTOR_ATTRIBUTE */
|
||||
|
||||
#ifdef HAVE_DESTRUCTOR_ATTRIBUTE
|
||||
#define DESTRUCTOR_ATTRIBUTE __attribute__((destructor))
|
||||
#else
|
||||
#define DESTRUCTOR_ATTRIBUTE
|
||||
#endif /* HAVE_DESTRUCTOR_ATTRIBUTE */
|
||||
|
||||
/* Declare static mutex */
|
||||
static SSH_MUTEX ssh_init_mutex = SSH_MUTEX_STATIC_INIT;
|
||||
@@ -144,29 +153,29 @@ static int _ssh_finalize(unsigned destructor) {
|
||||
|
||||
if (!destructor) {
|
||||
ssh_mutex_lock(&ssh_init_mutex);
|
||||
}
|
||||
|
||||
if (_ssh_initialized == 1) {
|
||||
_ssh_initialized = 0;
|
||||
|
||||
if (_ssh_init_ret < 0) {
|
||||
if (_ssh_initialized > 1) {
|
||||
_ssh_initialized--;
|
||||
goto _ret;
|
||||
}
|
||||
|
||||
ssh_dh_finalize();
|
||||
ssh_crypto_finalize();
|
||||
ssh_socket_cleanup();
|
||||
/* It is important to finalize threading after CRYPTO because
|
||||
* it still depends on it */
|
||||
ssh_threads_finalize();
|
||||
|
||||
}
|
||||
else {
|
||||
if (_ssh_initialized > 0) {
|
||||
_ssh_initialized--;
|
||||
if (_ssh_initialized == 1) {
|
||||
if (_ssh_init_ret < 0) {
|
||||
goto _ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If the counter reaches zero or it is the destructor calling, finalize */
|
||||
ssh_dh_finalize();
|
||||
ssh_crypto_finalize();
|
||||
ssh_socket_cleanup();
|
||||
/* It is important to finalize threading after CRYPTO because
|
||||
* it still depends on it */
|
||||
ssh_threads_finalize();
|
||||
|
||||
_ssh_initialized = 0;
|
||||
|
||||
_ret:
|
||||
if (!destructor) {
|
||||
ssh_mutex_unlock(&ssh_init_mutex);
|
||||
@@ -191,14 +200,6 @@ void libssh_destructor(void)
|
||||
if (rc < 0) {
|
||||
fprintf(stderr, "Error in libssh_destructor()\n");
|
||||
}
|
||||
|
||||
/* Detect if ssh_init() was called without matching ssh_finalize() */
|
||||
if (_ssh_initialized > 0) {
|
||||
fprintf(stderr,
|
||||
"Warning: ssh still initialized; probably ssh_init() "
|
||||
"was called more than once (init count: %d)\n",
|
||||
_ssh_initialized);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -221,4 +222,27 @@ int ssh_finalize(void) {
|
||||
return _ssh_finalize(0);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#ifdef _MSC_VER
|
||||
/* Library constructor and destructor */
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (fdwReason == DLL_PROCESS_ATTACH) {
|
||||
rc = ssh_init();
|
||||
} else if (fdwReason == DLL_PROCESS_DETACH) {
|
||||
rc = ssh_finalize();
|
||||
}
|
||||
|
||||
if (rc != 0) {
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
/** @} */
|
||||
|
||||
Reference in New Issue
Block a user