Asynchronous service request

This commit is contained in:
Aris Adamantiadis
2009-12-26 16:51:33 +01:00
parent bfdc48e320
commit 6f3505bf6b
5 changed files with 89 additions and 49 deletions

View File

@@ -45,19 +45,23 @@
/** \addtogroup ssh_auth
* @{ */
/**
* @internal
* @brief ask access to the ssh-userauth service
* @param session SSH session handle
* @returns SSH_OK on success
* @returns SSH_ERROR on error
* @bug current implementation is blocking
*/
static int ask_userauth(ssh_session session) {
int rc = 0;
enter_function();
if (session->auth_service_asked) {
rc = 0;
} else if (ssh_service_request(session,"ssh-userauth")) {
rc = -1;
} else {
session->auth_service_asked++;
}
do {
rc=ssh_service_request(session,"ssh-userauth");
if(rc==SSH_AGAIN)
ssh_handle_packets(session);
} while(rc==SSH_AGAIN);
leave_function();
return rc;
}