mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-05 12:50:30 +09:00
Compare commits
16 Commits
libssh-0.7
...
libssh-0.7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
186e7b5ca4 | ||
|
|
2197704693 | ||
|
|
229eb8715d | ||
|
|
1b18a06f8c | ||
|
|
91b513798e | ||
|
|
25234e510a | ||
|
|
d16eac5704 | ||
|
|
46bff47975 | ||
|
|
f718b50b3f | ||
|
|
58b7d0f5d2 | ||
|
|
30d4581be5 | ||
|
|
83387f957f | ||
|
|
f3620bbbad | ||
|
|
b45933d30d | ||
|
|
1613ed556d | ||
|
|
8f5b7b65eb |
@@ -8,7 +8,7 @@ set(APPLICATION_NAME ${PROJECT_NAME})
|
|||||||
|
|
||||||
set(APPLICATION_VERSION_MAJOR "0")
|
set(APPLICATION_VERSION_MAJOR "0")
|
||||||
set(APPLICATION_VERSION_MINOR "7")
|
set(APPLICATION_VERSION_MINOR "7")
|
||||||
set(APPLICATION_VERSION_PATCH "1")
|
set(APPLICATION_VERSION_PATCH "2")
|
||||||
|
|
||||||
set(APPLICATION_VERSION "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}")
|
set(APPLICATION_VERSION "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}")
|
||||||
|
|
||||||
@@ -84,8 +84,8 @@ add_subdirectory(include)
|
|||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
||||||
# pkg-config file
|
# pkg-config file
|
||||||
|
if (UNIX)
|
||||||
configure_file(libssh.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libssh.pc)
|
configure_file(libssh.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libssh.pc)
|
||||||
configure_file(libssh_threads.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libssh_threads.pc)
|
|
||||||
install(
|
install(
|
||||||
FILES
|
FILES
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/libssh.pc
|
${CMAKE_CURRENT_BINARY_DIR}/libssh.pc
|
||||||
@@ -96,6 +96,20 @@ install(
|
|||||||
pkgconfig
|
pkgconfig
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (LIBSSH_THREADS)
|
||||||
|
configure_file(libssh_threads.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libssh_threads.pc)
|
||||||
|
install(
|
||||||
|
FILES
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/libssh.pc
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/libssh_threads.pc
|
||||||
|
DESTINATION
|
||||||
|
${LIB_INSTALL_DIR}/pkgconfig
|
||||||
|
COMPONENT
|
||||||
|
pkgconfig
|
||||||
|
)
|
||||||
|
endif (LIBSSH_THREADS)
|
||||||
|
endif (UNIX)
|
||||||
|
|
||||||
# cmake config files
|
# cmake config files
|
||||||
set(LIBSSH_LIBRARY_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}ssh${CMAKE_SHARED_LIBRARY_SUFFIX})
|
set(LIBSSH_LIBRARY_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}ssh${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||||
set(LIBSSH_THREADS_LIBRARY_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}ssh${CMAKE_SHARED_LIBRARY_SUFFIX})
|
set(LIBSSH_THREADS_LIBRARY_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}ssh${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSIO
|
|||||||
|
|
||||||
|
|
||||||
### source generator
|
### source generator
|
||||||
set(CPACK_SOURCE_GENERATOR "TGZ")
|
set(CPACK_SOURCE_GENERATOR "TXZ")
|
||||||
set(CPACK_SOURCE_IGNORE_FILES "~$;[.]swp$;/[.]svn/;/[.]git/;.gitignore;/build/;/obj/;tags;cscope.*")
|
set(CPACK_SOURCE_IGNORE_FILES "~$;[.]swp$;/[.]svn/;/[.]git/;.gitignore;/build/;/obj/;tags;cscope.*")
|
||||||
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
|
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,14 @@
|
|||||||
ChangeLog
|
ChangeLog
|
||||||
==========
|
==========
|
||||||
|
|
||||||
|
version 0.7.2 (released 2015-09-15)
|
||||||
|
* Fixed OpenSSL detection on Windows
|
||||||
|
* Fixed return status for ssh_userauth_agent()
|
||||||
|
* Fixed KEX to prefer hmac-sha2-256
|
||||||
|
* Fixed sftp packet handling
|
||||||
|
* Fixed return values of ssh_key_is_(public|private)
|
||||||
|
* Fixed bug in global success reply
|
||||||
|
|
||||||
version 0.7.1 (released 2015-06-30)
|
version 0.7.1 (released 2015-06-30)
|
||||||
* Fixed SSH_AUTH_PARTIAL auth with auto public key
|
* Fixed SSH_AUTH_PARTIAL auth with auto public key
|
||||||
* Fixed memory leak in session options
|
* Fixed memory leak in session options
|
||||||
|
|||||||
@@ -65,23 +65,31 @@ if (WIN32)
|
|||||||
check_include_files("winsock2.h;ws2tcpip.h" HAVE_WS2TCPIP_H)
|
check_include_files("winsock2.h;ws2tcpip.h" HAVE_WS2TCPIP_H)
|
||||||
endif (WIN32)
|
endif (WIN32)
|
||||||
|
|
||||||
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIRS})
|
if (OPENSSL_FOUND)
|
||||||
check_include_file(openssl/aes.h HAVE_OPENSSL_AES_H)
|
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
||||||
|
check_include_file(openssl/des.h HAVE_OPENSSL_DES_H)
|
||||||
|
if (NOT HAVE_OPENSSL_DES_H)
|
||||||
|
message(FATAL_ERROR "Could not detect openssl/des.h")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIRS})
|
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
||||||
check_include_file(openssl/blowfish.h HAVE_OPENSSL_BLOWFISH_H)
|
check_include_file(openssl/aes.h HAVE_OPENSSL_AES_H)
|
||||||
|
if (NOT HAVE_OPENSSL_AES_H)
|
||||||
|
message(FATAL_ERROR "Could not detect openssl/aes.h")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIRS})
|
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
||||||
check_include_file(openssl/des.h HAVE_OPENSSL_DES_H)
|
check_include_file(openssl/blowfish.h HAVE_OPENSSL_BLOWFISH_H)
|
||||||
|
|
||||||
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIRS})
|
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
||||||
check_include_file(openssl/ecdh.h HAVE_OPENSSL_ECDH_H)
|
check_include_file(openssl/ecdh.h HAVE_OPENSSL_ECDH_H)
|
||||||
|
|
||||||
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIRS})
|
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
||||||
check_include_file(openssl/ec.h HAVE_OPENSSL_EC_H)
|
check_include_file(openssl/ec.h HAVE_OPENSSL_EC_H)
|
||||||
|
|
||||||
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIRS})
|
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
||||||
check_include_file(openssl/ecdsa.h HAVE_OPENSSL_ECDSA_H)
|
check_include_file(openssl/ecdsa.h HAVE_OPENSSL_ECDSA_H)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (CMAKE_HAVE_PTHREAD_H)
|
if (CMAKE_HAVE_PTHREAD_H)
|
||||||
set(HAVE_PTHREAD_H 1)
|
set(HAVE_PTHREAD_H 1)
|
||||||
|
|||||||
@@ -253,7 +253,7 @@ int sftp_read_sync(ssh_session session, sftp_session sftp)
|
|||||||
return SSH_ERROR;
|
return SSH_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
nwritten = write(fd, buf, nbytes);
|
nwritten = write(fd, buffer, nbytes);
|
||||||
if (nwritten != nbytes) {
|
if (nwritten != nbytes) {
|
||||||
fprintf(stderr, "Error writing: %s\n",
|
fprintf(stderr, "Error writing: %s\n",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
@@ -282,7 +282,7 @@ sftp_async_read() waits for the data to come. To open a file in nonblocking mode
|
|||||||
call sftp_file_set_nonblocking() right after you opened it. Default is blocking mode.
|
call sftp_file_set_nonblocking() right after you opened it. Default is blocking mode.
|
||||||
|
|
||||||
The example below reads a very big file in asynchronous, nonblocking, mode. Each
|
The example below reads a very big file in asynchronous, nonblocking, mode. Each
|
||||||
time the data are not ready yet, a counter is incrementer.
|
time the data is not ready yet, a counter is incremented.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
// Good chunk size
|
// Good chunk size
|
||||||
|
|||||||
@@ -78,7 +78,7 @@
|
|||||||
/* libssh version */
|
/* libssh version */
|
||||||
#define LIBSSH_VERSION_MAJOR 0
|
#define LIBSSH_VERSION_MAJOR 0
|
||||||
#define LIBSSH_VERSION_MINOR 7
|
#define LIBSSH_VERSION_MINOR 7
|
||||||
#define LIBSSH_VERSION_MICRO 1
|
#define LIBSSH_VERSION_MICRO 2
|
||||||
|
|
||||||
#define LIBSSH_VERSION_INT SSH_VERSION_INT(LIBSSH_VERSION_MAJOR, \
|
#define LIBSSH_VERSION_INT SSH_VERSION_INT(LIBSSH_VERSION_MAJOR, \
|
||||||
LIBSSH_VERSION_MINOR, \
|
LIBSSH_VERSION_MINOR, \
|
||||||
|
|||||||
@@ -60,6 +60,7 @@
|
|||||||
|
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
|
# include <stdarg.h> /* va_copy define check */
|
||||||
|
|
||||||
/* On Microsoft compilers define inline to __inline on all others use inline */
|
/* On Microsoft compilers define inline to __inline on all others use inline */
|
||||||
# undef inline
|
# undef inline
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ endif (GCRYPT_LIBRARY)
|
|||||||
if (WITH_ZLIB)
|
if (WITH_ZLIB)
|
||||||
set(LIBSSH_PRIVATE_INCLUDE_DIRS
|
set(LIBSSH_PRIVATE_INCLUDE_DIRS
|
||||||
${LIBSSH_PRIVATE_INCLUDE_DIRS}
|
${LIBSSH_PRIVATE_INCLUDE_DIRS}
|
||||||
${ZLIB_INCLUDE_DIRS}
|
${ZLIB_INCLUDE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
set(LIBSSH_LINK_LIBRARIES
|
set(LIBSSH_LINK_LIBRARIES
|
||||||
@@ -300,6 +300,7 @@ if (WITH_STATIC_LIB)
|
|||||||
)
|
)
|
||||||
endif (WITH_STATIC_LIB)
|
endif (WITH_STATIC_LIB)
|
||||||
|
|
||||||
|
message(STATUS "Threads_FOUND=${Threads_FOUND}")
|
||||||
if (Threads_FOUND)
|
if (Threads_FOUND)
|
||||||
add_subdirectory(threads)
|
add_subdirectory(threads)
|
||||||
endif (Threads_FOUND)
|
endif (Threads_FOUND)
|
||||||
|
|||||||
@@ -786,6 +786,11 @@ int ssh_userauth_agent(ssh_session session,
|
|||||||
state = session->agent_state;
|
state = session->agent_state;
|
||||||
if (state->pubkey == NULL)
|
if (state->pubkey == NULL)
|
||||||
state->pubkey = ssh_agent_get_first_ident(session, &state->comment);
|
state->pubkey = ssh_agent_get_first_ident(session, &state->comment);
|
||||||
|
|
||||||
|
if (state->pubkey == NULL) {
|
||||||
|
return SSH_AUTH_DENIED;
|
||||||
|
}
|
||||||
|
|
||||||
while (state->pubkey != NULL) {
|
while (state->pubkey != NULL) {
|
||||||
if(state->state == SSH_AGENT_STATE_NONE){
|
if(state->state == SSH_AGENT_STATE_NONE){
|
||||||
SSH_LOG(SSH_LOG_DEBUG,
|
SSH_LOG(SSH_LOG_DEBUG,
|
||||||
|
|||||||
@@ -103,5 +103,9 @@ void ssh_print_bignum(const char *which, bignum num) {
|
|||||||
#endif
|
#endif
|
||||||
fprintf(stderr, "%s value: ", which);
|
fprintf(stderr, "%s value: ", which);
|
||||||
fprintf(stderr, "%s\n", (hex == NULL) ? "(null)" : (char *) hex);
|
fprintf(stderr, "%s\n", (hex == NULL) ? "(null)" : (char *) hex);
|
||||||
|
#ifdef HAVE_LIBGCRYPT
|
||||||
SAFE_FREE(hex);
|
SAFE_FREE(hex);
|
||||||
|
#elif defined HAVE_LIBCRYPTO
|
||||||
|
OPENSSL_free(hex);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,8 +94,8 @@ static const char *default_methods[] = {
|
|||||||
HOSTKEYS,
|
HOSTKEYS,
|
||||||
AES BLOWFISH DES,
|
AES BLOWFISH DES,
|
||||||
AES BLOWFISH DES,
|
AES BLOWFISH DES,
|
||||||
"hmac-sha1,hmac-sha2-256,hmac-sha2-512",
|
"hmac-sha2-256,hmac-sha2-512,hmac-sha1",
|
||||||
"hmac-sha1,hmac-sha2-256,hmac-sha2-512",
|
"hmac-sha2-256,hmac-sha2-512,hmac-sha1",
|
||||||
"none",
|
"none",
|
||||||
"none",
|
"none",
|
||||||
"",
|
"",
|
||||||
@@ -109,8 +109,8 @@ static const char *supported_methods[] = {
|
|||||||
HOSTKEYS,
|
HOSTKEYS,
|
||||||
AES BLOWFISH DES_SUPPORTED,
|
AES BLOWFISH DES_SUPPORTED,
|
||||||
AES BLOWFISH DES_SUPPORTED,
|
AES BLOWFISH DES_SUPPORTED,
|
||||||
"hmac-sha1,hmac-sha2-256,hmac-sha2-512",
|
"hmac-sha2-256,hmac-sha2-512,hmac-sha1",
|
||||||
"hmac-sha1,hmac-sha2-256,hmac-sha2-512",
|
"hmac-sha2-256,hmac-sha2-512,hmac-sha1",
|
||||||
ZLIB,
|
ZLIB,
|
||||||
ZLIB,
|
ZLIB,
|
||||||
"",
|
"",
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ int ssh_key_is_public(const ssh_key k) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (k->flags & SSH_KEY_FLAG_PUBLIC);
|
return (k->flags & SSH_KEY_FLAG_PUBLIC) == SSH_KEY_FLAG_PUBLIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -286,7 +286,7 @@ int ssh_key_is_private(const ssh_key k) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (k->flags & SSH_KEY_FLAG_PRIVATE);
|
return (k->flags & SSH_KEY_FLAG_PRIVATE) == SSH_KEY_FLAG_PRIVATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -746,7 +746,7 @@ int ssh_message_global_request_reply_success(ssh_message msg, uint16_t bound_por
|
|||||||
if(msg->global_request.type == SSH_GLOBAL_REQUEST_TCPIP_FORWARD
|
if(msg->global_request.type == SSH_GLOBAL_REQUEST_TCPIP_FORWARD
|
||||||
&& msg->global_request.bind_port == 0) {
|
&& msg->global_request.bind_port == 0) {
|
||||||
rc = ssh_buffer_pack(msg->session->out_buffer, "d", bound_port);
|
rc = ssh_buffer_pack(msg->session->out_buffer, "d", bound_port);
|
||||||
if (rc != SSH_ERROR) {
|
if (rc != SSH_OK) {
|
||||||
ssh_set_error_oom(msg->session);
|
ssh_set_error_oom(msg->session);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|||||||
20
src/sftp.c
20
src/sftp.c
@@ -315,7 +315,7 @@ sftp_packet sftp_packet_read(sftp_session sftp) {
|
|||||||
sftp_packet packet = NULL;
|
sftp_packet packet = NULL;
|
||||||
uint32_t tmp;
|
uint32_t tmp;
|
||||||
size_t size;
|
size_t size;
|
||||||
int r;
|
int r, s;
|
||||||
|
|
||||||
packet = malloc(sizeof(struct sftp_packet_struct));
|
packet = malloc(sizeof(struct sftp_packet_struct));
|
||||||
if (packet == NULL) {
|
if (packet == NULL) {
|
||||||
@@ -330,12 +330,18 @@ sftp_packet sftp_packet_read(sftp_session sftp) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
r=ssh_channel_read(sftp->channel, buffer, 4, 0);
|
r=0;
|
||||||
if (r < 0) {
|
do {
|
||||||
ssh_buffer_free(packet->payload);
|
// read from channel until 4 bytes have been read or an error occurs
|
||||||
SAFE_FREE(packet);
|
s=ssh_channel_read(sftp->channel, buffer+r, 4-r, 0);
|
||||||
return NULL;
|
if (s < 0) {
|
||||||
}
|
ssh_buffer_free(packet->payload);
|
||||||
|
SAFE_FREE(packet);
|
||||||
|
return NULL;
|
||||||
|
} else {
|
||||||
|
r += s;
|
||||||
|
}
|
||||||
|
} while (r<4);
|
||||||
ssh_buffer_add_data(packet->payload, buffer, r);
|
ssh_buffer_add_data(packet->payload, buffer, r);
|
||||||
if (buffer_get_u32(packet->payload, &tmp) != sizeof(uint32_t)) {
|
if (buffer_get_u32(packet->payload, &tmp) != sizeof(uint32_t)) {
|
||||||
ssh_set_error(sftp->session, SSH_FATAL, "Short sftp packet!");
|
ssh_set_error(sftp->session, SSH_FATAL, "Short sftp packet!");
|
||||||
|
|||||||
@@ -27,8 +27,9 @@ set(LIBSSH_THREADS_LINK_LIBRARIES
|
|||||||
${LIBSSH_SHARED_LIBRARY}
|
${LIBSSH_SHARED_LIBRARY}
|
||||||
)
|
)
|
||||||
|
|
||||||
set(libssh_threads_SRCS
|
message(STATUS "threads library: Threads_FOUND=${Threads_FOUND}")
|
||||||
)
|
|
||||||
|
set(libssh_threads_SRCS) # empty SRC
|
||||||
|
|
||||||
# build and link pthread
|
# build and link pthread
|
||||||
if (CMAKE_USE_PTHREADS_INIT)
|
if (CMAKE_USE_PTHREADS_INIT)
|
||||||
@@ -41,6 +42,8 @@ if (CMAKE_USE_PTHREADS_INIT)
|
|||||||
${LIBSSH_THREADS_LINK_LIBRARIES}
|
${LIBSSH_THREADS_LINK_LIBRARIES}
|
||||||
${CMAKE_THREAD_LIBS_INIT}
|
${CMAKE_THREAD_LIBS_INIT}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
message(STATUS "libssh_threads_SRCS=${libssh_threads_SRCS}")
|
||||||
endif (CMAKE_USE_PTHREADS_INIT)
|
endif (CMAKE_USE_PTHREADS_INIT)
|
||||||
|
|
||||||
set(LIBSSH_THREADS_LINK_LIBRARIES
|
set(LIBSSH_THREADS_LINK_LIBRARIES
|
||||||
@@ -54,6 +57,8 @@ include_directories(
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (libssh_threads_SRCS)
|
if (libssh_threads_SRCS)
|
||||||
|
set(LIBSSH_THREADS ON CACHE "libssh threads lib" INTERNAL)
|
||||||
|
|
||||||
add_library(${LIBSSH_THREADS_SHARED_LIBRARY} SHARED ${libssh_threads_SRCS})
|
add_library(${LIBSSH_THREADS_SHARED_LIBRARY} SHARED ${libssh_threads_SRCS})
|
||||||
|
|
||||||
target_link_libraries(${LIBSSH_THREADS_SHARED_LIBRARY} ${LIBSSH_THREADS_LINK_LIBRARIES})
|
target_link_libraries(${LIBSSH_THREADS_SHARED_LIBRARY} ${LIBSSH_THREADS_LINK_LIBRARIES})
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ set(TORTURE_LIBRARY torture)
|
|||||||
include_directories(
|
include_directories(
|
||||||
${LIBSSH_PUBLIC_INCLUDE_DIRS}
|
${LIBSSH_PUBLIC_INCLUDE_DIRS}
|
||||||
${CMOCKA_INCLUDE_DIR}
|
${CMOCKA_INCLUDE_DIR}
|
||||||
${OPENSSL_INCLUDE_DIRS}
|
${OPENSSL_INCLUDE_DIR}
|
||||||
${GCRYPT_INCLUDE_DIRS}
|
${GCRYPT_INCLUDE_DIR}
|
||||||
${ZLIB_INCLUDE_DIRS}
|
${ZLIB_INCLUDE_DIR}
|
||||||
${CMAKE_BINARY_DIR}
|
${CMAKE_BINARY_DIR}
|
||||||
${CMAKE_SOURCE_DIR}/src
|
${CMAKE_SOURCE_DIR}/src
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
@@ -22,12 +22,12 @@ set(TORTURE_LINK_LIBRARIES
|
|||||||
${LIBSSH_STATIC_LIBRARY}
|
${LIBSSH_STATIC_LIBRARY}
|
||||||
${LIBSSH_LINK_LIBRARIES})
|
${LIBSSH_LINK_LIBRARIES})
|
||||||
|
|
||||||
if (Threads_FOUND)
|
if (LIBSSH_THREADS)
|
||||||
set(TORTURE_LINK_LIBRARIES
|
set(TORTURE_LINK_LIBRARIES
|
||||||
${TORTURE_LINK_LIBRARIES}
|
${TORTURE_LINK_LIBRARIES}
|
||||||
${LIBSSH_THREADS_STATIC_LIBRARY}
|
${LIBSSH_THREADS_STATIC_LIBRARY}
|
||||||
${LIBSSH_THREADS_LINK_LIBRARIES})
|
${LIBSSH_THREADS_LINK_LIBRARIES})
|
||||||
endif ()
|
endif (LIBSSH_THREADS)
|
||||||
|
|
||||||
# create test library
|
# create test library
|
||||||
add_library(${TORTURE_LIBRARY} STATIC cmdline.c torture.c)
|
add_library(${TORTURE_LIBRARY} STATIC cmdline.c torture.c)
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ if (WITH_SERVER AND UNIX AND NOT WIN32)
|
|||||||
include_directories(
|
include_directories(
|
||||||
${LIBSSH_PUBLIC_INCLUDE_DIRS}
|
${LIBSSH_PUBLIC_INCLUDE_DIRS}
|
||||||
${CMOCKA_INCLUDE_DIR}
|
${CMOCKA_INCLUDE_DIR}
|
||||||
${OPENSSL_INCLUDE_DIRS}
|
${OPENSSL_INCLUDE_DIR}
|
||||||
${GCRYPT_INCLUDE_DIRS}
|
${GCRYPT_INCLUDE_DIR}
|
||||||
${ZLIB_INCLUDE_DIRS}
|
${ZLIB_INCLUDE_DIR}
|
||||||
${CMAKE_BINARY_DIR}
|
${CMAKE_BINARY_DIR}
|
||||||
${CMAKE_SOURCE_DIR}/src
|
${CMAKE_SOURCE_DIR}/src
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
|||||||
@@ -14,11 +14,13 @@ if (UNIX AND NOT WIN32)
|
|||||||
# requires ssh-keygen
|
# requires ssh-keygen
|
||||||
add_cmocka_test(torture_keyfiles torture_keyfiles.c ${TORTURE_LIBRARY})
|
add_cmocka_test(torture_keyfiles torture_keyfiles.c ${TORTURE_LIBRARY})
|
||||||
add_cmocka_test(torture_pki torture_pki.c ${TORTURE_LIBRARY})
|
add_cmocka_test(torture_pki torture_pki.c ${TORTURE_LIBRARY})
|
||||||
# requires pthread
|
|
||||||
add_cmocka_test(torture_rand torture_rand.c ${TORTURE_LIBRARY})
|
|
||||||
# requires /dev/null
|
# requires /dev/null
|
||||||
add_cmocka_test(torture_channel torture_channel.c ${TORTURE_LIBRARY})
|
add_cmocka_test(torture_channel torture_channel.c ${TORTURE_LIBRARY})
|
||||||
if (WITH_SERVER AND Threads_FOUND)
|
# requires pthread
|
||||||
add_cmocka_test(torture_server_x11 torture_server_x11.c ${TORTURE_LIBRARY})
|
if (LIBSSH_THREADS)
|
||||||
endif (WITH_SERVER AND Threads_FOUND)
|
add_cmocka_test(torture_rand torture_rand.c ${TORTURE_LIBRARY})
|
||||||
|
if (WITH_SERVER)
|
||||||
|
add_cmocka_test(torture_server_x11 torture_server_x11.c ${TORTURE_LIBRARY})
|
||||||
|
endif (WITH_SERVER)
|
||||||
|
endif (LIBSSH_THREADS)
|
||||||
endif (UNIX AND NOT WIN32)
|
endif (UNIX AND NOT WIN32)
|
||||||
|
|||||||
@@ -212,6 +212,9 @@ static void torture_pki_import_privkey_base64_RSA(void **state) {
|
|||||||
type = ssh_key_type(key);
|
type = ssh_key_type(key);
|
||||||
assert_true(type == SSH_KEYTYPE_RSA);
|
assert_true(type == SSH_KEYTYPE_RSA);
|
||||||
|
|
||||||
|
rc = ssh_key_is_private(key);
|
||||||
|
assert_true(rc == 1);
|
||||||
|
|
||||||
rc = ssh_key_is_public(key);
|
rc = ssh_key_is_public(key);
|
||||||
assert_true(rc == 1);
|
assert_true(rc == 1);
|
||||||
|
|
||||||
@@ -281,6 +284,9 @@ static void torture_pki_import_privkey_base64_ECDSA(void **state) {
|
|||||||
rc = ssh_pki_import_privkey_base64(key_str, passphrase, NULL, NULL, &key);
|
rc = ssh_pki_import_privkey_base64(key_str, passphrase, NULL, NULL, &key);
|
||||||
assert_true(rc == 0);
|
assert_true(rc == 0);
|
||||||
|
|
||||||
|
rc = ssh_key_is_private(key);
|
||||||
|
assert_true(rc == 1);
|
||||||
|
|
||||||
free(key_str);
|
free(key_str);
|
||||||
ssh_key_free(key);
|
ssh_key_free(key);
|
||||||
}
|
}
|
||||||
@@ -300,6 +306,10 @@ static void torture_pki_import_privkey_base64_passphrase(void **state) {
|
|||||||
NULL,
|
NULL,
|
||||||
&key);
|
&key);
|
||||||
assert_true(rc == 0);
|
assert_true(rc == 0);
|
||||||
|
|
||||||
|
rc = ssh_key_is_private(key);
|
||||||
|
assert_true(rc == 1);
|
||||||
|
|
||||||
ssh_key_free(key);
|
ssh_key_free(key);
|
||||||
|
|
||||||
/* test if it returns -1 if passphrase is wrong */
|
/* test if it returns -1 if passphrase is wrong */
|
||||||
@@ -329,6 +339,10 @@ static void torture_pki_import_privkey_base64_passphrase(void **state) {
|
|||||||
NULL,
|
NULL,
|
||||||
&key);
|
&key);
|
||||||
assert_true(rc == 0);
|
assert_true(rc == 0);
|
||||||
|
|
||||||
|
rc = ssh_key_is_private(key);
|
||||||
|
assert_true(rc == 1);
|
||||||
|
|
||||||
ssh_key_free(key);
|
ssh_key_free(key);
|
||||||
|
|
||||||
/* test if it returns -1 if passphrase is wrong */
|
/* test if it returns -1 if passphrase is wrong */
|
||||||
@@ -358,6 +372,10 @@ static void torture_pki_import_privkey_base64_passphrase(void **state) {
|
|||||||
NULL,
|
NULL,
|
||||||
&key);
|
&key);
|
||||||
assert_true(rc == 0);
|
assert_true(rc == 0);
|
||||||
|
|
||||||
|
rc = ssh_key_is_private(key);
|
||||||
|
assert_true(rc == 1);
|
||||||
|
|
||||||
ssh_key_free(key);
|
ssh_key_free(key);
|
||||||
|
|
||||||
/* test if it returns -1 if passphrase is wrong */
|
/* test if it returns -1 if passphrase is wrong */
|
||||||
@@ -388,6 +406,9 @@ static void torture_pki_import_privkey_base64_ed25519(void **state){
|
|||||||
type = ssh_key_type(key);
|
type = ssh_key_type(key);
|
||||||
assert_true(type == SSH_KEYTYPE_ED25519);
|
assert_true(type == SSH_KEYTYPE_ED25519);
|
||||||
|
|
||||||
|
rc = ssh_key_is_private(key);
|
||||||
|
assert_true(rc == 1);
|
||||||
|
|
||||||
rc = ssh_key_is_public(key);
|
rc = ssh_key_is_public(key);
|
||||||
assert_true(rc == 1);
|
assert_true(rc == 1);
|
||||||
|
|
||||||
@@ -411,6 +432,9 @@ static void torture_pki_pki_publickey_from_privatekey_RSA(void **state) {
|
|||||||
&key);
|
&key);
|
||||||
assert_true(rc == 0);
|
assert_true(rc == 0);
|
||||||
|
|
||||||
|
rc = ssh_key_is_private(key);
|
||||||
|
assert_true(rc == 1);
|
||||||
|
|
||||||
rc = ssh_pki_export_privkey_to_pubkey(key, &pubkey);
|
rc = ssh_pki_export_privkey_to_pubkey(key, &pubkey);
|
||||||
assert_true(rc == SSH_OK);
|
assert_true(rc == SSH_OK);
|
||||||
|
|
||||||
@@ -433,6 +457,9 @@ static void torture_pki_pki_publickey_from_privatekey_DSA(void **state) {
|
|||||||
&key);
|
&key);
|
||||||
assert_true(rc == 0);
|
assert_true(rc == 0);
|
||||||
|
|
||||||
|
rc = ssh_key_is_private(key);
|
||||||
|
assert_true(rc == 1);
|
||||||
|
|
||||||
rc = ssh_pki_export_privkey_to_pubkey(key, &pubkey);
|
rc = ssh_pki_export_privkey_to_pubkey(key, &pubkey);
|
||||||
assert_true(rc == SSH_OK);
|
assert_true(rc == SSH_OK);
|
||||||
|
|
||||||
@@ -455,6 +482,9 @@ static void torture_pki_pki_publickey_from_privatekey_ed25519(void **state){
|
|||||||
&key);
|
&key);
|
||||||
assert_true(rc == 0);
|
assert_true(rc == 0);
|
||||||
|
|
||||||
|
rc = ssh_key_is_private(key);
|
||||||
|
assert_true(rc == 1);
|
||||||
|
|
||||||
rc = ssh_pki_export_privkey_to_pubkey(key, &pubkey);
|
rc = ssh_pki_export_privkey_to_pubkey(key, &pubkey);
|
||||||
assert_true(rc == SSH_OK);
|
assert_true(rc == SSH_OK);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user