mirror of https://github.com/wolfSSL/wolfssh.git
apps/wolfssh: wire up the -a agent option
The useAgent flag was never set, so both agent setup blocks in wolfSSH_Client were dead code. Add the -a option to the parser and carry it through the config struct, matching examples/client/client.c. Issue: CID-572857pull/1140/head
parent
1e4773e49b
commit
f6ff8dc028
|
|
@ -95,9 +95,16 @@ static void ShowUsage(char* appPath)
|
|||
|
||||
printf("%s v%s linked with wolfSSL %s\n", appName,
|
||||
LIBWOLFSSH_VERSION_STRING, LIBWOLFSSL_VERSION_STRING);
|
||||
printf("usage: %s [-E logfile] [-G] [-l login_name] [-N] [-p port] "
|
||||
printf("usage: %s "
|
||||
#ifdef WOLFSSH_AGENT
|
||||
"[-a] "
|
||||
#endif
|
||||
"[-E logfile] [-G] [-l login_name] [-N] [-p port] "
|
||||
"[-V] destination\n",
|
||||
appName);
|
||||
#ifdef WOLFSSH_AGENT
|
||||
printf(" -a attempt to use SSH-AGENT\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -726,6 +733,7 @@ struct config {
|
|||
char* command;
|
||||
word32 printConfig:1;
|
||||
word32 noCommand:1;
|
||||
word32 useAgent:1;
|
||||
word16 port;
|
||||
};
|
||||
|
||||
|
|
@ -783,8 +791,18 @@ static int config_parse_command_line(struct config* config,
|
|||
{
|
||||
int ch;
|
||||
|
||||
while ((ch = mygetopt(argc, argv, "E:Gl:Np:V")) != -1) {
|
||||
while ((ch = mygetopt(argc, argv,
|
||||
#ifdef WOLFSSH_AGENT
|
||||
"a"
|
||||
#endif
|
||||
"E:Gl:Np:V")) != -1) {
|
||||
switch (ch) {
|
||||
#ifdef WOLFSSH_AGENT
|
||||
case 'a':
|
||||
config->useAgent = 1;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case 'E':
|
||||
config->logFile = myoptarg;
|
||||
break;
|
||||
|
|
@ -887,6 +905,9 @@ static int config_print(struct config* config)
|
|||
printf("pubKeyFile %s\n",
|
||||
config->pubKeyFile ? config->pubKeyFile : "none");
|
||||
printf("noCommand %s\n", config->noCommand ? "true" : "false");
|
||||
#ifdef WOLFSSH_AGENT
|
||||
printf("useAgent %s\n", config->useAgent ? "true" : "false");
|
||||
#endif
|
||||
printf("logfile %s\n", config->logFile ? config->logFile : "default");
|
||||
printf("command %s\n", config->command ? config->command : "none");
|
||||
}
|
||||
|
|
@ -950,6 +971,10 @@ static THREAD_RETURN WOLFSSH_THREAD wolfSSH_Client(void* args)
|
|||
((func_args*)args)->argc, ((func_args*)args)->argv);
|
||||
config_print(&config);
|
||||
|
||||
#ifdef WOLFSSH_AGENT
|
||||
useAgent = (byte)config.useAgent;
|
||||
#endif
|
||||
|
||||
if (config.user == NULL)
|
||||
err_sys("client requires a username parameter.");
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue