agent: make libssh2_agent_userauth() work blocking properly

previously it would always work in a non-blocking manner
This commit is contained in:
Daniel Stenberg 2010-06-18 20:12:29 +02:00
parent 38940f45d2
commit 32bd0df992

View File

@ -48,6 +48,7 @@
#undef PF_UNIX #undef PF_UNIX
#endif #endif
#include "userauth.h" #include "userauth.h"
#include "session.h"
/* Requests from client to agent for protocol 1 key operations */ /* Requests from client to agent for protocol 1 key operations */
#define SSH_AGENTC_REQUEST_RSA_IDENTITIES 1 #define SSH_AGENTC_REQUEST_RSA_IDENTITIES 1
@ -743,17 +744,21 @@ libssh2_agent_userauth(LIBSSH2_AGENT *agent,
struct libssh2_agent_publickey *identity) struct libssh2_agent_publickey *identity)
{ {
void *abstract = agent; void *abstract = agent;
int rc;
if (agent->session->userauth_pblc_state == libssh2_NB_state_idle) { if (agent->session->userauth_pblc_state == libssh2_NB_state_idle) {
memset(&agent->transctx, 0, sizeof agent->transctx); memset(&agent->transctx, 0, sizeof agent->transctx);
agent->identity = identity->node; agent->identity = identity->node;
} }
return _libssh2_userauth_publickey(agent->session, username,
BLOCK_ADJUST(rc, agent->session,
_libssh2_userauth_publickey(agent->session, username,
strlen(username), strlen(username),
identity->blob, identity->blob,
identity->blob_len, identity->blob_len,
agent_sign, agent_sign,
&abstract); &abstract));
return rc;
} }
/* /*