Compare commits

...

32 Commits

Author SHA1 Message Date
Andreas Schneider
186e7b5ca4 kex: Fix zlib compression
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 747e7d05db)
2015-09-16 08:34:58 +02:00
Andreas Schneider
2197704693 Bump version to 0.7.2 2015-09-15 15:17:35 +02:00
Andreas Schneider
229eb8715d cmake: Use tar.xz source package generator
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 1f3a9105ff)
2015-09-15 15:17:35 +02:00
Andreas Schneider
1b18a06f8c kex: Prefer sha2 over sha1
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit b0f22fde62)
2015-09-15 15:09:21 +02:00
Andreas Schneider
91b513798e cmake: Handle libssh threas library correctly
This should fix the build on Windows and would not install pkg files.

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 5b586fdfec)
2015-09-08 17:32:57 +02:00
Michael Wilder
25234e510a bignum: Fix OpenSSL crash in SAFE_FREE
Signed-off-by: Michael Wilder <wilder.michael@cimcor.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 2f193b5cbb)
2015-09-08 17:32:40 +02:00
Andreas Schneider
d16eac5704 server: Fix return code check of ssh_buffer_pack()
Thanks to Andreas Gutschick <andreas.gutschick@mitel.com>

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 36d9b62f1f)
2015-08-18 09:12:47 +02:00
Andreas Schneider
46bff47975 doc: Fix typos in sftp tutorial
Thanks to Anthony Baker <AnthonyBaker@fico.com>

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit da4bebbe1e)
2015-08-18 09:05:45 +02:00
Andreas Schneider
f718b50b3f tests: Add checks for ssh_key_is_private()
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit d54a1ab798)
2015-08-10 13:58:51 +02:00
Andreas Schneider
58b7d0f5d2 pki: Fix return values of ssh_key_is_(public|private)
Thanks to Kevin Haake <khaake@red-cocoa.com>

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit e1081796af)
2015-08-10 13:58:50 +02:00
Tilo Eckert
30d4581be5 sftp: Fix incorrect handling of received length fields
Signed-off-by: Tilo Eckert <tilo.eckert@flam.de>
2015-08-01 10:52:48 +03:00
Peter Volpe
83387f957f auth: Fix return status for ssh_userauth_agent()
BUG: https://red.libssh.org/issues/201

Return SSH_AUTH_DENIED instead of SSH_AUTH_ERROR when the provided agent
offers no public keys.

Signed-off-by: Peter Volpe <pvolpe@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit dc9c4d22ab)
2015-07-30 10:52:11 +02:00
Andreas Schneider
f3620bbbad cmake: Fix zlib include directory
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 728c2fbd01)
2015-07-03 12:36:53 +02:00
Andreas Schneider
b45933d30d cmake: Fix OpenSSL detection in non-standard path
This should fix the detection on Windows.

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 613b71b385)
2015-07-03 11:40:04 +02:00
Andreas Schneider
1613ed556d cmake: Fail if can't find OpenSSL aes and des headers
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 70cc11618a)
2015-07-03 10:52:56 +02:00
Andreas Schneider
8f5b7b65eb include: Add stdarg.h so we can check for va_copy macro
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-06-30 09:59:21 +02:00
Andreas Schneider
053f72c671 Bump version to 0.7.1
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-06-30 09:34:28 +02:00
Tilo Eckert
63a8f333b8 SSH_AUTH_PARTIAL is now correctly passed to the caller of ssh_userauth_publickey_auto().
Implicitly fixed unsafe return code handling that could result in use-after-free.

Signed-off-by: Tilo Eckert <tilo.eckert@flam.de>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 0423057424)
2015-06-29 11:11:26 +02:00
Tilo Eckert
57fd8e3187 available auth_methods must be reset on partial authentication
Signed-off-by: Tilo Eckert <tilo.eckert@flam.de>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit cc25d747d4)
2015-06-29 11:11:25 +02:00
Peter Volpe
03972b16c9 channels: Fix exit-signal data unpacking
Signed-off-by: Peter Volpe <pvolpe@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 7637351065)
2015-06-29 09:50:28 +02:00
Peter Volpe
ac7ed82585 agent: Add ssh_set_agent_socket
Allow callers to specify their own socket
for an ssh agent.

Signed-off-by: Peter Volpe <pvolpe@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 7aeba71a92)
2015-06-29 09:47:35 +02:00
Seb Boving
196c2e9c1f Don't allocate a new identity list in the new session's options.
The previous list is not freed. Since the new session just got
created, an identity list is already allocated and empty.

Signed-off-by: Sebastien Boving <seb@google.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit e020dd8d59)
2015-06-24 18:36:10 +02:00
Douglas Heriot
1accbcb98b cmake: Do not use CMAKE_(SOURCE|BINARY)_DIR
(cherry picked from commit a65af1b3b8)
2015-06-24 18:36:08 +02:00
Tiamo Laitakari
342ae10f08 pki: Fix allocation of ed25519 public keys
Signed-off-by: Tiamo Laitakari <tiamo.laitakari@cs.helsinki.fi>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 5478de1a64)
2015-06-24 18:36:08 +02:00
Jordy Moos
eb98a780ed Documentation fix where unsigned is used where signed is expected
Signed-off-by: Jordy Moos <jordymoos@gmail.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit fa9fbb1d67)
2015-06-24 18:36:08 +02:00
Andreas Schneider
64233fa3bb misc: Correctly guard the sys/time.h include
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit ef751a26d0)
2015-06-24 18:36:08 +02:00
Andreas Schneider
cbf5cf4ac3 include: Add support for older MSVC versions
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 30a7229fc5)
2015-06-24 16:24:12 +02:00
Andreas Schneider
a3f3f9cb76 kex: Add comments to #if clauses
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 1d69e073af)
2015-06-24 16:24:08 +02:00
Aris Adamantiadis
5aeae08be0 channels: fix exit-status not correctly set 2015-06-03 16:41:19 +02:00
Mike DePaulo
64a658acaa Comment that ssh_forward_cancel() is deprecated.
Signed-off-by: Aris Adamantiadis <aris@badcode.be>
2015-05-29 11:30:32 +02:00
Mike DePaulo
361940a5d7 Reintroduce ssh_forward_listen() (Fixes: #194)
Signed-off-by: Aris Adamantiadis <aris@badcode.be>
2015-05-29 11:24:27 +02:00
Andreas Schneider
2721cbc8ee ChangeLog: Set release date for 0.7.0 2015-05-11 10:42:08 +02:00
28 changed files with 213 additions and 94 deletions

View File

@@ -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 "0") 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}")
@@ -24,7 +24,7 @@ set(LIBRARY_SOVERSION "4")
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
set(CMAKE_MODULE_PATH set(CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/cmake/Modules ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules
) )
# add definitions # add definitions
@@ -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})

View File

@@ -4,10 +4,10 @@
### general settings ### general settings
set(CPACK_PACKAGE_NAME ${APPLICATION_NAME}) set(CPACK_PACKAGE_NAME ${APPLICATION_NAME})
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The SSH library") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The SSH library")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README") set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
set(CPACK_PACKAGE_VENDOR "The SSH Library Development Team") set(CPACK_PACKAGE_VENDOR "The SSH Library Development Team")
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME}) set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME})
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
### versions ### versions
@@ -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}")

View File

@@ -1,7 +1,22 @@
ChangeLog ChangeLog
========== ==========
version 0.7.0 (released 2015-05-xx) 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)
* Fixed SSH_AUTH_PARTIAL auth with auto public key
* Fixed memory leak in session options
* Fixed allocation of ed25519 public keys
* Fixed channel exit-status and exit-signal
* Reintroduce ssh_forward_listen()
version 0.7.0 (released 2015-05-11)
* Added support for ed25519 keys * Added support for ed25519 keys
* Added SHA2 algorithms for HMAC * Added SHA2 algorithms for HMAC
* Added improved and more secure buffer handling code * Added improved and more secure buffer handling code

View File

@@ -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)

View File

@@ -56,7 +56,7 @@ If an error has been encountered, it returns a negative value:
@code @code
char buffer[256]; char buffer[256];
unsigned int nbytes; int nbytes;
nbytes = ssh_channel_read(channel, buffer, sizeof(buffer), 0); nbytes = ssh_channel_read(channel, buffer, sizeof(buffer), 0);
while (nbytes > 0) while (nbytes > 0)

View File

@@ -367,7 +367,7 @@ int show_remote_processes(ssh_session session)
ssh_channel channel; ssh_channel channel;
int rc; int rc;
char buffer[256]; char buffer[256];
unsigned int nbytes; int nbytes;
channel = ssh_channel_new(session); channel = ssh_channel_new(session);
if (channel == NULL) if (channel == NULL)
@@ -391,7 +391,7 @@ int show_remote_processes(ssh_session session)
nbytes = ssh_channel_read(channel, buffer, sizeof(buffer), 0); nbytes = ssh_channel_read(channel, buffer, sizeof(buffer), 0);
while (nbytes > 0) while (nbytes > 0)
{ {
if (write(1, buffer, nbytes) != nbytes) if (write(1, buffer, nbytes) != (unsigned int) nbytes)
{ {
ssh_channel_close(channel); ssh_channel_close(channel);
ssh_channel_free(channel); ssh_channel_free(channel);

View File

@@ -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

View File

@@ -1,3 +1,3 @@
project(headers C) project(libssh-headers-x C)
add_subdirectory(libssh) add_subdirectory(libssh)

View File

@@ -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 0 #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, \
@@ -588,6 +588,7 @@ LIBSSH_API int ssh_select(ssh_channel *channels, ssh_channel *outchannels, socke
fd_set *readfds, struct timeval *timeout); fd_set *readfds, struct timeval *timeout);
LIBSSH_API int ssh_service_request(ssh_session session, const char *service); LIBSSH_API int ssh_service_request(ssh_session session, const char *service);
LIBSSH_API int ssh_set_agent_channel(ssh_session session, ssh_channel channel); LIBSSH_API int ssh_set_agent_channel(ssh_session session, ssh_channel channel);
LIBSSH_API int ssh_set_agent_socket(ssh_session session, socket_t fd);
LIBSSH_API void ssh_set_blocking(ssh_session session, int blocking); LIBSSH_API void ssh_set_blocking(ssh_session session, int blocking);
LIBSSH_API void ssh_set_counters(ssh_session session, ssh_counter scounter, LIBSSH_API void ssh_set_counters(ssh_session session, ssh_counter scounter,
ssh_counter rcounter); ssh_counter rcounter);

View File

@@ -60,11 +60,16 @@
# 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
# define inline __inline # define inline __inline
# ifndef va_copy
# define va_copy(dest, src) (dest = src)
# endif
# define strcasecmp _stricmp # define strcasecmp _stricmp
# define strncasecmp _strnicmp # define strncasecmp _strnicmp
# if ! defined(HAVE_ISBLANK) # if ! defined(HAVE_ISBLANK)

View File

@@ -1,12 +1,12 @@
project(libssh-library C) project(libssh-library C)
set(LIBSSH_PUBLIC_INCLUDE_DIRS set(LIBSSH_PUBLIC_INCLUDE_DIRS
${CMAKE_SOURCE_DIR}/include ${libssh_SOURCE_DIR}/include
CACHE INTERNAL "libssh public include directories" CACHE INTERNAL "libssh public include directories"
) )
set(LIBSSH_PRIVATE_INCLUDE_DIRS set(LIBSSH_PRIVATE_INCLUDE_DIRS
${CMAKE_BINARY_DIR} ${libssh_BINARY_DIR}
) )
set(LIBSSH_LINK_LIBRARIES set(LIBSSH_LINK_LIBRARIES
@@ -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)

View File

@@ -185,15 +185,32 @@ int ssh_set_agent_channel(ssh_session session, ssh_channel channel){
return SSH_OK; return SSH_OK;
} }
/** @brief sets the SSH agent socket.
* The SSH agent will be used to authenticate this client using
* the given socket to communicate with the ssh-agent. The caller
* is responsible for connecting to the socket prior to calling
* this function.
* @returns SSH_OK in case of success
* SSH_ERROR in case of an error
*/
int ssh_set_agent_socket(ssh_session session, socket_t fd){
if (!session)
return SSH_ERROR;
if (!session->agent){
ssh_set_error(session, SSH_REQUEST_DENIED, "Session has no active agent");
return SSH_ERROR;
}
ssh_socket_set_fd(session->agent->sock, fd);
return SSH_OK;
}
void agent_close(struct ssh_agent_struct *agent) { void agent_close(struct ssh_agent_struct *agent) {
if (agent == NULL) { if (agent == NULL) {
return; return;
} }
if (getenv("SSH_AUTH_SOCK")) { ssh_socket_close(agent->sock);
ssh_socket_close(agent->sock);
}
} }
void agent_free(ssh_agent agent) { void agent_free(ssh_agent agent) {

22
src/auth.c Normal file → Executable file
View File

@@ -209,8 +209,8 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_failure){
"Access denied. Authentication that can continue: %s", "Access denied. Authentication that can continue: %s",
auth_methods); auth_methods);
session->auth_methods = 0;
} }
session->auth_methods = 0;
if (strstr(auth_methods, "password") != NULL) { if (strstr(auth_methods, "password") != NULL) {
session->auth_methods |= SSH_AUTH_METHOD_PASSWORD; session->auth_methods |= SSH_AUTH_METHOD_PASSWORD;
} }
@@ -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,
@@ -1045,15 +1050,14 @@ int ssh_userauth_publickey_auto(ssh_session session,
ssh_key_free(state->privkey); ssh_key_free(state->privkey);
ssh_key_free(state->pubkey); ssh_key_free(state->pubkey);
SAFE_FREE(session->auth_auto_state); SAFE_FREE(session->auth_auto_state);
if (rc == SSH_AUTH_SUCCESS) {
SSH_LOG(SSH_LOG_INFO,
"Successfully authenticated using %s",
privkey_file);
}
return rc;
} }
if (rc == SSH_AUTH_ERROR) { if (rc == SSH_AUTH_AGAIN){
return rc;
} else if (rc == SSH_AUTH_SUCCESS) {
SSH_LOG(SSH_LOG_INFO,
"Successfully authenticated using %s",
privkey_file);
return rc;
} else if (rc == SSH_AUTH_AGAIN){
return rc; return rc;
} }

View File

@@ -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
} }

View File

@@ -664,11 +664,9 @@ SSH_PACKET_CALLBACK(channel_rcv_request) {
} }
if (strcmp(request,"exit-status") == 0) { if (strcmp(request,"exit-status") == 0) {
uint32_t exit_status = 0; SAFE_FREE(request);
rc = ssh_buffer_unpack(packet, "d", &channel->exit_status);
SAFE_FREE(request); SSH_LOG(SSH_LOG_PACKET, "received exit-status %d", channel->exit_status);
rc = ssh_buffer_unpack(packet, "d", &exit_status);
SSH_LOG(SSH_LOG_PACKET, "received exit-status %d", channel->exit_status);
if(ssh_callbacks_exists(channel->callbacks, channel_exit_status_function)) { if(ssh_callbacks_exists(channel->callbacks, channel_exit_status_function)) {
channel->callbacks->channel_exit_status_function(channel->session, channel->callbacks->channel_exit_status_function(channel->session,
@@ -714,7 +712,7 @@ SSH_PACKET_CALLBACK(channel_rcv_request) {
SAFE_FREE(request); SAFE_FREE(request);
rc = ssh_buffer_unpack(packet, "sbs", rc = ssh_buffer_unpack(packet, "sbss",
&sig, /* signal name */ &sig, /* signal name */
&core_dumped, /* core dumped */ &core_dumped, /* core dumped */
&errmsg, /* error message */ &errmsg, /* error message */
@@ -2205,6 +2203,11 @@ error:
return rc; return rc;
} }
/* DEPRECATED */
int ssh_forward_listen(ssh_session session, const char *address, int port, int *bound_port) {
return ssh_channel_listen_forward(session, address, port, bound_port);
}
/* DEPRECATED */ /* DEPRECATED */
ssh_channel ssh_forward_accept(ssh_session session, int timeout_ms) { ssh_channel ssh_forward_accept(ssh_session session, int timeout_ms) {
return ssh_channel_accept(session, SSH_CHANNEL_FORWARDED_TCPIP, timeout_ms, NULL); return ssh_channel_accept(session, SSH_CHANNEL_FORWARDED_TCPIP, timeout_ms, NULL);
@@ -2272,6 +2275,7 @@ error:
return rc; return rc;
} }
/* DEPRECATED */
int ssh_forward_cancel(ssh_session session, const char *address, int port) { int ssh_forward_cancel(ssh_session session, const char *address, int port) {
return ssh_channel_cancel_forward(session, address, port); return ssh_channel_cancel_forward(session, address, port);
} }

View File

@@ -42,24 +42,28 @@
# define AES "aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc," # define AES "aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,"
# define DES "3des-cbc" # define DES "3des-cbc"
# define DES_SUPPORTED "3des-cbc,des-cbc-ssh1" # define DES_SUPPORTED "3des-cbc,des-cbc-ssh1"
#elif defined(HAVE_LIBCRYPTO) #elif defined(HAVE_LIBCRYPTO)
# ifdef HAVE_OPENSSL_BLOWFISH_H # ifdef HAVE_OPENSSL_BLOWFISH_H
# define BLOWFISH "blowfish-cbc," # define BLOWFISH "blowfish-cbc,"
# else # else /* HAVE_OPENSSL_BLOWFISH_H */
# define BLOWFISH "" # define BLOWFISH ""
# endif # endif /* HAVE_OPENSSL_BLOWFISH_H */
# ifdef HAVE_OPENSSL_AES_H # ifdef HAVE_OPENSSL_AES_H
# ifdef BROKEN_AES_CTR # ifdef BROKEN_AES_CTR
# define AES "aes256-cbc,aes192-cbc,aes128-cbc," # define AES "aes256-cbc,aes192-cbc,aes128-cbc,"
# else # else /* BROKEN_AES_CTR */
# define AES "aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc," # define AES "aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,"
# endif /* BROKEN_AES_CTR */ # endif /* BROKEN_AES_CTR */
# else # else /* HAVE_OPENSSL_AES_H */
# define AES "" # define AES ""
# endif # endif /* HAVE_OPENSSL_AES_H */
# define DES "3des-cbc" # define DES "3des-cbc"
# define DES_SUPPORTED "3des-cbc,des-cbc-ssh1" # define DES_SUPPORTED "3des-cbc,des-cbc-ssh1"
#endif #endif /* HAVE_LIBCRYPTO */
#ifdef WITH_ZLIB #ifdef WITH_ZLIB
#define ZLIB "none,zlib,zlib@openssh.com" #define ZLIB "none,zlib,zlib@openssh.com"
@@ -90,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",
"", "",
@@ -105,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,
"", "",

View File

@@ -33,9 +33,10 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#ifndef HAVE_CLOCK_GETTIME #ifdef HAVE_SYS_TIME_H
#include <sys/time.h> #include <sys/time.h>
#endif /* HAVE_CLOCK_GETTIME */ #endif /* HAVE_SYS_TIME_H */
#endif /* _WIN32 */ #endif /* _WIN32 */
#include <limits.h> #include <limits.h>

View File

@@ -93,12 +93,6 @@ int ssh_options_copy(ssh_session src, ssh_session *dest) {
if (src->opts.identity) { if (src->opts.identity) {
struct ssh_iterator *it; struct ssh_iterator *it;
new->opts.identity = ssh_list_new();
if (new->opts.identity == NULL) {
ssh_free(new);
return -1;
}
it = ssh_list_get_iterator(src->opts.identity); it = ssh_list_get_iterator(src->opts.identity);
while (it) { while (it) {
char *id; char *id;

View File

@@ -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;
} }
/** /**

View File

@@ -35,8 +35,8 @@ int pki_key_generate_ed25519(ssh_key key)
goto error; goto error;
} }
key->ed25519_pubkey = malloc(sizeof (ed25519_privkey)); key->ed25519_pubkey = malloc(sizeof (ed25519_pubkey));
if (key->ed25519_privkey == NULL) { if (key->ed25519_pubkey == NULL) {
goto error; goto error;
} }

View File

@@ -116,7 +116,11 @@ static poll_fn ssh_poll_emu;
#else /* _WIN32 */ #else /* _WIN32 */
#include <sys/select.h> #include <sys/select.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/time.h>
# ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
# endif
#endif /* _WIN32 */ #endif /* _WIN32 */
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H

View File

@@ -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;
} }

View File

@@ -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!");

View File

@@ -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})

View File

@@ -1,4 +1,4 @@
project(tests C) project(libssh-tests C)
if (BSD OR SOLARIS OR OSX) if (BSD OR SOLARIS OR OSX)
find_package(Argp) find_package(Argp)
@@ -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)

View File

@@ -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}

View File

@@ -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)

View File

@@ -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);