version 1.374, 2013/03/08 06:32:58 |
version 1.375, 2013/04/07 02:10:33 |
|
|
{ |
{ |
fprintf(stderr, |
fprintf(stderr, |
"usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]\n" |
"usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]\n" |
" [-D [bind_address:]port] [-e escape_char] [-F configfile]\n" |
" [-D [bind_address:]port] [-E log_file] [-e escape_char]\n" |
" [-I pkcs11] [-i identity_file]\n" |
" [-F configfile] [-I pkcs11] [-i identity_file]\n" |
" [-L [bind_address:]port:host:hostport]\n" |
" [-L [bind_address:]port:host:hostport]\n" |
" [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]\n" |
" [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]\n" |
" [-R [bind_address:]port:host:hostport] [-S ctl_path]\n" |
" [-R [bind_address:]port:host:hostport] [-S ctl_path]\n" |
|
|
main(int ac, char **av) |
main(int ac, char **av) |
{ |
{ |
int i, r, opt, exit_status, use_syslog; |
int i, r, opt, exit_status, use_syslog; |
char *p, *cp, *line, *argv0, buf[MAXPATHLEN], *host_arg; |
char *p, *cp, *line, *argv0, buf[MAXPATHLEN], *host_arg, *logfile; |
char thishost[NI_MAXHOST], shorthost[NI_MAXHOST], portstr[NI_MAXSERV]; |
char thishost[NI_MAXHOST], shorthost[NI_MAXHOST], portstr[NI_MAXSERV]; |
struct stat st; |
struct stat st; |
struct passwd *pw; |
struct passwd *pw; |
|
|
/* Parse command-line arguments. */ |
/* Parse command-line arguments. */ |
host = NULL; |
host = NULL; |
use_syslog = 0; |
use_syslog = 0; |
|
logfile = NULL; |
argv0 = av[0]; |
argv0 = av[0]; |
|
|
again: |
again: |
while ((opt = getopt(ac, av, "1246ab:c:e:fgi:kl:m:no:p:qstvx" |
while ((opt = getopt(ac, av, "1246ab:c:e:fgi:kl:m:no:p:qstvx" |
"ACD:F:I:KL:MNO:PR:S:TVw:W:XYy")) != -1) { |
"ACD:E:F:I:KL:MNO:PR:S:TVw:W:XYy")) != -1) { |
switch (opt) { |
switch (opt) { |
case '1': |
case '1': |
options.protocol = SSH_PROTO_1; |
options.protocol = SSH_PROTO_1; |
|
|
case 'y': |
case 'y': |
use_syslog = 1; |
use_syslog = 1; |
break; |
break; |
|
case 'E': |
|
logfile = xstrdup(optarg); |
|
break; |
case 'Y': |
case 'Y': |
options.forward_x11 = 1; |
options.forward_x11 = 1; |
options.forward_x11_trusted = 1; |
options.forward_x11_trusted = 1; |
|
|
} else { |
} else { |
if (options.log_level < SYSLOG_LEVEL_DEBUG3) |
if (options.log_level < SYSLOG_LEVEL_DEBUG3) |
options.log_level++; |
options.log_level++; |
break; |
|
} |
} |
/* FALLTHROUGH */ |
break; |
case 'V': |
case 'V': |
fprintf(stderr, "%s, %s\n", |
fprintf(stderr, "%s, %s\n", |
SSH_VERSION, SSLeay_version(SSLEAY_VERSION)); |
SSH_VERSION, SSLeay_version(SSLEAY_VERSION)); |
|
|
|
|
/* |
/* |
* Initialize "log" output. Since we are the client all output |
* Initialize "log" output. Since we are the client all output |
* actually goes to stderr. |
* goes to stderr unless otherwise specified by -y or -E. |
*/ |
*/ |
|
if (use_syslog && logfile != NULL) |
|
fatal("Can't specify both -y and -E"); |
|
if (logfile != NULL) { |
|
log_redirect_stderr_to(logfile); |
|
xfree(logfile); |
|
} |
log_init(argv0, |
log_init(argv0, |
options.log_level == -1 ? SYSLOG_LEVEL_INFO : options.log_level, |
options.log_level == -1 ? SYSLOG_LEVEL_INFO : options.log_level, |
SYSLOG_FACILITY_USER, !use_syslog); |
SYSLOG_FACILITY_USER, !use_syslog); |
|
|
|
if (debug_flag) |
|
logit("%s, %s", SSH_VERSION, SSLeay_version(SSLEAY_VERSION)); |
|
|
/* |
/* |
* Read per-user configuration file. Ignore the system wide config |
* Read per-user configuration file. Ignore the system wide config |