|
Lines 609-618
main(int ac, char **av)
Link Here
|
| 609 |
/* Initialize the command to execute on remote host. */ |
609 |
/* Initialize the command to execute on remote host. */ |
| 610 |
buffer_init(&command); |
610 |
buffer_init(&command); |
| 611 |
|
611 |
|
| 612 |
if (options.request_tty == REQUEST_TTY_YES || |
|
|
| 613 |
options.request_tty == REQUEST_TTY_FORCE) |
| 614 |
tty_flag = 1; |
| 615 |
|
| 616 |
/* |
612 |
/* |
| 617 |
* Save the command to execute on the remote host in a buffer. There |
613 |
* Save the command to execute on the remote host in a buffer. There |
| 618 |
* is no limit on the length of the command, except by the maximum |
614 |
* is no limit on the length of the command, except by the maximum |
|
Lines 620-626
main(int ac, char **av)
Link Here
|
| 620 |
*/ |
616 |
*/ |
| 621 |
if (!ac) { |
617 |
if (!ac) { |
| 622 |
/* No command specified - execute shell on a tty. */ |
618 |
/* No command specified - execute shell on a tty. */ |
| 623 |
tty_flag = options.request_tty != REQUEST_TTY_NO; |
|
|
| 624 |
if (subsystem_flag) { |
619 |
if (subsystem_flag) { |
| 625 |
fprintf(stderr, |
620 |
fprintf(stderr, |
| 626 |
"You must specify a subsystem to invoke.\n"); |
621 |
"You must specify a subsystem to invoke.\n"); |
|
Lines 641-662
main(int ac, char **av)
Link Here
|
| 641 |
fatal("Cannot fork into background without a command " |
636 |
fatal("Cannot fork into background without a command " |
| 642 |
"to execute."); |
637 |
"to execute."); |
| 643 |
|
638 |
|
| 644 |
/* Allocate a tty by default if no command specified. */ |
|
|
| 645 |
if (buffer_len(&command) == 0) |
| 646 |
tty_flag = options.request_tty != REQUEST_TTY_NO; |
| 647 |
|
| 648 |
/* Force no tty */ |
| 649 |
if (options.request_tty == REQUEST_TTY_NO || muxclient_command != 0) |
| 650 |
tty_flag = 0; |
| 651 |
/* Do not allocate a tty if stdin is not a tty. */ |
| 652 |
if ((!isatty(fileno(stdin)) || stdin_null_flag) && |
| 653 |
options.request_tty != REQUEST_TTY_FORCE) { |
| 654 |
if (tty_flag) |
| 655 |
logit("Pseudo-terminal will not be allocated because " |
| 656 |
"stdin is not a terminal."); |
| 657 |
tty_flag = 0; |
| 658 |
} |
| 659 |
|
| 660 |
/* |
639 |
/* |
| 661 |
* Initialize "log" output. Since we are the client all output |
640 |
* Initialize "log" output. Since we are the client all output |
| 662 |
* actually goes to stderr. |
641 |
* actually goes to stderr. |
|
Lines 691-696
main(int ac, char **av)
Link Here
|
| 691 |
|
670 |
|
| 692 |
/* reinit */ |
671 |
/* reinit */ |
| 693 |
log_init(argv0, options.log_level, SYSLOG_FACILITY_USER, !use_syslog); |
672 |
log_init(argv0, options.log_level, SYSLOG_FACILITY_USER, !use_syslog); |
|
|
673 |
|
| 674 |
if (options.request_tty == REQUEST_TTY_YES || |
| 675 |
options.request_tty == REQUEST_TTY_FORCE) |
| 676 |
tty_flag = 1; |
| 677 |
|
| 678 |
/* Allocate a tty by default if no command specified. */ |
| 679 |
if (buffer_len(&command) == 0) |
| 680 |
tty_flag = options.request_tty != REQUEST_TTY_NO; |
| 681 |
|
| 682 |
/* Force no tty */ |
| 683 |
if (options.request_tty == REQUEST_TTY_NO || muxclient_command != 0) |
| 684 |
tty_flag = 0; |
| 685 |
/* Do not allocate a tty if stdin is not a tty. */ |
| 686 |
if ((!isatty(fileno(stdin)) || stdin_null_flag) && |
| 687 |
options.request_tty != REQUEST_TTY_FORCE) { |
| 688 |
if (tty_flag) |
| 689 |
logit("Pseudo-terminal will not be allocated because " |
| 690 |
"stdin is not a terminal."); |
| 691 |
tty_flag = 0; |
| 692 |
} |
| 694 |
|
693 |
|
| 695 |
if (options.user == NULL) |
694 |
if (options.user == NULL) |
| 696 |
options.user = xstrdup(pw->pw_name); |
695 |
options.user = xstrdup(pw->pw_name); |