diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2011-01-16 18:05:47 +0100 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2011-01-16 23:42:19 +0100 |
commit | 624676b1cc8dbd44e21c6644a2e5dddec5eb2104 (patch) | |
tree | 03d72b00c96ee81c7391281c9359d12d8906e2d4 | |
parent | a236a15c6c2bac92012401851d1964e7b8512419 (diff) | |
download | libssh-624676b1cc8dbd44e21c6644a2e5dddec5eb2104.tar.gz libssh-624676b1cc8dbd44e21c6644a2e5dddec5eb2104.tar.xz libssh-624676b1cc8dbd44e21c6644a2e5dddec5eb2104.zip |
Made ask_userauth nonblocking
-rw-r--r-- | src/auth.c | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -58,8 +58,8 @@ * @param[in] session The SSH session handle. * * @returns SSH_OK on success, SSH_ERROR on error. - * - * @bug current implementation is blocking + * @returns SSH_AGAIN on nonblocking mode, if calling that function + * again is necessary */ static int ask_userauth(ssh_session session) { int rc = 0; @@ -67,8 +67,15 @@ static int ask_userauth(ssh_session session) { enter_function(); do { rc=ssh_service_request(session,"ssh-userauth"); - if(rc==SSH_AGAIN) - ssh_handle_packets(session,-1); + if(ssh_is_blocking(session)){ + if(rc==SSH_AGAIN) + ssh_handle_packets(session,-1); + } else { + /* nonblocking */ + ssh_handle_packets(session,0); + rc=ssh_service_request(session,"ssh-userauth"); + break; + } } while(rc==SSH_AGAIN); leave_function(); return rc; |