mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 18:50:28 +09:00
Compare commits
12 Commits
release-0-
...
release-0-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4362d76416 | ||
|
|
da3b2d68a3 | ||
|
|
4638b353d5 | ||
|
|
a9f3a2f103 | ||
|
|
59f0293576 | ||
|
|
7a314d9149 | ||
|
|
a13c9d4182 | ||
|
|
93f79c62ef | ||
|
|
31fdb4ecf6 | ||
|
|
0b564c358f | ||
|
|
fb24e68edd | ||
|
|
b5f095d0b4 |
@@ -8,7 +8,7 @@ set(APPLICATION_NAME ${PROJECT_NAME})
|
|||||||
|
|
||||||
set(APPLICATION_VERSION_MAJOR "0")
|
set(APPLICATION_VERSION_MAJOR "0")
|
||||||
set(APPLICATION_VERSION_MINOR "4")
|
set(APPLICATION_VERSION_MINOR "4")
|
||||||
set(APPLICATION_VERSION_PATCH "6")
|
set(APPLICATION_VERSION_PATCH "7")
|
||||||
|
|
||||||
set(APPLICATION_VERSION "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}")
|
set(APPLICATION_VERSION "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}")
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ set(APPLICATION_VERSION "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINO
|
|||||||
# Increment AGE. Set REVISION to 0
|
# Increment AGE. Set REVISION to 0
|
||||||
# If the source code was changed, but there were no interface changes:
|
# If the source code was changed, but there were no interface changes:
|
||||||
# Increment REVISION.
|
# Increment REVISION.
|
||||||
set(LIBRARY_VERSION "4.1.3")
|
set(LIBRARY_VERSION "4.1.4")
|
||||||
set(LIBRARY_SOVERSION "4")
|
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
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
|
|||||||
### versions
|
### versions
|
||||||
set(CPACK_PACKAGE_VERSION_MAJOR "0")
|
set(CPACK_PACKAGE_VERSION_MAJOR "0")
|
||||||
set(CPACK_PACKAGE_VERSION_MINOR "4")
|
set(CPACK_PACKAGE_VERSION_MINOR "4")
|
||||||
set(CPACK_PACKAGE_VERSION_PATCH "6")
|
set(CPACK_PACKAGE_VERSION_PATCH "7")
|
||||||
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
|
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
11
ChangeLog
11
ChangeLog
@@ -1,6 +1,17 @@
|
|||||||
ChangeLog
|
ChangeLog
|
||||||
==========
|
==========
|
||||||
|
|
||||||
|
version 0.4.7 (released 2010-12-28)
|
||||||
|
* Fixed a possible memory leak in ssh_get_user_home().
|
||||||
|
* Fixed a memory leak in sftp_xstat.
|
||||||
|
* Fixed uninitialized fd->revents member.
|
||||||
|
* Fixed timout value in ssh_channel_accept().
|
||||||
|
* Fixed length checks in ssh_analyze_banner().
|
||||||
|
* Fixed a possible data overread and crash bug.
|
||||||
|
* Fixed setting max_fd which breaks ssh_select().
|
||||||
|
* Fixed some pedantic build warnings.
|
||||||
|
* Fixed a memory leak with session->bindaddr.
|
||||||
|
|
||||||
version 0.4.6 (released 2010-09-03)
|
version 0.4.6 (released 2010-09-03)
|
||||||
* Added a cleanup function to free the ws2_32 library.
|
* Added a cleanup function to free the ws2_32 library.
|
||||||
* Fixed build with gcc 3.4.
|
* Fixed build with gcc 3.4.
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ enum ssh_requests_e {
|
|||||||
SSH_REQUEST_CHANNEL_OPEN,
|
SSH_REQUEST_CHANNEL_OPEN,
|
||||||
SSH_REQUEST_CHANNEL,
|
SSH_REQUEST_CHANNEL,
|
||||||
SSH_REQUEST_SERVICE,
|
SSH_REQUEST_SERVICE,
|
||||||
SSH_REQUEST_GLOBAL,
|
SSH_REQUEST_GLOBAL
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ssh_channel_type_e {
|
enum ssh_channel_type_e {
|
||||||
@@ -189,7 +189,7 @@ enum ssh_channel_requests_e {
|
|||||||
SSH_CHANNEL_REQUEST_SHELL,
|
SSH_CHANNEL_REQUEST_SHELL,
|
||||||
SSH_CHANNEL_REQUEST_ENV,
|
SSH_CHANNEL_REQUEST_ENV,
|
||||||
SSH_CHANNEL_REQUEST_SUBSYSTEM,
|
SSH_CHANNEL_REQUEST_SUBSYSTEM,
|
||||||
SSH_CHANNEL_REQUEST_WINDOW_CHANGE,
|
SSH_CHANNEL_REQUEST_WINDOW_CHANGE
|
||||||
};
|
};
|
||||||
|
|
||||||
/* status flags */
|
/* status flags */
|
||||||
@@ -203,7 +203,7 @@ enum ssh_server_known_e {
|
|||||||
SSH_SERVER_KNOWN_OK,
|
SSH_SERVER_KNOWN_OK,
|
||||||
SSH_SERVER_KNOWN_CHANGED,
|
SSH_SERVER_KNOWN_CHANGED,
|
||||||
SSH_SERVER_FOUND_OTHER,
|
SSH_SERVER_FOUND_OTHER,
|
||||||
SSH_SERVER_FILE_NOT_FOUND,
|
SSH_SERVER_FILE_NOT_FOUND
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef MD5_DIGEST_LEN
|
#ifndef MD5_DIGEST_LEN
|
||||||
|
|||||||
@@ -1392,11 +1392,13 @@ static ssh_channel channel_accept(ssh_session session, int channeltype,
|
|||||||
iterator = iterator->next;
|
iterator = iterator->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(t>0){
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
Sleep(50); /* 50ms */
|
Sleep(50); /* 50ms */
|
||||||
#else
|
#else
|
||||||
nanosleep(&ts, NULL);
|
nanosleep(&ts, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -110,26 +110,37 @@ static int ssh_analyze_banner(ssh_session session, int *ssh1, int *ssh2) {
|
|||||||
const char *banner = session->serverbanner;
|
const char *banner = session->serverbanner;
|
||||||
const char *openssh;
|
const char *openssh;
|
||||||
|
|
||||||
ssh_log(session, SSH_LOG_RARE, "Analyzing banner: %s", banner);
|
if (banner == NULL) {
|
||||||
|
ssh_set_error(session, SSH_FATAL, "Invalid banner");
|
||||||
if (strncmp(banner, "SSH-", 4) != 0) {
|
return -1;
|
||||||
ssh_set_error(session, SSH_FATAL, "Protocol mismatch: %s", banner);
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Typical banners e.g. are:
|
* Typical banners e.g. are:
|
||||||
* SSH-1.5-blah
|
*
|
||||||
* SSH-1.99-blah
|
* SSH-1.5-openSSH_5.4
|
||||||
* SSH-2.0-blah
|
* SSH-1.99-openSSH_3.0
|
||||||
|
*
|
||||||
|
* SSH-2.0-something
|
||||||
|
* 012345678901234567890
|
||||||
*/
|
*/
|
||||||
|
if (strlen(banner) < 6 ||
|
||||||
|
strncmp(banner, "SSH-", 4) != 0) {
|
||||||
|
ssh_set_error(session, SSH_FATAL, "Protocol mismatch: %s", banner);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ssh_log(session, SSH_LOG_RARE, "Analyzing banner: %s", banner);
|
||||||
|
|
||||||
switch(banner[4]) {
|
switch(banner[4]) {
|
||||||
case '1':
|
case '1':
|
||||||
*ssh1 = 1;
|
*ssh1 = 1;
|
||||||
if (banner[6] == '9') {
|
if (strlen(banner) > 6) {
|
||||||
*ssh2 = 1;
|
if (banner[6] == '9') {
|
||||||
} else {
|
*ssh2 = 1;
|
||||||
*ssh2 = 0;
|
} else {
|
||||||
|
*ssh2 = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '2':
|
case '2':
|
||||||
@@ -143,13 +154,21 @@ static int ssh_analyze_banner(ssh_session session, int *ssh1, int *ssh2) {
|
|||||||
|
|
||||||
openssh = strstr(banner, "OpenSSH");
|
openssh = strstr(banner, "OpenSSH");
|
||||||
if (openssh != NULL) {
|
if (openssh != NULL) {
|
||||||
int major, minor;
|
int major, minor;
|
||||||
major = strtol(openssh + 8, (char **) NULL, 10);
|
|
||||||
minor = strtol(openssh + 10, (char **) NULL, 10);
|
/*
|
||||||
session->openssh = SSH_VERSION_INT(major, minor, 0);
|
* The banner is typical:
|
||||||
ssh_log(session, SSH_LOG_RARE,
|
* OpenSSH_5.4
|
||||||
"We are talking to an OpenSSH server version: %d.%d (%x)",
|
* 012345678901234567890
|
||||||
major, minor, session->openssh);
|
*/
|
||||||
|
if (strlen(openssh) > 9) {
|
||||||
|
major = strtol(openssh + 8, (char **) NULL, 10);
|
||||||
|
minor = strtol(openssh + 10, (char **) NULL, 10);
|
||||||
|
session->openssh = SSH_VERSION_INT(major, minor, 0);
|
||||||
|
ssh_log(session, SSH_LOG_RARE,
|
||||||
|
"We are talking to an OpenSSH client version: %d.%d (%x)",
|
||||||
|
major, minor, session->openssh);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -504,7 +504,7 @@ int ssh_mkdir(const char *pathname, mode_t mode) {
|
|||||||
* @return The expanded directory, NULL on error.
|
* @return The expanded directory, NULL on error.
|
||||||
*/
|
*/
|
||||||
char *ssh_path_expand_tilde(const char *d) {
|
char *ssh_path_expand_tilde(const char *d) {
|
||||||
char *h, *r;
|
char *h = NULL, *r;
|
||||||
const char *p;
|
const char *p;
|
||||||
size_t ld;
|
size_t ld;
|
||||||
size_t lh = 0;
|
size_t lh = 0;
|
||||||
@@ -548,12 +548,14 @@ char *ssh_path_expand_tilde(const char *d) {
|
|||||||
|
|
||||||
r = malloc(ld + lh + 1);
|
r = malloc(ld + lh + 1);
|
||||||
if (r == NULL) {
|
if (r == NULL) {
|
||||||
|
SAFE_FREE(h);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lh > 0) {
|
if (lh > 0) {
|
||||||
memcpy(r, h, lh);
|
memcpy(r, h, lh);
|
||||||
}
|
}
|
||||||
|
SAFE_FREE(h);
|
||||||
memcpy(r + lh, p, ld + 1);
|
memcpy(r + lh, p, ld + 1);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
|
|||||||
@@ -246,6 +246,7 @@ int ssh_bind_accept(ssh_bind sshbind, ssh_session session) {
|
|||||||
if (sshbind->bindaddr == NULL)
|
if (sshbind->bindaddr == NULL)
|
||||||
session->bindaddr = NULL;
|
session->bindaddr = NULL;
|
||||||
else {
|
else {
|
||||||
|
SAFE_FREE(session->bindaddr);
|
||||||
session->bindaddr = strdup(sshbind->bindaddr);
|
session->bindaddr = strdup(sshbind->bindaddr);
|
||||||
if (session->bindaddr == NULL) {
|
if (session->bindaddr == NULL) {
|
||||||
privatekey_free(dsa);
|
privatekey_free(dsa);
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ void ssh_free(ssh_session session) {
|
|||||||
|
|
||||||
SAFE_FREE(session->serverbanner);
|
SAFE_FREE(session->serverbanner);
|
||||||
SAFE_FREE(session->clientbanner);
|
SAFE_FREE(session->clientbanner);
|
||||||
|
SAFE_FREE(session->bindaddr);
|
||||||
SAFE_FREE(session->banner);
|
SAFE_FREE(session->banner);
|
||||||
#ifdef WITH_PCAP
|
#ifdef WITH_PCAP
|
||||||
if(session->pcap_ctx){
|
if(session->pcap_ctx){
|
||||||
|
|||||||
@@ -3123,7 +3123,10 @@ static sftp_attributes sftp_xstat(sftp_session sftp, const char *path,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (msg->packet_type == SSH_FXP_ATTRS) {
|
if (msg->packet_type == SSH_FXP_ATTRS) {
|
||||||
return sftp_parse_attr(sftp, msg->payload, 0);
|
sftp_attributes attr = sftp_parse_attr(sftp, msg->payload, 0);
|
||||||
|
sftp_message_free(msg);
|
||||||
|
|
||||||
|
return attr;
|
||||||
} else if (msg->packet_type == SSH_FXP_STATUS) {
|
} else if (msg->packet_type == SSH_FXP_STATUS) {
|
||||||
status = parse_status_msg(msg);
|
status = parse_status_msg(msg);
|
||||||
sftp_message_free(msg);
|
sftp_message_free(msg);
|
||||||
|
|||||||
@@ -265,7 +265,10 @@ void ssh_socket_fd_set(struct socket *s, fd_set *set, socket_t *max_fd) {
|
|||||||
if (s->fd == SSH_INVALID_SOCKET)
|
if (s->fd == SSH_INVALID_SOCKET)
|
||||||
return;
|
return;
|
||||||
FD_SET(s->fd,set);
|
FD_SET(s->fd,set);
|
||||||
if (s->fd >= 0 && s->fd != SSH_INVALID_SOCKET) {
|
|
||||||
|
if (s->fd >= 0 &&
|
||||||
|
s->fd >= *max_fd &&
|
||||||
|
s->fd != SSH_INVALID_SOCKET) {
|
||||||
*max_fd = s->fd + 1;
|
*max_fd = s->fd + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -489,6 +492,7 @@ int ssh_socket_poll(struct socket *s, int *writeable, int *except) {
|
|||||||
|
|
||||||
fd->fd = s->fd;
|
fd->fd = s->fd;
|
||||||
fd->events = 0;
|
fd->events = 0;
|
||||||
|
fd->revents = 0;
|
||||||
|
|
||||||
if (!s->data_to_read) {
|
if (!s->data_to_read) {
|
||||||
fd->events |= POLLIN;
|
fd->events |= POLLIN;
|
||||||
|
|||||||
Reference in New Issue
Block a user