[clientloop.c ssh.c sshconnect.c sshconnect.h]
     kill proxy command on fatal() (we already kill it on clean exit);
     ok markus@
This commit is contained in:
Damien Miller 2010-10-07 22:07:32 +11:00
Родитель 38d9a965bf
Коммит a41ccca643
5 изменённых файлов: 25 добавлений и 14 удалений

Просмотреть файл

@ -30,6 +30,10 @@
- djm@cvs.openbsd.org 2010/10/05 05:13:18
[sftp.c sshconnect.c]
use default shell /bin/sh if $SHELL is ""; ok markus@
- djm@cvs.openbsd.org 2010/10/06 06:39:28
[clientloop.c ssh.c sshconnect.c sshconnect.h]
kill proxy command on fatal() (we already kill it on clean exit);
ok markus@
20100924
- (djm) OpenBSD CVS Sync

Просмотреть файл

@ -1,4 +1,4 @@
/* $OpenBSD: clientloop.c,v 1.222 2010/07/19 09:15:12 djm Exp $ */
/* $OpenBSD: clientloop.c,v 1.223 2010/10/06 06:39:28 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -2129,5 +2129,6 @@ cleanup_exit(int i)
leave_non_blocking();
if (options.control_path != NULL && muxserver_sock != -1)
unlink(options.control_path);
ssh_kill_proxy_command();
_exit(i);
}

13
ssh.c
Просмотреть файл

@ -1,4 +1,4 @@
/* $OpenBSD: ssh.c,v 1.352 2010/09/20 04:41:47 djm Exp $ */
/* $OpenBSD: ssh.c,v 1.353 2010/10/06 06:39:28 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -183,9 +183,6 @@ int subsystem_flag = 0;
/* # of replies received for global requests */
static int remote_forward_confirms_received = 0;
/* pid of proxycommand child process */
pid_t proxy_command_pid = 0;
/* mux.c */
extern int muxserver_sock;
extern u_int muxclient_command;
@ -921,12 +918,8 @@ main(int ac, char **av)
if (options.control_path != NULL && muxserver_sock != -1)
unlink(options.control_path);
/*
* Send SIGHUP to proxy command if used. We don't wait() in
* case it hangs and instead rely on init to reap the child
*/
if (proxy_command_pid > 1)
kill(proxy_command_pid, SIGHUP);
/* Kill ProxyCommand if it is running. */
ssh_kill_proxy_command();
return exit_status;
}

Просмотреть файл

@ -1,4 +1,4 @@
/* $OpenBSD: sshconnect.c,v 1.226 2010/10/05 05:13:18 djm Exp $ */
/* $OpenBSD: sshconnect.c,v 1.227 2010/10/06 06:39:28 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -66,12 +66,13 @@ char *server_version_string = NULL;
static int matching_host_key_dns = 0;
static pid_t proxy_command_pid = 0;
/* import */
extern Options options;
extern char *__progname;
extern uid_t original_real_uid;
extern uid_t original_effective_uid;
extern pid_t proxy_command_pid;
static int show_other_keys(const char *, Key *);
static void warn_changed_key(Key *);
@ -167,6 +168,17 @@ ssh_proxy_connect(const char *host, u_short port, const char *proxy_command)
return 0;
}
void
ssh_kill_proxy_command(void)
{
/*
* Send SIGHUP to proxy command if used. We don't wait() in
* case it hangs and instead rely on init to reap the child
*/
if (proxy_command_pid > 1)
kill(SIGHUP, proxy_command_pid);
}
/*
* Creates a (possibly privileged) socket for use as the ssh connection.
*/

Просмотреть файл

@ -1,4 +1,4 @@
/* $OpenBSD: sshconnect.h,v 1.25 2009/05/27 06:38:16 andreas Exp $ */
/* $OpenBSD: sshconnect.h,v 1.26 2010/10/06 06:39:28 djm Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
@ -34,6 +34,7 @@ struct Sensitive {
int
ssh_connect(const char *, struct sockaddr_storage *, u_short, int, int,
int *, int, int, const char *);
void ssh_kill_proxy_command(void);
void
ssh_login(Sensitive *, const char *, struct sockaddr *, struct passwd *, int);