diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2021-07-23 04:01:00 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2021-07-23 04:01:00 +0000 |
commit | 23381a9697df632d79117ebf9aa503cb7ea0537d (patch) | |
tree | 2c5185c9950c1202691a84dde92f3a1f84c51433 /usr.bin/ssh/ssh.c | |
parent | b28c693054f04f0546062fc972aa415e86efc3cf (diff) |
Add a StdinNull directive to ssh_config(5) that allows the config
file to do the same thing as -n does on the ssh(1) commandline.
Patch from Volker Diels-Grabsch via GHPR231; ok dtucker
Diffstat (limited to 'usr.bin/ssh/ssh.c')
-rw-r--r-- | usr.bin/ssh/ssh.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c index 66ce7b1dad7..0b86ab881f4 100644 --- a/usr.bin/ssh/ssh.c +++ b/usr.bin/ssh/ssh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh.c,v 1.562 2021/07/17 00:38:11 djm Exp $ */ +/* $OpenBSD: ssh.c,v 1.563 2021/07/23 04:00:59 djm Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -111,12 +111,6 @@ int debug_flag = 0; int tty_flag = 0; /* - * Flag indicating that nothing should be read from stdin. This can be set - * on the command line. - */ -int stdin_null_flag = 0; - -/* * Flag indicating that the current process should be backgrounded and * a new mux-client launched in the foreground for ControlPersist. */ @@ -697,11 +691,11 @@ main(int ac, char **av) options.address_family = AF_INET6; break; case 'n': - stdin_null_flag = 1; + options.stdin_null = 1; break; case 'f': fork_after_authentication_flag = 1; - stdin_null_flag = 1; + options.stdin_null = 1; break; case 'x': options.forward_x11 = 0; @@ -1336,7 +1330,7 @@ main(int ac, char **av) (muxclient_command && muxclient_command != SSHMUX_COMMAND_PROXY)) tty_flag = 0; /* Do not allocate a tty if stdin is not a tty. */ - if ((!isatty(fileno(stdin)) || stdin_null_flag) && + if ((!isatty(fileno(stdin)) || options.stdin_null) && options.request_tty != REQUEST_TTY_FORCE) { if (tty_flag) logit("Pseudo-terminal will not be allocated because " @@ -1713,7 +1707,7 @@ control_persist_detach(void) default: /* Parent: set up mux client to connect to backgrounded master */ debug2_f("background process is %ld", (long)pid); - stdin_null_flag = ostdin_null_flag; + options.stdin_null = ostdin_null_flag; options.request_tty = orequest_tty; tty_flag = otty_flag; options.session_type = osession_type; @@ -2054,7 +2048,7 @@ ssh_session2_open(struct ssh *ssh) Channel *c; int window, packetmax, in, out, err; - if (stdin_null_flag) { + if (options.stdin_null) { in = open(_PATH_DEVNULL, O_RDONLY); } else { in = dup(STDIN_FILENO); @@ -2123,11 +2117,11 @@ ssh_session2(struct ssh *ssh, const struct ssh_conn_info *cinfo) * async rfwd replies have been received for ExitOnForwardFailure). */ if (options.control_persist && muxserver_sock != -1) { - ostdin_null_flag = stdin_null_flag; + ostdin_null_flag = options.stdin_null; osession_type = options.session_type; orequest_tty = options.request_tty; otty_flag = tty_flag; - stdin_null_flag = 1; + options.stdin_null = 1; options.session_type = SESSION_TYPE_NONE; tty_flag = 0; if (!fork_after_authentication_flag && |