mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-29 01:03:57 +03:00
Made ask_userauth nonblocking
This commit is contained in:
15
src/auth.c
15
src/auth.c
@@ -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(rc==SSH_AGAIN)
|
if(ssh_is_blocking(session)){
|
||||||
ssh_handle_packets(session,-1);
|
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);
|
} while(rc==SSH_AGAIN);
|
||||||
leave_function();
|
leave_function();
|
||||||
return rc;
|
return rc;
|
||||||
|
|||||||
Reference in New Issue
Block a user