comparison cli-runopts.c @ 1890:45e552ee4391

merge
author Matt Johnston <matt@ucc.asn.au>
date Tue, 22 Mar 2022 16:17:47 +0800
parents 33363a68784d
children 3442105b2aba
comparison
equal deleted inserted replaced
1889:fc4c9ef61856 1890:45e552ee4391
60 "-l <username>\n" 60 "-l <username>\n"
61 "-t Allocate a pty\n" 61 "-t Allocate a pty\n"
62 "-T Don't allocate a pty\n" 62 "-T Don't allocate a pty\n"
63 "-N Don't run a remote command\n" 63 "-N Don't run a remote command\n"
64 "-f Run in background after auth\n" 64 "-f Run in background after auth\n"
65 "-q quiet, don't show remote banner\n"
65 "-y Always accept remote host key if unknown\n" 66 "-y Always accept remote host key if unknown\n"
66 "-y -y Don't perform any remote host key checking (caution)\n" 67 "-y -y Don't perform any remote host key checking (caution)\n"
67 "-s Request a subsystem (use by external sftp)\n" 68 "-s Request a subsystem (use by external sftp)\n"
68 "-o option Set option in OpenSSH-like format ('-o help' to list options)\n" 69 "-o option Set option in OpenSSH-like format ('-o help' to list options)\n"
69 #if DROPBEAR_CLI_PUBKEY_AUTH 70 #if DROPBEAR_CLI_PUBKEY_AUTH
139 cli_opts.remotehost = NULL; 140 cli_opts.remotehost = NULL;
140 cli_opts.remoteport = NULL; 141 cli_opts.remoteport = NULL;
141 cli_opts.username = NULL; 142 cli_opts.username = NULL;
142 cli_opts.cmd = NULL; 143 cli_opts.cmd = NULL;
143 cli_opts.no_cmd = 0; 144 cli_opts.no_cmd = 0;
145 cli_opts.quiet = 0;
144 cli_opts.backgrounded = 0; 146 cli_opts.backgrounded = 0;
145 cli_opts.wantpty = 9; /* 9 means "it hasn't been touched", gets set later */ 147 cli_opts.wantpty = 9; /* 9 means "it hasn't been touched", gets set later */
146 cli_opts.always_accept_key = 0; 148 cli_opts.always_accept_key = 0;
147 cli_opts.no_hostkey_check = 0; 149 cli_opts.no_hostkey_check = 0;
148 cli_opts.is_subsystem = 0; 150 cli_opts.is_subsystem = 0;
211 if (cli_opts.always_accept_key) { 213 if (cli_opts.always_accept_key) {
212 /* twice means no checking at all */ 214 /* twice means no checking at all */
213 cli_opts.no_hostkey_check = 1; 215 cli_opts.no_hostkey_check = 1;
214 } 216 }
215 cli_opts.always_accept_key = 1; 217 cli_opts.always_accept_key = 1;
218 break;
219 case 'q': /* quiet */
220 cli_opts.quiet = 1;
216 break; 221 break;
217 case 'p': /* remoteport */ 222 case 'p': /* remoteport */
218 next = (char**)&cli_opts.remoteport; 223 next = (char**)&cli_opts.remoteport;
219 break; 224 break;
220 #if DROPBEAR_CLI_PUBKEY_AUTH 225 #if DROPBEAR_CLI_PUBKEY_AUTH
537 #endif /* DROPBEAR_CLI_PUBKEY_AUTH */ 542 #endif /* DROPBEAR_CLI_PUBKEY_AUTH */
538 543
539 len += 30; /* space for -W <size>, terminator. */ 544 len += 30; /* space for -W <size>, terminator. */
540 ret = m_malloc(len); 545 ret = m_malloc(len);
541 total = 0; 546 total = 0;
547
548 if (cli_opts.quiet)
549 {
550 int written = snprintf(ret+total, len-total, "-q ");
551 total += written;
552 }
542 553
543 if (cli_opts.no_hostkey_check) 554 if (cli_opts.no_hostkey_check)
544 { 555 {
545 int written = snprintf(ret+total, len-total, "-y -y "); 556 int written = snprintf(ret+total, len-total, "-y -y ");
546 total += written; 557 total += written;