]> andersk Git - openssh.git/blobdiff - ssh.c
- More OpenBSD updates:
[openssh.git] / ssh.c
diff --git a/ssh.c b/ssh.c
index 39512c5f14bab26f252663b31a9d70805124be01..71d8f96fe1ecc34b9932d025c6bcc1ae3f1bdd63 100644 (file)
--- a/ssh.c
+++ b/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.63 2000/08/28 20:19:52 markus Exp $");
 
 #include <openssl/evp.h>
 #include <openssl/dsa.h>
@@ -461,7 +461,7 @@ main(int ac, char **av)
        }
 
        /* Cannot fork to background if no command. */
-       if (fork_after_authentication_flag && buffer_len(&command) == 0)
+       if (fork_after_authentication_flag && buffer_len(&command) == 0 && !no_shell_flag)
                fatal("Cannot fork into background without a command to execute.");
 
        /* Allocate a tty by default if no command specified. */
@@ -959,21 +959,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;
This page took 0.03574 seconds and 4 git commands to generate.