1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-30 13:01:23 +03:00

Made ask_userauth nonblocking

This commit is contained in:
Aris Adamantiadis
2011-01-16 18:05:47 +01:00
parent a236a15c6c
commit 624676b1cc

View File

@@ -58,8 +58,8 @@
* @param[in] session The SSH session handle. * @param[in] session The SSH session handle.
* *
* @returns SSH_OK on success, SSH_ERROR on error. * @returns SSH_OK on success, SSH_ERROR on error.
* * @returns SSH_AGAIN on nonblocking mode, if calling that function
* @bug current implementation is blocking * again is necessary
*/ */
static int ask_userauth(ssh_session session) { static int ask_userauth(ssh_session session) {
int rc = 0; int rc = 0;
@@ -67,8 +67,15 @@ static int ask_userauth(ssh_session session) {
enter_function(); enter_function();
do { do {
rc=ssh_service_request(session,"ssh-userauth"); rc=ssh_service_request(session,"ssh-userauth");
if(ssh_is_blocking(session)){
if(rc==SSH_AGAIN) if(rc==SSH_AGAIN)
ssh_handle_packets(session,-1); ssh_handle_packets(session,-1);
} else {
/* nonblocking */
ssh_handle_packets(session,0);
rc=ssh_service_request(session,"ssh-userauth");
break;
}
} while(rc==SSH_AGAIN); } while(rc==SSH_AGAIN);
leave_function(); leave_function();
return rc; return rc;