diff options
author | Damien Miller <djm@mindrot.org> | 2011-05-15 08:45:50 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2011-05-15 08:45:50 +1000 |
commit | 21771e22d3e23a10cb01983b2df83d47362eadda (patch) | |
tree | f9b85caefb4f1549c847d34a7c7b3adead764c6b | |
parent | fe92421772243702ecb18b862dbeb51a9bdbbc6e (diff) |
- djm@cvs.openbsd.org 2011/05/06 21:34:32
[clientloop.c mux.c readconf.c readconf.h ssh.c ssh_config.5]
Add a RequestTTY ssh_config option to allow configuration-based
control over tty allocation (like -t/-T); ok markus@
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | clientloop.c | 24 | ||||
-rw-r--r-- | mux.c | 7 | ||||
-rw-r--r-- | readconf.c | 28 | ||||
-rw-r--r-- | readconf.h | 8 | ||||
-rw-r--r-- | ssh.c | 41 | ||||
-rw-r--r-- | ssh_config.5 | 19 |
7 files changed, 91 insertions, 40 deletions
@@ -32,6 +32,10 @@ | |||
32 | 32 | ||
33 | Will match "a.example.org", "b.example.org", but not "c.example.org" | 33 | Will match "a.example.org", "b.example.org", but not "c.example.org" |
34 | ok markus@ | 34 | ok markus@ |
35 | - djm@cvs.openbsd.org 2011/05/06 21:34:32 | ||
36 | [clientloop.c mux.c readconf.c readconf.h ssh.c ssh_config.5] | ||
37 | Add a RequestTTY ssh_config option to allow configuration-based | ||
38 | control over tty allocation (like -t/-T); ok markus@ | ||
35 | 39 | ||
36 | 20110510 | 40 | 20110510 |
37 | - (dtucker) [openbsd-compat/openssl-compat.{c,h}] Bug #1882: fix | 41 | - (dtucker) [openbsd-compat/openssl-compat.{c,h}] Bug #1882: fix |
diff --git a/clientloop.c b/clientloop.c index 502dd982c..5bd757dfb 100644 --- a/clientloop.c +++ b/clientloop.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: clientloop.c,v 1.232 2011/04/17 22:42:41 djm Exp $ */ | 1 | /* $OpenBSD: clientloop.c,v 1.233 2011/05/06 21:34:32 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -130,9 +130,6 @@ extern int muxserver_sock; /* XXX use mux_client_cleanup() instead */ | |||
130 | */ | 130 | */ |
131 | extern char *host; | 131 | extern char *host; |
132 | 132 | ||
133 | /* Force TTY allocation */ | ||
134 | extern int force_tty_flag; | ||
135 | |||
136 | /* | 133 | /* |
137 | * Flag to indicate that we have received a window change signal which has | 134 | * Flag to indicate that we have received a window change signal which has |
138 | * not yet been processed. This will cause a message indicating the new | 135 | * not yet been processed. This will cause a message indicating the new |
@@ -662,7 +659,7 @@ client_suspend_self(Buffer *bin, Buffer *bout, Buffer *berr) | |||
662 | atomicio(vwrite, fileno(stderr), buffer_ptr(berr), | 659 | atomicio(vwrite, fileno(stderr), buffer_ptr(berr), |
663 | buffer_len(berr)); | 660 | buffer_len(berr)); |
664 | 661 | ||
665 | leave_raw_mode(force_tty_flag); | 662 | leave_raw_mode(options.request_tty == REQUEST_TTY_FORCE); |
666 | 663 | ||
667 | /* | 664 | /* |
668 | * Free (and clear) the buffer to reduce the amount of data that gets | 665 | * Free (and clear) the buffer to reduce the amount of data that gets |
@@ -683,7 +680,7 @@ client_suspend_self(Buffer *bin, Buffer *bout, Buffer *berr) | |||
683 | buffer_init(bout); | 680 | buffer_init(bout); |
684 | buffer_init(berr); | 681 | buffer_init(berr); |
685 | 682 | ||
686 | enter_raw_mode(force_tty_flag); | 683 | enter_raw_mode(options.request_tty == REQUEST_TTY_FORCE); |
687 | } | 684 | } |
688 | 685 | ||
689 | static void | 686 | static void |
@@ -826,7 +823,7 @@ process_cmdline(void) | |||
826 | bzero(&fwd, sizeof(fwd)); | 823 | bzero(&fwd, sizeof(fwd)); |
827 | fwd.listen_host = fwd.connect_host = NULL; | 824 | fwd.listen_host = fwd.connect_host = NULL; |
828 | 825 | ||
829 | leave_raw_mode(force_tty_flag); | 826 | leave_raw_mode(options.request_tty == REQUEST_TTY_FORCE); |
830 | handler = signal(SIGINT, SIG_IGN); | 827 | handler = signal(SIGINT, SIG_IGN); |
831 | cmd = s = read_passphrase("\r\nssh> ", RP_ECHO); | 828 | cmd = s = read_passphrase("\r\nssh> ", RP_ECHO); |
832 | if (s == NULL) | 829 | if (s == NULL) |
@@ -930,7 +927,7 @@ process_cmdline(void) | |||
930 | 927 | ||
931 | out: | 928 | out: |
932 | signal(SIGINT, handler); | 929 | signal(SIGINT, handler); |
933 | enter_raw_mode(force_tty_flag); | 930 | enter_raw_mode(options.request_tty == REQUEST_TTY_FORCE); |
934 | if (cmd) | 931 | if (cmd) |
935 | xfree(cmd); | 932 | xfree(cmd); |
936 | if (fwd.listen_host != NULL) | 933 | if (fwd.listen_host != NULL) |
@@ -1049,7 +1046,8 @@ process_escapes(Channel *c, Buffer *bin, Buffer *bout, Buffer *berr, | |||
1049 | * more new connections). | 1046 | * more new connections). |
1050 | */ | 1047 | */ |
1051 | /* Restore tty modes. */ | 1048 | /* Restore tty modes. */ |
1052 | leave_raw_mode(force_tty_flag); | 1049 | leave_raw_mode( |
1050 | options.request_tty == REQUEST_TTY_FORCE); | ||
1053 | 1051 | ||
1054 | /* Stop listening for new connections. */ | 1052 | /* Stop listening for new connections. */ |
1055 | channel_stop_listening(); | 1053 | channel_stop_listening(); |
@@ -1344,7 +1342,7 @@ client_channel_closed(int id, void *arg) | |||
1344 | { | 1342 | { |
1345 | channel_cancel_cleanup(id); | 1343 | channel_cancel_cleanup(id); |
1346 | session_closed = 1; | 1344 | session_closed = 1; |
1347 | leave_raw_mode(force_tty_flag); | 1345 | leave_raw_mode(options.request_tty == REQUEST_TTY_FORCE); |
1348 | } | 1346 | } |
1349 | 1347 | ||
1350 | /* | 1348 | /* |
@@ -1415,7 +1413,7 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id) | |||
1415 | signal(SIGWINCH, window_change_handler); | 1413 | signal(SIGWINCH, window_change_handler); |
1416 | 1414 | ||
1417 | if (have_pty) | 1415 | if (have_pty) |
1418 | enter_raw_mode(force_tty_flag); | 1416 | enter_raw_mode(options.request_tty == REQUEST_TTY_FORCE); |
1419 | 1417 | ||
1420 | if (compat20) { | 1418 | if (compat20) { |
1421 | session_ident = ssh2_chan_id; | 1419 | session_ident = ssh2_chan_id; |
@@ -1559,7 +1557,7 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id) | |||
1559 | channel_free_all(); | 1557 | channel_free_all(); |
1560 | 1558 | ||
1561 | if (have_pty) | 1559 | if (have_pty) |
1562 | leave_raw_mode(force_tty_flag); | 1560 | leave_raw_mode(options.request_tty == REQUEST_TTY_FORCE); |
1563 | 1561 | ||
1564 | /* restore blocking io */ | 1562 | /* restore blocking io */ |
1565 | if (!isatty(fileno(stdin))) | 1563 | if (!isatty(fileno(stdin))) |
@@ -2142,7 +2140,7 @@ client_stop_mux(void) | |||
2142 | void | 2140 | void |
2143 | cleanup_exit(int i) | 2141 | cleanup_exit(int i) |
2144 | { | 2142 | { |
2145 | leave_raw_mode(force_tty_flag); | 2143 | leave_raw_mode(options.request_tty == REQUEST_TTY_FORCE); |
2146 | leave_non_blocking(); | 2144 | leave_non_blocking(); |
2147 | if (options.control_path != NULL && muxserver_sock != -1) | 2145 | if (options.control_path != NULL && muxserver_sock != -1) |
2148 | unlink(options.control_path); | 2146 | unlink(options.control_path); |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: mux.c,v 1.26 2011/05/05 05:12:08 djm Exp $ */ | 1 | /* $OpenBSD: mux.c,v 1.27 2011/05/06 21:34:32 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org> | 3 | * Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org> |
4 | * | 4 | * |
@@ -87,7 +87,6 @@ | |||
87 | 87 | ||
88 | /* from ssh.c */ | 88 | /* from ssh.c */ |
89 | extern int tty_flag; | 89 | extern int tty_flag; |
90 | extern int force_tty_flag; | ||
91 | extern Options options; | 90 | extern Options options; |
92 | extern int stdin_null_flag; | 91 | extern int stdin_null_flag; |
93 | extern char *host; | 92 | extern char *host; |
@@ -1710,7 +1709,7 @@ mux_client_request_session(int fd) | |||
1710 | signal(SIGWINCH, control_client_sigrelay); | 1709 | signal(SIGWINCH, control_client_sigrelay); |
1711 | 1710 | ||
1712 | if (tty_flag) | 1711 | if (tty_flag) |
1713 | enter_raw_mode(force_tty_flag); | 1712 | enter_raw_mode(options.request_tty == REQUEST_TTY_FORCE); |
1714 | 1713 | ||
1715 | /* | 1714 | /* |
1716 | * Stick around until the controlee closes the client_fd. | 1715 | * Stick around until the controlee closes the client_fd. |
@@ -1739,7 +1738,7 @@ mux_client_request_session(int fd) | |||
1739 | } | 1738 | } |
1740 | 1739 | ||
1741 | close(fd); | 1740 | close(fd); |
1742 | leave_raw_mode(force_tty_flag); | 1741 | leave_raw_mode(options.request_tty == REQUEST_TTY_FORCE); |
1743 | 1742 | ||
1744 | if (muxclient_terminate) { | 1743 | if (muxclient_terminate) { |
1745 | debug2("Exiting on signal %d", muxclient_terminate); | 1744 | debug2("Exiting on signal %d", muxclient_terminate); |
diff --git a/readconf.c b/readconf.c index 927e7fefa..4780ae289 100644 --- a/readconf.c +++ b/readconf.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: readconf.c,v 1.191 2011/05/06 21:31:38 djm Exp $ */ | 1 | /* $OpenBSD: readconf.c,v 1.192 2011/05/06 21:34:32 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -134,7 +134,7 @@ typedef enum { | |||
134 | oHashKnownHosts, | 134 | oHashKnownHosts, |
135 | oTunnel, oTunnelDevice, oLocalCommand, oPermitLocalCommand, | 135 | oTunnel, oTunnelDevice, oLocalCommand, oPermitLocalCommand, |
136 | oVisualHostKey, oUseRoaming, oZeroKnowledgePasswordAuthentication, | 136 | oVisualHostKey, oUseRoaming, oZeroKnowledgePasswordAuthentication, |
137 | oKexAlgorithms, oIPQoS, | 137 | oKexAlgorithms, oIPQoS, oRequestTTY, |
138 | oDeprecated, oUnsupported | 138 | oDeprecated, oUnsupported |
139 | } OpCodes; | 139 | } OpCodes; |
140 | 140 | ||
@@ -245,6 +245,7 @@ static struct { | |||
245 | #endif | 245 | #endif |
246 | { "kexalgorithms", oKexAlgorithms }, | 246 | { "kexalgorithms", oKexAlgorithms }, |
247 | { "ipqos", oIPQoS }, | 247 | { "ipqos", oIPQoS }, |
248 | { "requesttty", oRequestTTY }, | ||
248 | 249 | ||
249 | { NULL, oBadOption } | 250 | { NULL, oBadOption } |
250 | }; | 251 | }; |
@@ -1013,6 +1014,26 @@ parse_int: | |||
1013 | intptr = &options->use_roaming; | 1014 | intptr = &options->use_roaming; |
1014 | goto parse_flag; | 1015 | goto parse_flag; |
1015 | 1016 | ||
1017 | case oRequestTTY: | ||
1018 | arg = strdelim(&s); | ||
1019 | if (!arg || *arg == '\0') | ||
1020 | fatal("%s line %d: missing argument.", | ||
1021 | filename, linenum); | ||
1022 | intptr = &options->request_tty; | ||
1023 | if (strcasecmp(arg, "yes") == 0) | ||
1024 | value = REQUEST_TTY_YES; | ||
1025 | else if (strcasecmp(arg, "no") == 0) | ||
1026 | value = REQUEST_TTY_NO; | ||
1027 | else if (strcasecmp(arg, "force") == 0) | ||
1028 | value = REQUEST_TTY_FORCE; | ||
1029 | else if (strcasecmp(arg, "auto") == 0) | ||
1030 | value = REQUEST_TTY_AUTO; | ||
1031 | else | ||
1032 | fatal("Unsupported RequestTTY \"%s\"", arg); | ||
1033 | if (*activep && *intptr == -1) | ||
1034 | *intptr = value; | ||
1035 | break; | ||
1036 | |||
1016 | case oDeprecated: | 1037 | case oDeprecated: |
1017 | debug("%s line %d: Deprecated option \"%s\"", | 1038 | debug("%s line %d: Deprecated option \"%s\"", |
1018 | filename, linenum, keyword); | 1039 | filename, linenum, keyword); |
@@ -1173,6 +1194,7 @@ initialize_options(Options * options) | |||
1173 | options->zero_knowledge_password_authentication = -1; | 1194 | options->zero_knowledge_password_authentication = -1; |
1174 | options->ip_qos_interactive = -1; | 1195 | options->ip_qos_interactive = -1; |
1175 | options->ip_qos_bulk = -1; | 1196 | options->ip_qos_bulk = -1; |
1197 | options->request_tty = -1; | ||
1176 | } | 1198 | } |
1177 | 1199 | ||
1178 | /* | 1200 | /* |
@@ -1331,6 +1353,8 @@ fill_default_options(Options * options) | |||
1331 | options->ip_qos_interactive = IPTOS_LOWDELAY; | 1353 | options->ip_qos_interactive = IPTOS_LOWDELAY; |
1332 | if (options->ip_qos_bulk == -1) | 1354 | if (options->ip_qos_bulk == -1) |
1333 | options->ip_qos_bulk = IPTOS_THROUGHPUT; | 1355 | options->ip_qos_bulk = IPTOS_THROUGHPUT; |
1356 | if (options->request_tty == -1) | ||
1357 | options->request_tty = REQUEST_TTY_AUTO; | ||
1334 | /* options->local_command should not be set by default */ | 1358 | /* options->local_command should not be set by default */ |
1335 | /* options->proxy_command should not be set by default */ | 1359 | /* options->proxy_command should not be set by default */ |
1336 | /* options->user will be set in the main program if appropriate */ | 1360 | /* options->user will be set in the main program if appropriate */ |
diff --git a/readconf.h b/readconf.h index ee160dfe7..bc3e8c1bb 100644 --- a/readconf.h +++ b/readconf.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: readconf.h,v 1.88 2010/11/13 23:27:50 djm Exp $ */ | 1 | /* $OpenBSD: readconf.h,v 1.89 2011/05/06 21:34:32 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -132,6 +132,7 @@ typedef struct { | |||
132 | 132 | ||
133 | int use_roaming; | 133 | int use_roaming; |
134 | 134 | ||
135 | int request_tty; | ||
135 | } Options; | 136 | } Options; |
136 | 137 | ||
137 | #define SSHCTL_MASTER_NO 0 | 138 | #define SSHCTL_MASTER_NO 0 |
@@ -140,6 +141,11 @@ typedef struct { | |||
140 | #define SSHCTL_MASTER_ASK 3 | 141 | #define SSHCTL_MASTER_ASK 3 |
141 | #define SSHCTL_MASTER_AUTO_ASK 4 | 142 | #define SSHCTL_MASTER_AUTO_ASK 4 |
142 | 143 | ||
144 | #define REQUEST_TTY_AUTO 0 | ||
145 | #define REQUEST_TTY_NO 1 | ||
146 | #define REQUEST_TTY_YES 2 | ||
147 | #define REQUEST_TTY_FORCE 3 | ||
148 | |||
143 | void initialize_options(Options *); | 149 | void initialize_options(Options *); |
144 | void fill_default_options(Options *); | 150 | void fill_default_options(Options *); |
145 | int read_config_file(const char *, const char *, Options *, int); | 151 | int read_config_file(const char *, const char *, Options *, int); |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh.c,v 1.358 2011/05/06 21:18:02 djm Exp $ */ | 1 | /* $OpenBSD: ssh.c,v 1.359 2011/05/06 21:34:32 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -114,10 +114,8 @@ extern char *__progname; | |||
114 | /* Flag indicating whether debug mode is on. May be set on the command line. */ | 114 | /* Flag indicating whether debug mode is on. May be set on the command line. */ |
115 | int debug_flag = 0; | 115 | int debug_flag = 0; |
116 | 116 | ||
117 | /* Flag indicating whether a tty should be allocated */ | 117 | /* Flag indicating whether a tty should be requested */ |
118 | int tty_flag = 0; | 118 | int tty_flag = 0; |
119 | int no_tty_flag = 0; | ||
120 | int force_tty_flag = 0; | ||
121 | 119 | ||
122 | /* don't exec a shell */ | 120 | /* don't exec a shell */ |
123 | int no_shell_flag = 0; | 121 | int no_shell_flag = 0; |
@@ -135,7 +133,7 @@ int stdin_null_flag = 0; | |||
135 | int need_controlpersist_detach = 0; | 133 | int need_controlpersist_detach = 0; |
136 | 134 | ||
137 | /* Copies of flags for ControlPersist foreground slave */ | 135 | /* Copies of flags for ControlPersist foreground slave */ |
138 | int ostdin_null_flag, ono_shell_flag, ono_tty_flag, otty_flag; | 136 | int ostdin_null_flag, ono_shell_flag, otty_flag, orequest_tty; |
139 | 137 | ||
140 | /* | 138 | /* |
141 | * Flag indicating that ssh should fork after authentication. This is useful | 139 | * Flag indicating that ssh should fork after authentication. This is useful |
@@ -389,9 +387,10 @@ main(int ac, char **av) | |||
389 | #endif | 387 | #endif |
390 | break; | 388 | break; |
391 | case 't': | 389 | case 't': |
392 | if (tty_flag) | 390 | if (options.request_tty == REQUEST_TTY_YES) |
393 | force_tty_flag = 1; | 391 | options.request_tty = REQUEST_TTY_FORCE; |
394 | tty_flag = 1; | 392 | else |
393 | options.request_tty = REQUEST_TTY_YES; | ||
395 | break; | 394 | break; |
396 | case 'v': | 395 | case 'v': |
397 | if (debug_flag == 0) { | 396 | if (debug_flag == 0) { |
@@ -434,7 +433,7 @@ main(int ac, char **av) | |||
434 | optarg); | 433 | optarg); |
435 | exit(255); | 434 | exit(255); |
436 | } | 435 | } |
437 | no_tty_flag = 1; | 436 | options.request_tty = REQUEST_TTY_NO; |
438 | no_shell_flag = 1; | 437 | no_shell_flag = 1; |
439 | options.clear_forwardings = 1; | 438 | options.clear_forwardings = 1; |
440 | options.exit_on_forward_failure = 1; | 439 | options.exit_on_forward_failure = 1; |
@@ -543,10 +542,10 @@ main(int ac, char **av) | |||
543 | break; | 542 | break; |
544 | case 'N': | 543 | case 'N': |
545 | no_shell_flag = 1; | 544 | no_shell_flag = 1; |
546 | no_tty_flag = 1; | 545 | options.request_tty = REQUEST_TTY_NO; |
547 | break; | 546 | break; |
548 | case 'T': | 547 | case 'T': |
549 | no_tty_flag = 1; | 548 | options.request_tty = REQUEST_TTY_NO; |
550 | break; | 549 | break; |
551 | case 'o': | 550 | case 'o': |
552 | dummy = 1; | 551 | dummy = 1; |
@@ -606,6 +605,10 @@ main(int ac, char **av) | |||
606 | /* Initialize the command to execute on remote host. */ | 605 | /* Initialize the command to execute on remote host. */ |
607 | buffer_init(&command); | 606 | buffer_init(&command); |
608 | 607 | ||
608 | if (options.request_tty == REQUEST_TTY_YES || | ||
609 | options.request_tty == REQUEST_TTY_FORCE) | ||
610 | tty_flag = 1; | ||
611 | |||
609 | /* | 612 | /* |
610 | * 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 |
611 | * 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 |
@@ -613,7 +616,7 @@ main(int ac, char **av) | |||
613 | */ | 616 | */ |
614 | if (!ac) { | 617 | if (!ac) { |
615 | /* No command specified - execute shell on a tty. */ | 618 | /* No command specified - execute shell on a tty. */ |
616 | tty_flag = 1; | 619 | tty_flag = options.request_tty != REQUEST_TTY_NO; |
617 | if (subsystem_flag) { | 620 | if (subsystem_flag) { |
618 | fprintf(stderr, | 621 | fprintf(stderr, |
619 | "You must specify a subsystem to invoke.\n"); | 622 | "You must specify a subsystem to invoke.\n"); |
@@ -636,13 +639,14 @@ main(int ac, char **av) | |||
636 | 639 | ||
637 | /* Allocate a tty by default if no command specified. */ | 640 | /* Allocate a tty by default if no command specified. */ |
638 | if (buffer_len(&command) == 0) | 641 | if (buffer_len(&command) == 0) |
639 | tty_flag = 1; | 642 | tty_flag = options.request_tty != REQUEST_TTY_NO; |
640 | 643 | ||
641 | /* Force no tty */ | 644 | /* Force no tty */ |
642 | if (no_tty_flag || muxclient_command != 0) | 645 | if (options.request_tty == REQUEST_TTY_NO || muxclient_command != 0) |
643 | tty_flag = 0; | 646 | tty_flag = 0; |
644 | /* Do not allocate a tty if stdin is not a tty. */ | 647 | /* Do not allocate a tty if stdin is not a tty. */ |
645 | if ((!isatty(fileno(stdin)) || stdin_null_flag) && !force_tty_flag) { | 648 | if ((!isatty(fileno(stdin)) || stdin_null_flag) && |
649 | options.request_tty != REQUEST_TTY_FORCE) { | ||
646 | if (tty_flag) | 650 | if (tty_flag) |
647 | logit("Pseudo-terminal will not be allocated because " | 651 | logit("Pseudo-terminal will not be allocated because " |
648 | "stdin is not a terminal."); | 652 | "stdin is not a terminal."); |
@@ -946,8 +950,7 @@ control_persist_detach(void) | |||
946 | /* Parent: set up mux slave to connect to backgrounded master */ | 950 | /* Parent: set up mux slave to connect to backgrounded master */ |
947 | debug2("%s: background process is %ld", __func__, (long)pid); | 951 | debug2("%s: background process is %ld", __func__, (long)pid); |
948 | stdin_null_flag = ostdin_null_flag; | 952 | stdin_null_flag = ostdin_null_flag; |
949 | no_shell_flag = ono_shell_flag; | 953 | options.request_tty = orequest_tty; |
950 | no_tty_flag = ono_tty_flag; | ||
951 | tty_flag = otty_flag; | 954 | tty_flag = otty_flag; |
952 | close(muxserver_sock); | 955 | close(muxserver_sock); |
953 | muxserver_sock = -1; | 956 | muxserver_sock = -1; |
@@ -1394,11 +1397,11 @@ ssh_session2(void) | |||
1394 | if (options.control_persist && muxserver_sock != -1) { | 1397 | if (options.control_persist && muxserver_sock != -1) { |
1395 | ostdin_null_flag = stdin_null_flag; | 1398 | ostdin_null_flag = stdin_null_flag; |
1396 | ono_shell_flag = no_shell_flag; | 1399 | ono_shell_flag = no_shell_flag; |
1397 | ono_tty_flag = no_tty_flag; | 1400 | orequest_tty = options.request_tty; |
1398 | otty_flag = tty_flag; | 1401 | otty_flag = tty_flag; |
1399 | stdin_null_flag = 1; | 1402 | stdin_null_flag = 1; |
1400 | no_shell_flag = 1; | 1403 | no_shell_flag = 1; |
1401 | no_tty_flag = 1; | 1404 | options.request_tty == REQUEST_TTY_NO; |
1402 | tty_flag = 0; | 1405 | tty_flag = 0; |
1403 | if (!fork_after_authentication_flag) | 1406 | if (!fork_after_authentication_flag) |
1404 | need_controlpersist_detach = 1; | 1407 | need_controlpersist_detach = 1; |
diff --git a/ssh_config.5 b/ssh_config.5 index 5bdc7fec1..83baa82b1 100644 --- a/ssh_config.5 +++ b/ssh_config.5 | |||
@@ -33,7 +33,7 @@ | |||
33 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 33 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
34 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 34 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
35 | .\" | 35 | .\" |
36 | .\" $OpenBSD: ssh_config.5,v 1.148 2011/05/06 21:31:38 djm Exp $ | 36 | .\" $OpenBSD: ssh_config.5,v 1.149 2011/05/06 21:34:32 djm Exp $ |
37 | .Dd $Mdocdate: May 6 2011 $ | 37 | .Dd $Mdocdate: May 6 2011 $ |
38 | .Dt SSH_CONFIG 5 | 38 | .Dt SSH_CONFIG 5 |
39 | .Os | 39 | .Os |
@@ -959,6 +959,23 @@ will only succeed if the server's | |||
959 | .Cm GatewayPorts | 959 | .Cm GatewayPorts |
960 | option is enabled (see | 960 | option is enabled (see |
961 | .Xr sshd_config 5 ) . | 961 | .Xr sshd_config 5 ) . |
962 | .It Cm RequestTTY | ||
963 | Specifies whether to request a pseudo-tty for the session. | ||
964 | The argument may be one of: | ||
965 | .Dq no | ||
966 | (never request a TTY), | ||
967 | .Dq yes | ||
968 | (always request a TTY when standard input is a TTY), | ||
969 | .Dq force | ||
970 | (always request a TTY) or | ||
971 | .Dq auto | ||
972 | (request a TTY when opening a login session). | ||
973 | This option mirrors the | ||
974 | .Fl t | ||
975 | and | ||
976 | .Fl T | ||
977 | flags for | ||
978 | .Xr ssh 1 . | ||
962 | .It Cm RhostsRSAAuthentication | 979 | .It Cm RhostsRSAAuthentication |
963 | Specifies whether to try rhosts based authentication with RSA host | 980 | Specifies whether to try rhosts based authentication with RSA host |
964 | authentication. | 981 | authentication. |