- markus@cvs.openbsd.org 2001/05/04 14:34:34
[channels.c] channel_new() reallocs channels[], we cannot use Channel *c after calling channel_new(), XXX fix this in the future...
This commit is contained in:
parent
f0609f8bd3
commit
c8cb8c0405
|
@ -3,6 +3,10 @@
|
||||||
- stevesk@cvs.openbsd.org 2001/05/04 14:21:56
|
- stevesk@cvs.openbsd.org 2001/05/04 14:21:56
|
||||||
[ssh.1 sshd.8]
|
[ssh.1 sshd.8]
|
||||||
typos
|
typos
|
||||||
|
- markus@cvs.openbsd.org 2001/05/04 14:34:34
|
||||||
|
[channels.c]
|
||||||
|
channel_new() reallocs channels[], we cannot use Channel *c after calling
|
||||||
|
channel_new(), XXX fix this in the future...
|
||||||
|
|
||||||
20010504
|
20010504
|
||||||
- OpenBSD CVS Sync
|
- OpenBSD CVS Sync
|
||||||
|
@ -5333,4 +5337,4 @@
|
||||||
- Wrote replacements for strlcpy and mkdtemp
|
- Wrote replacements for strlcpy and mkdtemp
|
||||||
- Released 1.0pre1
|
- Released 1.0pre1
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.1197 2001/05/04 22:38:43 mouring Exp $
|
$Id: ChangeLog,v 1.1198 2001/05/04 22:40:28 mouring Exp $
|
||||||
|
|
15
channels.c
15
channels.c
|
@ -40,7 +40,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: channels.c,v 1.111 2001/05/03 15:07:39 stevesk Exp $");
|
RCSID("$OpenBSD: channels.c,v 1.112 2001/05/04 14:34:34 markus Exp $");
|
||||||
|
|
||||||
#include <openssl/rsa.h>
|
#include <openssl/rsa.h>
|
||||||
#include <openssl/dsa.h>
|
#include <openssl/dsa.h>
|
||||||
|
@ -657,7 +657,7 @@ void
|
||||||
channel_post_x11_listener(Channel *c, fd_set * readset, fd_set * writeset)
|
channel_post_x11_listener(Channel *c, fd_set * readset, fd_set * writeset)
|
||||||
{
|
{
|
||||||
struct sockaddr addr;
|
struct sockaddr addr;
|
||||||
int newsock, newch;
|
int newsock, newch, oldch;
|
||||||
socklen_t addrlen;
|
socklen_t addrlen;
|
||||||
char buf[16384], *remote_ipaddr;
|
char buf[16384], *remote_ipaddr;
|
||||||
int remote_port;
|
int remote_port;
|
||||||
|
@ -675,10 +675,12 @@ channel_post_x11_listener(Channel *c, fd_set * readset, fd_set * writeset)
|
||||||
snprintf(buf, sizeof buf, "X11 connection from %.200s port %d",
|
snprintf(buf, sizeof buf, "X11 connection from %.200s port %d",
|
||||||
remote_ipaddr, remote_port);
|
remote_ipaddr, remote_port);
|
||||||
|
|
||||||
|
oldch = c->self;
|
||||||
newch = channel_new("x11",
|
newch = channel_new("x11",
|
||||||
SSH_CHANNEL_OPENING, newsock, newsock, -1,
|
SSH_CHANNEL_OPENING, newsock, newsock, -1,
|
||||||
c->local_window_max, c->local_maxpacket,
|
c->local_window_max, c->local_maxpacket,
|
||||||
0, xstrdup(buf), 1);
|
0, xstrdup(buf), 1);
|
||||||
|
c = channel_lookup(oldch);
|
||||||
if (compat20) {
|
if (compat20) {
|
||||||
packet_start(SSH2_MSG_CHANNEL_OPEN);
|
packet_start(SSH2_MSG_CHANNEL_OPEN);
|
||||||
packet_put_cstring("x11");
|
packet_put_cstring("x11");
|
||||||
|
@ -762,7 +764,7 @@ channel_post_port_listener(Channel *c, fd_set * readset, fd_set * writeset)
|
||||||
{
|
{
|
||||||
Channel *nc;
|
Channel *nc;
|
||||||
struct sockaddr addr;
|
struct sockaddr addr;
|
||||||
int newsock, newch, nextstate;
|
int newsock, newch, nextstate, oldch;
|
||||||
socklen_t addrlen;
|
socklen_t addrlen;
|
||||||
char *rtype;
|
char *rtype;
|
||||||
|
|
||||||
|
@ -782,11 +784,13 @@ channel_post_port_listener(Channel *c, fd_set * readset, fd_set * writeset)
|
||||||
error("accept: %.100s", strerror(errno));
|
error("accept: %.100s", strerror(errno));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
oldch = c->self;
|
||||||
newch = channel_new(rtype,
|
newch = channel_new(rtype,
|
||||||
nextstate, newsock, newsock, -1,
|
nextstate, newsock, newsock, -1,
|
||||||
c->local_window_max, c->local_maxpacket,
|
c->local_window_max, c->local_maxpacket,
|
||||||
0, xstrdup(rtype), 1);
|
0, xstrdup(rtype), 1);
|
||||||
|
|
||||||
|
c = channel_lookup(oldch);
|
||||||
nc = channel_lookup(newch);
|
nc = channel_lookup(newch);
|
||||||
if (nc == NULL) {
|
if (nc == NULL) {
|
||||||
error("xxx: no new channel:");
|
error("xxx: no new channel:");
|
||||||
|
@ -809,7 +813,7 @@ void
|
||||||
channel_post_auth_listener(Channel *c, fd_set * readset, fd_set * writeset)
|
channel_post_auth_listener(Channel *c, fd_set * readset, fd_set * writeset)
|
||||||
{
|
{
|
||||||
struct sockaddr addr;
|
struct sockaddr addr;
|
||||||
int newsock, newch;
|
int newsock, newch, oldch;
|
||||||
socklen_t addrlen;
|
socklen_t addrlen;
|
||||||
|
|
||||||
if (FD_ISSET(c->sock, readset)) {
|
if (FD_ISSET(c->sock, readset)) {
|
||||||
|
@ -819,10 +823,12 @@ channel_post_auth_listener(Channel *c, fd_set * readset, fd_set * writeset)
|
||||||
error("accept from auth socket: %.100s", strerror(errno));
|
error("accept from auth socket: %.100s", strerror(errno));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
oldch = c->self;
|
||||||
newch = channel_new("accepted auth socket",
|
newch = channel_new("accepted auth socket",
|
||||||
SSH_CHANNEL_OPENING, newsock, newsock, -1,
|
SSH_CHANNEL_OPENING, newsock, newsock, -1,
|
||||||
c->local_window_max, c->local_maxpacket,
|
c->local_window_max, c->local_maxpacket,
|
||||||
0, xstrdup("accepted auth socket"), 1);
|
0, xstrdup("accepted auth socket"), 1);
|
||||||
|
c = channel_lookup(oldch);
|
||||||
if (compat20) {
|
if (compat20) {
|
||||||
packet_start(SSH2_MSG_CHANNEL_OPEN);
|
packet_start(SSH2_MSG_CHANNEL_OPEN);
|
||||||
packet_put_cstring("auth-agent@openssh.com");
|
packet_put_cstring("auth-agent@openssh.com");
|
||||||
|
@ -1138,6 +1144,7 @@ channel_handler(chan_fn *ftab[], fd_set * readset, fd_set * writeset)
|
||||||
if (ftab[c->type] == NULL)
|
if (ftab[c->type] == NULL)
|
||||||
continue;
|
continue;
|
||||||
(*ftab[c->type])(c, readset, writeset);
|
(*ftab[c->type])(c, readset, writeset);
|
||||||
|
c = &channels[i]; /* XXX realloc */
|
||||||
if (chan_is_dead(c)) {
|
if (chan_is_dead(c)) {
|
||||||
/*
|
/*
|
||||||
* we have to remove the fd's from the select mask
|
* we have to remove the fd's from the select mask
|
||||||
|
|
Loading…
Reference in New Issue