aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2011-01-16 18:05:47 +0100
committerAris Adamantiadis <aris@0xbadc0de.be>2011-01-16 23:42:19 +0100
commit624676b1cc8dbd44e21c6644a2e5dddec5eb2104 (patch)
tree03d72b00c96ee81c7391281c9359d12d8906e2d4 /src
parenta236a15c6c2bac92012401851d1964e7b8512419 (diff)
downloadlibssh-624676b1cc8dbd44e21c6644a2e5dddec5eb2104.tar.gz
libssh-624676b1cc8dbd44e21c6644a2e5dddec5eb2104.tar.xz
libssh-624676b1cc8dbd44e21c6644a2e5dddec5eb2104.zip
Made ask_userauth nonblocking
Diffstat (limited to 'src')
-rw-r--r--src/auth.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/auth.c b/src/auth.c
index b63d0782..2ae9a9db 100644
--- a/src/auth.c
+++ b/src/auth.c
@@ -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;