diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2000-08-28 19:51:01 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2000-08-28 19:51:01 +0000 |
commit | 651ae9ac0357b84164cfaeb2135b7213257cf7c2 (patch) | |
tree | 2f7bf9a925043b1caa8f6c8c939aa89f88a9b0a9 | |
parent | 6408df20cd02ab686e67d52b1c69532f420c35e2 (diff) |
enable -n and -f for ssh2
-rw-r--r-- | usr.bin/ssh/ssh.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c index 5b1be81d46b..159c2483c76 100644 --- a/usr.bin/ssh/ssh.c +++ b/usr.bin/ssh/ssh.c @@ -11,7 +11,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: ssh.c,v 1.61 2000/08/20 18:42:40 millert Exp $"); +RCSID("$OpenBSD: ssh.c,v 1.62 2000/08/28 19:51:00 markus Exp $"); #include <openssl/evp.h> #include <openssl/dsa.h> @@ -947,21 +947,25 @@ ssh_session2(void) int window, packetmax, id; int in, out, err; - /* If requested, let ssh continue in the background. */ - if (fork_after_authentication_flag) - if (daemon(1, 1) < 0) - fatal("daemon() failed: %.200s", strerror(errno)); - - in = dup(STDIN_FILENO); + if (stdin_null_flag) { + in = open("/dev/null", O_RDONLY); + } else { + in = dup(STDIN_FILENO); + } out = dup(STDOUT_FILENO); err = dup(STDERR_FILENO); if (in < 0 || out < 0 || err < 0) - fatal("dump in/out/err failed"); + fatal("dup() in/out/err failed"); /* should be pre-session */ init_local_fwd(); + /* If requested, let ssh continue in the background. */ + if (fork_after_authentication_flag) + if (daemon(1, 1) < 0) + fatal("daemon() failed: %.200s", strerror(errno)); + window = 32*1024; if (tty_flag) { packetmax = window/8; |