- Delay fork (-f option) in ssh until after port forwarded connections
have been initialised. Patch from Jani Hakala <jahakala@cc.jyu.fi>
This commit is contained in:
parent
a2d6efe013
commit
d46202f0d1
24
ssh.c
24
ssh.c
|
@ -18,7 +18,7 @@ Modified to work with SSL by Niels Provos <provos@citi.umich.edu> in Canada.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$Id: ssh.c,v 1.6 1999/11/12 04:19:27 damien Exp $");
|
RCSID("$Id: ssh.c,v 1.7 1999/11/13 02:28:45 damien Exp $");
|
||||||
|
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
#include "ssh.h"
|
#include "ssh.h"
|
||||||
|
@ -599,17 +599,6 @@ main(int ac, char **av)
|
||||||
/* Close connection cleanly after attack. */
|
/* Close connection cleanly after attack. */
|
||||||
cipher_attack_detected = packet_disconnect;
|
cipher_attack_detected = packet_disconnect;
|
||||||
|
|
||||||
/* If requested, fork and let ssh continue in the background. */
|
|
||||||
if (fork_after_authentication_flag)
|
|
||||||
{
|
|
||||||
int ret = fork();
|
|
||||||
if (ret == -1)
|
|
||||||
fatal("fork failed: %.100s", strerror(errno));
|
|
||||||
if (ret != 0)
|
|
||||||
exit(0);
|
|
||||||
setsid();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Enable compression if requested. */
|
/* Enable compression if requested. */
|
||||||
if (options.compression)
|
if (options.compression)
|
||||||
{
|
{
|
||||||
|
@ -771,6 +760,17 @@ main(int ac, char **av)
|
||||||
options.remote_forwards[i].host_port);
|
options.remote_forwards[i].host_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If requested, fork and let ssh continue in the background. */
|
||||||
|
if (fork_after_authentication_flag)
|
||||||
|
{
|
||||||
|
int ret = fork();
|
||||||
|
if (ret == -1)
|
||||||
|
fatal("fork failed: %.100s", strerror(errno));
|
||||||
|
if (ret != 0)
|
||||||
|
exit(0);
|
||||||
|
setsid();
|
||||||
|
}
|
||||||
|
|
||||||
/* If a command was specified on the command line, execute the command now.
|
/* If a command was specified on the command line, execute the command now.
|
||||||
Otherwise request the server to start a shell. */
|
Otherwise request the server to start a shell. */
|
||||||
if (buffer_len(&command) > 0)
|
if (buffer_len(&command) > 0)
|
||||||
|
|
Loading…
Reference in New Issue