version 1.464, 2017/09/21 19:16:53 |
version 1.465, 2017/10/21 23:06:24 |
|
|
" [-J [user@]host[:port]] [-L address] [-l login_name] [-m mac_spec]\n" |
" [-J [user@]host[:port]] [-L address] [-l login_name] [-m mac_spec]\n" |
" [-O ctl_cmd] [-o option] [-p port] [-Q query_option] [-R address]\n" |
" [-O ctl_cmd] [-o option] [-p port] [-Q query_option] [-R address]\n" |
" [-S ctl_path] [-W host:port] [-w local_tun[:remote_tun]]\n" |
" [-S ctl_path] [-W host:port] [-w local_tun[:remote_tun]]\n" |
" [user@]hostname [command]\n" |
" destination [command]\n" |
); |
); |
exit(255); |
exit(255); |
} |
} |
|
|
options.control_master = SSHCTL_MASTER_YES; |
options.control_master = SSHCTL_MASTER_YES; |
break; |
break; |
case 'p': |
case 'p': |
options.port = a2port(optarg); |
if (options.port == -1) { |
if (options.port <= 0) { |
options.port = a2port(optarg); |
fprintf(stderr, "Bad port '%s'\n", optarg); |
if (options.port <= 0) { |
exit(255); |
fprintf(stderr, "Bad port '%s'\n", |
|
optarg); |
|
exit(255); |
|
} |
} |
} |
break; |
break; |
case 'l': |
case 'l': |
options.user = optarg; |
if (options.user == NULL) |
|
options.user = optarg; |
break; |
break; |
|
|
case 'L': |
case 'L': |
|
|
av += optind; |
av += optind; |
|
|
if (ac > 0 && !host) { |
if (ac > 0 && !host) { |
if (strrchr(*av, '@')) { |
int tport; |
|
char *tuser; |
|
switch (parse_ssh_uri(*av, &tuser, &host, &tport)) { |
|
case -1: |
|
usage(); |
|
break; |
|
case 0: |
|
if (options.user == NULL) { |
|
options.user = tuser; |
|
tuser = NULL; |
|
} |
|
free(tuser); |
|
if (options.port == -1 && tport != -1) |
|
options.port = tport; |
|
break; |
|
default: |
p = xstrdup(*av); |
p = xstrdup(*av); |
cp = strrchr(p, '@'); |
cp = strrchr(p, '@'); |
if (cp == NULL || cp == p) |
if (cp != NULL) { |
usage(); |
if (cp == p) |
options.user = p; |
usage(); |
*cp = '\0'; |
if (options.user == NULL) { |
host = xstrdup(++cp); |
options.user = p; |
} else |
p = NULL; |
host = xstrdup(*av); |
} |
|
*cp++ = '\0'; |
|
host = xstrdup(cp); |
|
free(p); |
|
} else |
|
host = p; |
|
break; |
|
} |
if (ac > 1 && !opt_terminated) { |
if (ac > 1 && !opt_terminated) { |
optind = optreset = 1; |
optind = optreset = 1; |
goto again; |
goto again; |