[libssh] bug fix in channel_open()

This commit is contained in:
Nicolas Viennot 2013-06-10 03:39:13 -04:00
parent 8131143fa8
commit 7cdb1e2016
2 changed files with 4 additions and 2 deletions

View File

@ -314,7 +314,7 @@ static int channel_open(ssh_channel channel, const char *type_c, int window,
pending: pending:
/* wait until channel is opened by server */ /* wait until channel is opened by server */
err = ssh_handle_packets_termination(session, SSH_TIMEOUT_USER, ssh_channel_open_termination, channel); err = ssh_handle_packets_termination(session, SSH_TIMEOUT_USER, ssh_channel_open_termination, channel);
if (err != SSH_OK || session->session_state == SSH_SESSION_STATE_ERROR) if (session->session_state == SSH_SESSION_STATE_ERROR)
err = SSH_ERROR; err = SSH_ERROR;
end: end:
if(channel->state == SSH_CHANNEL_STATE_OPEN) if(channel->state == SSH_CHANNEL_STATE_OPEN)

View File

@ -537,8 +537,10 @@ int ssh_handle_packets_termination(ssh_session session, int timeout,
ret = ssh_handle_packets(session, tm); ret = ssh_handle_packets(session, tm);
if(ret == SSH_ERROR) if(ret == SSH_ERROR)
break; break;
if(ssh_timeout_elapsed(&ts,timeout)) if(ssh_timeout_elapsed(&ts,timeout)) {
ret = fct(user) ? SSH_OK : SSH_AGAIN;
break; break;
}
tm = ssh_timeout_update(&ts, timeout); tm = ssh_timeout_update(&ts, timeout);
} }
return ret; return ret;