Report according status when errors are detected
Этот коммит содержится в:
родитель
ce33633bcb
Коммит
de096910b3
@ -1270,7 +1270,10 @@ int channel_write_common(ssh_channel channel, const void *data,
|
||||
leave_function();
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (channel->session->session_state == SSH_SESSION_STATE_ERROR){
|
||||
leave_function();
|
||||
return SSH_ERROR;
|
||||
}
|
||||
#ifdef WITH_SSH1
|
||||
if (channel->version == 1) {
|
||||
rc = channel_write1(channel, data, len);
|
||||
@ -2690,6 +2693,10 @@ int ssh_channel_read(ssh_channel channel, void *dest, uint32_t count, int is_std
|
||||
leave_function();
|
||||
return rc;
|
||||
}
|
||||
if (channel->session->session_state == SSH_SESSION_STATE_ERROR){
|
||||
leave_function();
|
||||
return SSH_ERROR;
|
||||
}
|
||||
if (channel->remote_eof && buffer_get_rest_len(stdbuf) == 0) {
|
||||
leave_function();
|
||||
return 0;
|
||||
@ -2753,6 +2760,10 @@ int ssh_channel_read_nonblocking(ssh_channel channel, void *dest, uint32_t count
|
||||
to_read = ssh_channel_poll(channel, is_stderr);
|
||||
|
||||
if (to_read <= 0) {
|
||||
if (channel->session->session_state == SSH_SESSION_STATE_ERROR){
|
||||
leave_function();
|
||||
return SSH_ERROR;
|
||||
}
|
||||
leave_function();
|
||||
return to_read; /* may be an error code */
|
||||
}
|
||||
@ -2799,6 +2810,10 @@ int ssh_channel_poll(ssh_channel channel, int is_stderr){
|
||||
}
|
||||
|
||||
if (buffer_get_rest_len(stdbuf) == 0 && channel->remote_eof == 0) {
|
||||
if (channel->session->session_state == SSH_SESSION_STATE_ERROR){
|
||||
leave_function();
|
||||
return SSH_ERROR;
|
||||
}
|
||||
if (ssh_handle_packets(channel->session, SSH_TIMEOUT_NONBLOCKING)==SSH_ERROR) {
|
||||
leave_function();
|
||||
return SSH_ERROR;
|
||||
|
@ -5,6 +5,7 @@ add_cmocka_test(torture_auth torture_auth.c ${TORTURE_LIBRARY})
|
||||
add_cmocka_test(torture_connect torture_connect.c ${TORTURE_LIBRARY})
|
||||
add_cmocka_test(torture_knownhosts torture_knownhosts.c ${TORTURE_LIBRARY})
|
||||
add_cmocka_test(torture_proxycommand torture_proxycommand.c ${TORTURE_LIBRARY})
|
||||
add_cmocka_test(torture_session torture_session.c ${TORTURE_LIBRARY})
|
||||
if (WITH_SFTP)
|
||||
add_cmocka_test(torture_sftp_static torture_sftp_static.c ${TORTURE_LIBRARY})
|
||||
add_cmocka_test(torture_sftp_dir torture_sftp_dir.c ${TORTURE_LIBRARY})
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user