version 1.460, 2017/05/30 08:52:19 |
version 1.461, 2017/05/30 18:58:37 |
|
|
} |
} |
} |
} |
|
|
/* Cannot fork to background if no command. */ |
|
if (fork_after_authentication_flag && buffer_len(&command) == 0 && |
|
!no_shell_flag) |
|
fatal("Cannot fork into background without a command " |
|
"to execute."); |
|
|
|
/* |
/* |
* Initialize "log" output. Since we are the client all output |
* Initialize "log" output. Since we are the client all output |
* goes to stderr unless otherwise specified by -y or -E. |
* goes to stderr unless otherwise specified by -y or -E. |
|
|
if (original_effective_uid != 0) |
if (original_effective_uid != 0) |
options.use_privileged_port = 0; |
options.use_privileged_port = 0; |
|
|
|
if (buffer_len(&command) != 0 && options.remote_command != NULL) |
|
fatal("Cannot execute command-line and remote command."); |
|
|
|
/* Cannot fork to background if no command. */ |
|
if (fork_after_authentication_flag && buffer_len(&command) == 0 && |
|
options.remote_command == NULL && !no_shell_flag) |
|
fatal("Cannot fork into background without a command " |
|
"to execute."); |
|
|
/* reinit */ |
/* reinit */ |
log_init(argv0, options.log_level, options.log_facility, !use_syslog); |
log_init(argv0, options.log_level, options.log_facility, !use_syslog); |
|
|
|
|
tty_flag = 1; |
tty_flag = 1; |
|
|
/* Allocate a tty by default if no command specified. */ |
/* Allocate a tty by default if no command specified. */ |
if (buffer_len(&command) == 0) |
if (buffer_len(&command) == 0 && options.remote_command == NULL) |
tty_flag = options.request_tty != REQUEST_TTY_NO; |
tty_flag = options.request_tty != REQUEST_TTY_NO; |
|
|
/* Force no tty */ |
/* Force no tty */ |
|
|
(char *)NULL); |
(char *)NULL); |
debug3("expanded LocalCommand: %s", options.local_command); |
debug3("expanded LocalCommand: %s", options.local_command); |
free(cp); |
free(cp); |
|
} |
|
|
|
if (options.remote_command != NULL) { |
|
debug3("expanding RemoteCommand: %s", options.remote_command); |
|
cp = options.remote_command; |
|
options.remote_command = percent_expand(cp, |
|
"C", conn_hash_hex, |
|
"L", shorthost, |
|
"d", pw->pw_dir, |
|
"h", host, |
|
"l", thishost, |
|
"n", host_arg, |
|
"p", portstr, |
|
"r", options.user, |
|
"u", pw->pw_name, |
|
(char *)NULL); |
|
debug3("expanded RemoteCommand: %s", options.remote_command); |
|
free(cp); |
|
buffer_append(&command, options.remote_command, |
|
strlen(options.remote_command)); |
|
|
} |
} |
|
|
if (options.control_path != NULL) { |
if (options.control_path != NULL) { |