mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-05 04:40:31 +09:00
Compare commits
4 Commits
libssh-0.5
...
libssh-0.5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
05d8421290 | ||
|
|
55b09f4264 | ||
|
|
f128338132 | ||
|
|
ba231d0844 |
@@ -8,7 +8,7 @@ set(APPLICATION_NAME ${PROJECT_NAME})
|
|||||||
|
|
||||||
set(APPLICATION_VERSION_MAJOR "0")
|
set(APPLICATION_VERSION_MAJOR "0")
|
||||||
set(APPLICATION_VERSION_MINOR "5")
|
set(APPLICATION_VERSION_MINOR "5")
|
||||||
set(APPLICATION_VERSION_PATCH "3")
|
set(APPLICATION_VERSION_PATCH "4")
|
||||||
|
|
||||||
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.2.3")
|
set(LIBRARY_VERSION "4.2.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 "5")
|
set(CPACK_PACKAGE_VERSION_MINOR "5")
|
||||||
set(CPACK_PACKAGE_VERSION_PATCH "3")
|
set(CPACK_PACKAGE_VERSION_PATCH "4")
|
||||||
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}")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
ChangeLog
|
ChangeLog
|
||||||
==========
|
==========
|
||||||
|
|
||||||
|
version 0.5.4 (released 2013-01-22)
|
||||||
|
* CVE-2013-0176 - NULL dereference leads to denial of service
|
||||||
|
* Fixed several NULL pointer dereferences in SSHv1.
|
||||||
|
* Fixed a free crash bug in options parsing.
|
||||||
|
|
||||||
version 0.5.3 (released 2012-11-20)
|
version 0.5.3 (released 2012-11-20)
|
||||||
* CVE-2012-4559 Fixed multiple double free() flaws.
|
* CVE-2012-4559 Fixed multiple double free() flaws.
|
||||||
* CVE-2012-4560 Fixed multiple buffer overflow flaws.
|
* CVE-2012-4560 Fixed multiple buffer overflow flaws.
|
||||||
|
|||||||
@@ -50,11 +50,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int channel_open_session1(ssh_channel chan) {
|
int channel_open_session1(ssh_channel chan) {
|
||||||
|
ssh_session session;
|
||||||
|
|
||||||
|
if (chan == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
session = chan->session;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We guess we are requesting an *exec* channel. It can only have one exec
|
* We guess we are requesting an *exec* channel. It can only have one exec
|
||||||
* channel. So we abort with an error if we need more than one.
|
* channel. So we abort with an error if we need more than one.
|
||||||
*/
|
*/
|
||||||
ssh_session session = chan->session;
|
|
||||||
if (session->exec_channel_opened) {
|
if (session->exec_channel_opened) {
|
||||||
ssh_set_error(session, SSH_REQUEST_DENIED,
|
ssh_set_error(session, SSH_REQUEST_DENIED,
|
||||||
"SSH1 supports only one execution channel. "
|
"SSH1 supports only one execution channel. "
|
||||||
@@ -85,8 +91,14 @@ int channel_open_session1(ssh_channel chan) {
|
|||||||
|
|
||||||
int channel_request_pty_size1(ssh_channel channel, const char *terminal, int col,
|
int channel_request_pty_size1(ssh_channel channel, const char *terminal, int col,
|
||||||
int row) {
|
int row) {
|
||||||
ssh_session session = channel->session;
|
ssh_session session;
|
||||||
ssh_string str = NULL;
|
ssh_string str = NULL;
|
||||||
|
|
||||||
|
if (channel == NULL) {
|
||||||
|
return SSH_ERROR;
|
||||||
|
}
|
||||||
|
session = channel->session;
|
||||||
|
|
||||||
if(channel->request_state != SSH_CHANNEL_REQ_STATE_NONE){
|
if(channel->request_state != SSH_CHANNEL_REQ_STATE_NONE){
|
||||||
ssh_set_error(session,SSH_REQUEST_DENIED,"Wrong request state");
|
ssh_set_error(session,SSH_REQUEST_DENIED,"Wrong request state");
|
||||||
return SSH_ERROR;
|
return SSH_ERROR;
|
||||||
@@ -139,7 +151,13 @@ int channel_request_pty_size1(ssh_channel channel, const char *terminal, int col
|
|||||||
}
|
}
|
||||||
|
|
||||||
int channel_change_pty_size1(ssh_channel channel, int cols, int rows) {
|
int channel_change_pty_size1(ssh_channel channel, int cols, int rows) {
|
||||||
ssh_session session = channel->session;
|
ssh_session session;
|
||||||
|
|
||||||
|
if (channel == NULL) {
|
||||||
|
return SSH_ERROR;
|
||||||
|
}
|
||||||
|
session = channel->session;
|
||||||
|
|
||||||
if(channel->request_state != SSH_CHANNEL_REQ_STATE_NONE){
|
if(channel->request_state != SSH_CHANNEL_REQ_STATE_NONE){
|
||||||
ssh_set_error(session,SSH_REQUEST_DENIED,"Wrong request state");
|
ssh_set_error(session,SSH_REQUEST_DENIED,"Wrong request state");
|
||||||
return SSH_ERROR;
|
return SSH_ERROR;
|
||||||
@@ -182,7 +200,12 @@ int channel_change_pty_size1(ssh_channel channel, int cols, int rows) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int channel_request_shell1(ssh_channel channel) {
|
int channel_request_shell1(ssh_channel channel) {
|
||||||
ssh_session session = channel->session;
|
ssh_session session;
|
||||||
|
|
||||||
|
if (channel == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
session = channel->session;
|
||||||
|
|
||||||
if (buffer_add_u8(session->out_buffer,SSH_CMSG_EXEC_SHELL) < 0) {
|
if (buffer_add_u8(session->out_buffer,SSH_CMSG_EXEC_SHELL) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
@@ -198,9 +221,14 @@ int channel_request_shell1(ssh_channel channel) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int channel_request_exec1(ssh_channel channel, const char *cmd) {
|
int channel_request_exec1(ssh_channel channel, const char *cmd) {
|
||||||
ssh_session session = channel->session;
|
ssh_session session;
|
||||||
ssh_string command = NULL;
|
ssh_string command = NULL;
|
||||||
|
|
||||||
|
if (channel == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
session = channel->session;
|
||||||
|
|
||||||
command = ssh_string_from_char(cmd);
|
command = ssh_string_from_char(cmd);
|
||||||
if (command == NULL) {
|
if (command == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
@@ -227,6 +255,11 @@ SSH_PACKET_CALLBACK(ssh_packet_data1){
|
|||||||
ssh_string str = NULL;
|
ssh_string str = NULL;
|
||||||
int is_stderr=(type==SSH_SMSG_STDOUT_DATA ? 0 : 1);
|
int is_stderr=(type==SSH_SMSG_STDOUT_DATA ? 0 : 1);
|
||||||
(void)user;
|
(void)user;
|
||||||
|
|
||||||
|
if (channel == NULL) {
|
||||||
|
return SSH_PACKET_NOT_USED;
|
||||||
|
}
|
||||||
|
|
||||||
str = buffer_get_ssh_string(packet);
|
str = buffer_get_ssh_string(packet);
|
||||||
if (str == NULL) {
|
if (str == NULL) {
|
||||||
ssh_log(session, SSH_LOG_FUNCTIONS, "Invalid data packet !\n");
|
ssh_log(session, SSH_LOG_FUNCTIONS, "Invalid data packet !\n");
|
||||||
@@ -254,6 +287,10 @@ SSH_PACKET_CALLBACK(ssh_packet_close1){
|
|||||||
(void)type;
|
(void)type;
|
||||||
(void)user;
|
(void)user;
|
||||||
|
|
||||||
|
if (channel == NULL) {
|
||||||
|
return SSH_PACKET_NOT_USED;
|
||||||
|
}
|
||||||
|
|
||||||
buffer_get_u32(packet, &status);
|
buffer_get_u32(packet, &status);
|
||||||
/*
|
/*
|
||||||
* It's much more than a channel closing. spec says it's the last
|
* It's much more than a channel closing. spec says it's the last
|
||||||
@@ -275,6 +312,11 @@ SSH_PACKET_CALLBACK(ssh_packet_exist_status1){
|
|||||||
uint32_t status;
|
uint32_t status;
|
||||||
(void)type;
|
(void)type;
|
||||||
(void)user;
|
(void)user;
|
||||||
|
|
||||||
|
if (channel == NULL) {
|
||||||
|
return SSH_PACKET_NOT_USED;
|
||||||
|
}
|
||||||
|
|
||||||
buffer_get_u32(packet, &status);
|
buffer_get_u32(packet, &status);
|
||||||
channel->state = SSH_CHANNEL_STATE_CLOSED;
|
channel->state = SSH_CHANNEL_STATE_CLOSED;
|
||||||
channel->remote_eof = 1;
|
channel->remote_eof = 1;
|
||||||
@@ -285,10 +327,16 @@ SSH_PACKET_CALLBACK(ssh_packet_exist_status1){
|
|||||||
|
|
||||||
|
|
||||||
int channel_write1(ssh_channel channel, const void *data, int len) {
|
int channel_write1(ssh_channel channel, const void *data, int len) {
|
||||||
ssh_session session = channel->session;
|
ssh_session session;
|
||||||
int origlen = len;
|
int origlen = len;
|
||||||
int effectivelen;
|
int effectivelen;
|
||||||
const unsigned char *ptr=data;
|
const unsigned char *ptr=data;
|
||||||
|
|
||||||
|
if (channel == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
session = channel->session;
|
||||||
|
|
||||||
while (len > 0) {
|
while (len > 0) {
|
||||||
if (buffer_add_u8(session->out_buffer, SSH_CMSG_STDIN_DATA) < 0) {
|
if (buffer_add_u8(session->out_buffer, SSH_CMSG_STDIN_DATA) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
@@ -314,6 +362,11 @@ int channel_write1(ssh_channel channel, const void *data, int len) {
|
|||||||
|
|
||||||
ssh_channel ssh_get_channel1(ssh_session session){
|
ssh_channel ssh_get_channel1(ssh_session session){
|
||||||
struct ssh_iterator *it;
|
struct ssh_iterator *it;
|
||||||
|
|
||||||
|
if (session == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* With SSH1, the channel is always the first one */
|
/* With SSH1, the channel is always the first one */
|
||||||
if(session->channels != NULL){
|
if(session->channels != NULL){
|
||||||
it = ssh_list_get_iterator(session->channels);
|
it = ssh_list_get_iterator(session->channels);
|
||||||
|
|||||||
@@ -720,12 +720,6 @@ int ssh_options_getopt(ssh_session session, int *argcptr, char **argv) {
|
|||||||
int saveoptind = optind; /* need to save 'em */
|
int saveoptind = optind; /* need to save 'em */
|
||||||
int saveopterr = opterr;
|
int saveopterr = opterr;
|
||||||
|
|
||||||
save = malloc(argc * sizeof(char *));
|
|
||||||
if (save == NULL) {
|
|
||||||
ssh_set_error_oom(session);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
opterr = 0; /* shut up getopt */
|
opterr = 0; /* shut up getopt */
|
||||||
while(cont && ((i = getopt(argc, argv, "c:i:Cl:p:vb:rd12")) != -1)) {
|
while(cont && ((i = getopt(argc, argv, "c:i:Cl:p:vb:rd12")) != -1)) {
|
||||||
switch(i) {
|
switch(i) {
|
||||||
@@ -763,8 +757,16 @@ int ssh_options_getopt(ssh_session session, int *argcptr, char **argv) {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
|
char **tmp;
|
||||||
char opt[3]="- ";
|
char opt[3]="- ";
|
||||||
opt[1] = optopt;
|
opt[1] = optopt;
|
||||||
|
tmp = realloc(save, (current + 1) * sizeof(char*));
|
||||||
|
if (tmp == NULL) {
|
||||||
|
SAFE_FREE(save);
|
||||||
|
ssh_set_error_oom(session);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
save = tmp;
|
||||||
save[current] = strdup(opt);
|
save[current] = strdup(opt);
|
||||||
if (save[current] == NULL) {
|
if (save[current] == NULL) {
|
||||||
SAFE_FREE(save);
|
SAFE_FREE(save);
|
||||||
|
|||||||
13
src/server.c
13
src/server.c
@@ -184,7 +184,11 @@ static int dh_handshake_server(ssh_session session) {
|
|||||||
prv = session->rsa_key;
|
prv = session->rsa_key;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
prv = NULL;
|
ssh_set_error(session,
|
||||||
|
SSH_FATAL,
|
||||||
|
"Could determine the specified hostkey");
|
||||||
|
ssh_string_free(f);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub = publickey_from_privatekey(prv);
|
pub = publickey_from_privatekey(prv);
|
||||||
@@ -270,6 +274,8 @@ static int dh_handshake_server(ssh_session session) {
|
|||||||
*/
|
*/
|
||||||
static void ssh_server_connection_callback(ssh_session session){
|
static void ssh_server_connection_callback(ssh_session session){
|
||||||
int ssh1,ssh2;
|
int ssh1,ssh2;
|
||||||
|
int rc;
|
||||||
|
|
||||||
enter_function();
|
enter_function();
|
||||||
switch(session->session_state){
|
switch(session->session_state){
|
||||||
case SSH_SESSION_STATE_NONE:
|
case SSH_SESSION_STATE_NONE:
|
||||||
@@ -338,7 +344,10 @@ static void ssh_server_connection_callback(ssh_session session){
|
|||||||
case SSH_SESSION_STATE_KEXINIT_RECEIVED:
|
case SSH_SESSION_STATE_KEXINIT_RECEIVED:
|
||||||
set_status(session,0.6f);
|
set_status(session,0.6f);
|
||||||
ssh_list_kex(session, &session->client_kex); // log client kex
|
ssh_list_kex(session, &session->client_kex); // log client kex
|
||||||
crypt_set_algorithms_server(session);
|
rc = crypt_set_algorithms_server(session);
|
||||||
|
if (rc == SSH_ERROR) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
if (set_kex(session) < 0) {
|
if (set_kex(session) < 0) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user