mirror of https://github.com/wolfSSL/wolfssh.git
SSH-AGENT
Add command line option to the client to allow use of the agent.pull/319/head
parent
b81f577b6c
commit
88e7919fbf
|
@ -172,6 +172,9 @@ static void ShowUsage(void)
|
||||||
printf(" -R raw untranslated output\n");
|
printf(" -R raw untranslated output\n");
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef WOLFSSH_AGENT
|
||||||
|
printf(" -a Attempt to use SSH-AGENT\n");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -815,6 +818,7 @@ THREAD_RETURN WOLFSSH_THREAD client_test(void* args)
|
||||||
byte rawMode = 0;
|
byte rawMode = 0;
|
||||||
#endif
|
#endif
|
||||||
#ifdef WOLFSSH_AGENT
|
#ifdef WOLFSSH_AGENT
|
||||||
|
byte useAgent = 0;
|
||||||
WS_AgentCbActionCtx agentCbCtx;
|
WS_AgentCbActionCtx agentCbCtx;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -888,6 +892,13 @@ THREAD_RETURN WOLFSSH_THREAD client_test(void* args)
|
||||||
keepOpen = 1;
|
keepOpen = 1;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef WOLFSSH_AGENT
|
||||||
|
case 'a':
|
||||||
|
useAgent = 1;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
ShowUsage();
|
ShowUsage();
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
|
@ -995,9 +1006,11 @@ THREAD_RETURN WOLFSSH_THREAD client_test(void* args)
|
||||||
wolfSSH_SetUserAuth(ctx, ((func_args*)args)->user_auth);
|
wolfSSH_SetUserAuth(ctx, ((func_args*)args)->user_auth);
|
||||||
|
|
||||||
#ifdef WOLFSSH_AGENT
|
#ifdef WOLFSSH_AGENT
|
||||||
wolfSSH_CTX_set_agent_cb(ctx,
|
if (useAgent) {
|
||||||
wolfSSH_AGENT_DefaultActions, wolfSSH_AGENT_IO_Cb);
|
wolfSSH_CTX_set_agent_cb(ctx,
|
||||||
wolfSSH_CTX_AGENT_enable(ctx, 1);
|
wolfSSH_AGENT_DefaultActions, wolfSSH_AGENT_IO_Cb);
|
||||||
|
wolfSSH_CTX_AGENT_enable(ctx, 1);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ssh = wolfSSH_new(ctx);
|
ssh = wolfSSH_new(ctx);
|
||||||
|
@ -1013,9 +1026,11 @@ THREAD_RETURN WOLFSSH_THREAD client_test(void* args)
|
||||||
wolfSSH_SetUserAuthCtx(ssh, (void*)password);
|
wolfSSH_SetUserAuthCtx(ssh, (void*)password);
|
||||||
|
|
||||||
#ifdef WOLFSSH_AGENT
|
#ifdef WOLFSSH_AGENT
|
||||||
memset(&agentCbCtx, 0, sizeof(agentCbCtx));
|
if (useAgent) {
|
||||||
agentCbCtx.state = AGENT_STATE_INIT;
|
memset(&agentCbCtx, 0, sizeof(agentCbCtx));
|
||||||
wolfSSH_set_agent_cb_ctx(ssh, &agentCbCtx);
|
agentCbCtx.state = AGENT_STATE_INIT;
|
||||||
|
wolfSSH_set_agent_cb_ctx(ssh, &agentCbCtx);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wolfSSH_CTX_SetPublicKeyCheck(ctx, wsPublicKeyCheck);
|
wolfSSH_CTX_SetPublicKeyCheck(ctx, wsPublicKeyCheck);
|
||||||
|
|
Loading…
Reference in New Issue