diff options
author | Damien Miller <djm@mindrot.org> | 1999-11-13 13:28:45 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 1999-11-13 13:28:45 +1100 |
commit | d46202f0d19b18b4537804e3510e561d6a125a0d (patch) | |
tree | 3c01dae0373a5c8e6c06d5efe5bf17a1c346cf9b | |
parent | a2d6efe013e175f408733970803d535908554297 (diff) |
- Delay fork (-f option) in ssh until after port forwarded connections
have been initialised. Patch from Jani Hakala <jahakala@cc.jyu.fi>
-rw-r--r-- | ssh.c | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -18,7 +18,7 @@ Modified to work with SSL by Niels Provos <provos@citi.umich.edu> in Canada. | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include "includes.h" | 20 | #include "includes.h" |
21 | RCSID("$Id: ssh.c,v 1.6 1999/11/12 04:19:27 damien Exp $"); | 21 | RCSID("$Id: ssh.c,v 1.7 1999/11/13 02:28:45 damien Exp $"); |
22 | 22 | ||
23 | #include "xmalloc.h" | 23 | #include "xmalloc.h" |
24 | #include "ssh.h" | 24 | #include "ssh.h" |
@@ -599,17 +599,6 @@ main(int ac, char **av) | |||
599 | /* Close connection cleanly after attack. */ | 599 | /* Close connection cleanly after attack. */ |
600 | cipher_attack_detected = packet_disconnect; | 600 | cipher_attack_detected = packet_disconnect; |
601 | 601 | ||
602 | /* If requested, fork and let ssh continue in the background. */ | ||
603 | if (fork_after_authentication_flag) | ||
604 | { | ||
605 | int ret = fork(); | ||
606 | if (ret == -1) | ||
607 | fatal("fork failed: %.100s", strerror(errno)); | ||
608 | if (ret != 0) | ||
609 | exit(0); | ||
610 | setsid(); | ||
611 | } | ||
612 | |||
613 | /* Enable compression if requested. */ | 602 | /* Enable compression if requested. */ |
614 | if (options.compression) | 603 | if (options.compression) |
615 | { | 604 | { |
@@ -771,6 +760,17 @@ main(int ac, char **av) | |||
771 | options.remote_forwards[i].host_port); | 760 | options.remote_forwards[i].host_port); |
772 | } | 761 | } |
773 | 762 | ||
763 | /* If requested, fork and let ssh continue in the background. */ | ||
764 | if (fork_after_authentication_flag) | ||
765 | { | ||
766 | int ret = fork(); | ||
767 | if (ret == -1) | ||
768 | fatal("fork failed: %.100s", strerror(errno)); | ||
769 | if (ret != 0) | ||
770 | exit(0); | ||
771 | setsid(); | ||
772 | } | ||
773 | |||
774 | /* If a command was specified on the command line, execute the command now. | 774 | /* If a command was specified on the command line, execute the command now. |
775 | Otherwise request the server to start a shell. */ | 775 | Otherwise request the server to start a shell. */ |
776 | if (buffer_len(&command) > 0) | 776 | if (buffer_len(&command) > 0) |