mirror of git://anongit.mindrot.org/openssh.git
- markus@cvs.openbsd.org 2001/06/20 13:56:39
[channels.c channels.h clientloop.c packet.c serverloop.c] move from channel_stop_listening to channel_free_all, call channel_free_all before calling waitpid() in serverloop. fixes the utmp handling; report from Lutz.Jaenicke@aet.TU-Cottbus.DE
This commit is contained in:
parent
0a7ca6c7ba
commit
601e43638e
|
@ -21,6 +21,11 @@
|
|||
- markus@cvs.openbsd.org 2001/06/19 15:40:45
|
||||
[session.c]
|
||||
allocate and free at the same level.
|
||||
- markus@cvs.openbsd.org 2001/06/20 13:56:39
|
||||
[channels.c channels.h clientloop.c packet.c serverloop.c]
|
||||
move from channel_stop_listening to channel_free_all,
|
||||
call channel_free_all before calling waitpid() in serverloop.
|
||||
fixes the utmp handling; report from Lutz.Jaenicke@aet.TU-Cottbus.DE
|
||||
|
||||
20010615
|
||||
- (stevesk) don't set SA_RESTART and set SIGCHLD to SIG_DFL
|
||||
|
@ -5673,4 +5678,4 @@
|
|||
- Wrote replacements for strlcpy and mkdtemp
|
||||
- Released 1.0pre1
|
||||
|
||||
$Id: ChangeLog,v 1.1295 2001/06/21 03:17:42 mouring Exp $
|
||||
$Id: ChangeLog,v 1.1296 2001/06/21 03:19:23 mouring Exp $
|
||||
|
|
40
channels.c
40
channels.c
|
@ -40,7 +40,7 @@
|
|||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: channels.c,v 1.125 2001/06/07 20:23:04 markus Exp $");
|
||||
RCSID("$OpenBSD: channels.c,v 1.126 2001/06/20 13:56:39 markus Exp $");
|
||||
|
||||
#include "ssh.h"
|
||||
#include "ssh1.h"
|
||||
|
@ -223,11 +223,7 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd,
|
|||
channels = xmalloc(channels_alloc * sizeof(Channel *));
|
||||
for (i = 0; i < channels_alloc; i++)
|
||||
channels[i] = NULL;
|
||||
/*
|
||||
* Kludge: arrange a call to channel_stop_listening if we
|
||||
* terminate with fatal().
|
||||
*/
|
||||
fatal_add_cleanup((void (*) (void *)) channel_stop_listening, NULL);
|
||||
fatal_add_cleanup((void (*) (void *)) channel_free_all, NULL);
|
||||
}
|
||||
/* Try to find a free slot where to put the new channel. */
|
||||
for (found = -1, i = 0; i < channels_alloc; i++)
|
||||
|
@ -334,38 +330,14 @@ channel_free(Channel *c)
|
|||
xfree(c);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Stops listening for channels, and removes any unix domain sockets that we
|
||||
* might have.
|
||||
*/
|
||||
|
||||
void
|
||||
channel_stop_listening()
|
||||
channel_free_all(void)
|
||||
{
|
||||
int i;
|
||||
Channel *c;
|
||||
|
||||
for (i = 0; i < channels_alloc; i++) {
|
||||
c = channels[i];
|
||||
if (c != NULL) {
|
||||
switch (c->type) {
|
||||
case SSH_CHANNEL_AUTH_SOCKET:
|
||||
close(c->sock);
|
||||
/* auth_sock_cleanup_proc deletes the socket */
|
||||
channel_free(c);
|
||||
break;
|
||||
case SSH_CHANNEL_PORT_LISTENER:
|
||||
case SSH_CHANNEL_RPORT_LISTENER:
|
||||
case SSH_CHANNEL_X11_LISTENER:
|
||||
close(c->sock);
|
||||
channel_free(c);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i = 0; i < channels_alloc; i++)
|
||||
if (channels[i] != NULL)
|
||||
channel_free(channels[i]);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* RCSID("$OpenBSD: channels.h,v 1.38 2001/06/16 08:50:39 markus Exp $"); */
|
||||
/* RCSID("$OpenBSD: channels.h,v 1.39 2001/06/20 13:56:39 markus Exp $"); */
|
||||
|
||||
#ifndef CHANNEL_H
|
||||
#define CHANNEL_H
|
||||
|
@ -150,6 +150,7 @@ void
|
|||
channel_set_fds(int id, int rfd, int wfd, int efd,
|
||||
int extusage, int nonblock);
|
||||
void channel_free(Channel *c);
|
||||
void channel_free_all(void);
|
||||
|
||||
void channel_send_open(int id);
|
||||
void channel_request(int id, char *service, int wantconfirm);
|
||||
|
@ -182,8 +183,8 @@ void channel_after_select(fd_set * readset, fd_set * writeset);
|
|||
void channel_output_poll(void);
|
||||
|
||||
int channel_not_very_much_buffered_data(void);
|
||||
void channel_stop_listening(void);
|
||||
void channel_close_all(void);
|
||||
void channel_free_all(void);
|
||||
int channel_still_open(void);
|
||||
char *channel_open_message(void);
|
||||
int channel_find_open(void);
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: clientloop.c,v 1.75 2001/06/04 23:07:20 markus Exp $");
|
||||
RCSID("$OpenBSD: clientloop.c,v 1.76 2001/06/20 13:56:39 markus Exp $");
|
||||
|
||||
#include "ssh.h"
|
||||
#include "ssh1.h"
|
||||
|
@ -546,7 +546,7 @@ process_escapes(Buffer *bin, Buffer *bout, Buffer *berr, char *buf, int len)
|
|||
leave_raw_mode();
|
||||
|
||||
/* Stop listening for new connections. */
|
||||
channel_stop_listening();
|
||||
channel_close_all(); /* proto1 only XXXX */
|
||||
|
||||
printf("%c& [backgrounded]\n", escape_char);
|
||||
|
||||
|
@ -926,8 +926,7 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
|
|||
if (have_pty)
|
||||
signal(SIGWINCH, SIG_DFL);
|
||||
|
||||
/* Stop listening for connections. */
|
||||
channel_stop_listening();
|
||||
channel_free_all();
|
||||
|
||||
if (have_pty)
|
||||
leave_raw_mode();
|
||||
|
|
4
packet.c
4
packet.c
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: packet.c,v 1.66 2001/06/12 16:11:26 markus Exp $");
|
||||
RCSID("$OpenBSD: packet.c,v 1.67 2001/06/20 13:56:39 markus Exp $");
|
||||
|
||||
#include "xmalloc.h"
|
||||
#include "buffer.h"
|
||||
|
@ -1085,7 +1085,7 @@ packet_disconnect(const char *fmt,...)
|
|||
packet_write_wait();
|
||||
|
||||
/* Stop listening for connections. */
|
||||
channel_stop_listening();
|
||||
channel_close_all();
|
||||
|
||||
/* Close the connection. */
|
||||
packet_close();
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: serverloop.c,v 1.68 2001/06/04 23:07:20 markus Exp $");
|
||||
RCSID("$OpenBSD: serverloop.c,v 1.69 2001/06/20 13:56:39 markus Exp $");
|
||||
|
||||
#include "xmalloc.h"
|
||||
#include "packet.h"
|
||||
|
@ -608,8 +608,7 @@ server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg)
|
|||
close(fdin);
|
||||
fdin = -1;
|
||||
|
||||
/* Stop listening for channels; this removes unix domain sockets. */
|
||||
channel_stop_listening();
|
||||
channel_free_all();
|
||||
|
||||
/* We no longer want our SIGCHLD handler to be called. */
|
||||
signal(SIGCHLD, SIG_DFL);
|
||||
|
@ -700,10 +699,11 @@ server_loop2(void)
|
|||
if (writeset)
|
||||
xfree(writeset);
|
||||
|
||||
channel_free_all();
|
||||
|
||||
signal(SIGCHLD, SIG_DFL);
|
||||
while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
|
||||
session_close_by_pid(pid, status);
|
||||
channel_stop_listening();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in New Issue