mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-04 12:20:42 +09:00
Compare commits
16 Commits
08cbbea461
...
libssh-0.7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
053f72c671 | ||
|
|
63a8f333b8 | ||
|
|
57fd8e3187 | ||
|
|
03972b16c9 | ||
|
|
ac7ed82585 | ||
|
|
196c2e9c1f | ||
|
|
1accbcb98b | ||
|
|
342ae10f08 | ||
|
|
eb98a780ed | ||
|
|
64233fa3bb | ||
|
|
cbf5cf4ac3 | ||
|
|
a3f3f9cb76 | ||
|
|
5aeae08be0 | ||
|
|
64a658acaa | ||
|
|
361940a5d7 | ||
|
|
2721cbc8ee |
@@ -8,7 +8,7 @@ set(APPLICATION_NAME ${PROJECT_NAME})
|
||||
|
||||
set(APPLICATION_VERSION_MAJOR "0")
|
||||
set(APPLICATION_VERSION_MINOR "7")
|
||||
set(APPLICATION_VERSION_PATCH "0")
|
||||
set(APPLICATION_VERSION_PATCH "1")
|
||||
|
||||
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
|
||||
set(CMAKE_MODULE_PATH
|
||||
${CMAKE_SOURCE_DIR}/cmake/Modules
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules
|
||||
)
|
||||
|
||||
# add definitions
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
### general settings
|
||||
set(CPACK_PACKAGE_NAME ${APPLICATION_NAME})
|
||||
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_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
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
ChangeLog
|
||||
==========
|
||||
|
||||
version 0.7.0 (released 2015-05-xx)
|
||||
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 SHA2 algorithms for HMAC
|
||||
* Added improved and more secure buffer handling code
|
||||
|
||||
@@ -56,7 +56,7 @@ If an error has been encountered, it returns a negative value:
|
||||
|
||||
@code
|
||||
char buffer[256];
|
||||
unsigned int nbytes;
|
||||
int nbytes;
|
||||
|
||||
nbytes = ssh_channel_read(channel, buffer, sizeof(buffer), 0);
|
||||
while (nbytes > 0)
|
||||
|
||||
@@ -367,7 +367,7 @@ int show_remote_processes(ssh_session session)
|
||||
ssh_channel channel;
|
||||
int rc;
|
||||
char buffer[256];
|
||||
unsigned int nbytes;
|
||||
int nbytes;
|
||||
|
||||
channel = ssh_channel_new(session);
|
||||
if (channel == NULL)
|
||||
@@ -391,7 +391,7 @@ int show_remote_processes(ssh_session session)
|
||||
nbytes = ssh_channel_read(channel, buffer, sizeof(buffer), 0);
|
||||
while (nbytes > 0)
|
||||
{
|
||||
if (write(1, buffer, nbytes) != nbytes)
|
||||
if (write(1, buffer, nbytes) != (unsigned int) nbytes)
|
||||
{
|
||||
ssh_channel_close(channel);
|
||||
ssh_channel_free(channel);
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
project(headers C)
|
||||
project(libssh-headers-x C)
|
||||
|
||||
add_subdirectory(libssh)
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
/* libssh version */
|
||||
#define LIBSSH_VERSION_MAJOR 0
|
||||
#define LIBSSH_VERSION_MINOR 7
|
||||
#define LIBSSH_VERSION_MICRO 0
|
||||
#define LIBSSH_VERSION_MICRO 1
|
||||
|
||||
#define LIBSSH_VERSION_INT SSH_VERSION_INT(LIBSSH_VERSION_MAJOR, \
|
||||
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);
|
||||
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_socket(ssh_session session, socket_t fd);
|
||||
LIBSSH_API void ssh_set_blocking(ssh_session session, int blocking);
|
||||
LIBSSH_API void ssh_set_counters(ssh_session session, ssh_counter scounter,
|
||||
ssh_counter rcounter);
|
||||
|
||||
@@ -65,6 +65,10 @@
|
||||
# undef inline
|
||||
# define inline __inline
|
||||
|
||||
# ifndef va_copy
|
||||
# define va_copy(dest, src) (dest = src)
|
||||
# endif
|
||||
|
||||
# define strcasecmp _stricmp
|
||||
# define strncasecmp _strnicmp
|
||||
# if ! defined(HAVE_ISBLANK)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
project(libssh-library C)
|
||||
|
||||
set(LIBSSH_PUBLIC_INCLUDE_DIRS
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
${libssh_SOURCE_DIR}/include
|
||||
CACHE INTERNAL "libssh public include directories"
|
||||
)
|
||||
|
||||
set(LIBSSH_PRIVATE_INCLUDE_DIRS
|
||||
${CMAKE_BINARY_DIR}
|
||||
${libssh_BINARY_DIR}
|
||||
)
|
||||
|
||||
set(LIBSSH_LINK_LIBRARIES
|
||||
|
||||
23
src/agent.c
23
src/agent.c
@@ -185,15 +185,32 @@ int ssh_set_agent_channel(ssh_session session, ssh_channel channel){
|
||||
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) {
|
||||
if (agent == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (getenv("SSH_AUTH_SOCK")) {
|
||||
ssh_socket_close(agent->sock);
|
||||
}
|
||||
ssh_socket_close(agent->sock);
|
||||
}
|
||||
|
||||
void agent_free(ssh_agent agent) {
|
||||
|
||||
17
src/auth.c
Normal file → Executable file
17
src/auth.c
Normal file → Executable file
@@ -209,8 +209,8 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_failure){
|
||||
"Access denied. Authentication that can continue: %s",
|
||||
auth_methods);
|
||||
|
||||
session->auth_methods = 0;
|
||||
}
|
||||
session->auth_methods = 0;
|
||||
if (strstr(auth_methods, "password") != NULL) {
|
||||
session->auth_methods |= SSH_AUTH_METHOD_PASSWORD;
|
||||
}
|
||||
@@ -1045,15 +1045,14 @@ int ssh_userauth_publickey_auto(ssh_session session,
|
||||
ssh_key_free(state->privkey);
|
||||
ssh_key_free(state->pubkey);
|
||||
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) {
|
||||
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){
|
||||
if (rc == SSH_AUTH_AGAIN){
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -664,11 +664,9 @@ SSH_PACKET_CALLBACK(channel_rcv_request) {
|
||||
}
|
||||
|
||||
if (strcmp(request,"exit-status") == 0) {
|
||||
uint32_t exit_status = 0;
|
||||
|
||||
SAFE_FREE(request);
|
||||
rc = ssh_buffer_unpack(packet, "d", &exit_status);
|
||||
SSH_LOG(SSH_LOG_PACKET, "received exit-status %d", channel->exit_status);
|
||||
SAFE_FREE(request);
|
||||
rc = ssh_buffer_unpack(packet, "d", &channel->exit_status);
|
||||
SSH_LOG(SSH_LOG_PACKET, "received exit-status %d", channel->exit_status);
|
||||
|
||||
if(ssh_callbacks_exists(channel->callbacks, channel_exit_status_function)) {
|
||||
channel->callbacks->channel_exit_status_function(channel->session,
|
||||
@@ -714,7 +712,7 @@ SSH_PACKET_CALLBACK(channel_rcv_request) {
|
||||
|
||||
SAFE_FREE(request);
|
||||
|
||||
rc = ssh_buffer_unpack(packet, "sbs",
|
||||
rc = ssh_buffer_unpack(packet, "sbss",
|
||||
&sig, /* signal name */
|
||||
&core_dumped, /* core dumped */
|
||||
&errmsg, /* error message */
|
||||
@@ -2205,6 +2203,11 @@ error:
|
||||
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 */
|
||||
ssh_channel ssh_forward_accept(ssh_session session, int timeout_ms) {
|
||||
return ssh_channel_accept(session, SSH_CHANNEL_FORWARDED_TCPIP, timeout_ms, NULL);
|
||||
@@ -2272,6 +2275,7 @@ error:
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* DEPRECATED */
|
||||
int ssh_forward_cancel(ssh_session session, const char *address, int port) {
|
||||
return ssh_channel_cancel_forward(session, address, port);
|
||||
}
|
||||
|
||||
16
src/kex.c
16
src/kex.c
@@ -42,24 +42,28 @@
|
||||
# define AES "aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,"
|
||||
# define DES "3des-cbc"
|
||||
# define DES_SUPPORTED "3des-cbc,des-cbc-ssh1"
|
||||
|
||||
#elif defined(HAVE_LIBCRYPTO)
|
||||
|
||||
# ifdef HAVE_OPENSSL_BLOWFISH_H
|
||||
# define BLOWFISH "blowfish-cbc,"
|
||||
# else
|
||||
# else /* HAVE_OPENSSL_BLOWFISH_H */
|
||||
# define BLOWFISH ""
|
||||
# endif
|
||||
# endif /* HAVE_OPENSSL_BLOWFISH_H */
|
||||
|
||||
# ifdef HAVE_OPENSSL_AES_H
|
||||
# ifdef BROKEN_AES_CTR
|
||||
# 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,"
|
||||
# endif /* BROKEN_AES_CTR */
|
||||
# else
|
||||
# else /* HAVE_OPENSSL_AES_H */
|
||||
# define AES ""
|
||||
# endif
|
||||
# endif /* HAVE_OPENSSL_AES_H */
|
||||
|
||||
# define DES "3des-cbc"
|
||||
# define DES_SUPPORTED "3des-cbc,des-cbc-ssh1"
|
||||
#endif
|
||||
#endif /* HAVE_LIBCRYPTO */
|
||||
|
||||
#ifdef WITH_ZLIB
|
||||
#define ZLIB "none,zlib,zlib@openssh.com"
|
||||
|
||||
@@ -33,9 +33,10 @@
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#ifndef HAVE_CLOCK_GETTIME
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif /* HAVE_CLOCK_GETTIME */
|
||||
#endif /* HAVE_SYS_TIME_H */
|
||||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
@@ -93,12 +93,6 @@ int ssh_options_copy(ssh_session src, ssh_session *dest) {
|
||||
if (src->opts.identity) {
|
||||
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);
|
||||
while (it) {
|
||||
char *id;
|
||||
|
||||
@@ -35,8 +35,8 @@ int pki_key_generate_ed25519(ssh_key key)
|
||||
goto error;
|
||||
}
|
||||
|
||||
key->ed25519_pubkey = malloc(sizeof (ed25519_privkey));
|
||||
if (key->ed25519_privkey == NULL) {
|
||||
key->ed25519_pubkey = malloc(sizeof (ed25519_pubkey));
|
||||
if (key->ed25519_pubkey == NULL) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
||||
@@ -116,7 +116,11 @@ static poll_fn ssh_poll_emu;
|
||||
#else /* _WIN32 */
|
||||
#include <sys/select.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
# ifdef HAVE_SYS_TIME_H
|
||||
# include <sys/time.h>
|
||||
# endif
|
||||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
project(tests C)
|
||||
project(libssh-tests C)
|
||||
|
||||
if (BSD OR SOLARIS OR OSX)
|
||||
find_package(Argp)
|
||||
|
||||
Reference in New Issue
Block a user