diff options
author | Ben Lindstrom <mouring@eviladmin.org> | 2001-05-04 22:40:28 +0000 |
---|---|---|
committer | Ben Lindstrom <mouring@eviladmin.org> | 2001-05-04 22:40:28 +0000 |
commit | c8cb8c0405db1f83bd8f97224f69db6a828cc94f (patch) | |
tree | 3db817744971e29a326dc5d891cccca8f6307a93 | |
parent | f0609f8bd3fe50a1cde0c4eb55144dbdffbc56f2 (diff) |
- 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...
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | channels.c | 15 |
2 files changed, 16 insertions, 5 deletions
@@ -3,6 +3,10 @@ | |||
3 | - stevesk@cvs.openbsd.org 2001/05/04 14:21:56 | 3 | - stevesk@cvs.openbsd.org 2001/05/04 14:21:56 |
4 | [ssh.1 sshd.8] | 4 | [ssh.1 sshd.8] |
5 | typos | 5 | typos |
6 | - markus@cvs.openbsd.org 2001/05/04 14:34:34 | ||
7 | [channels.c] | ||
8 | channel_new() reallocs channels[], we cannot use Channel *c after calling | ||
9 | channel_new(), XXX fix this in the future... | ||
6 | 10 | ||
7 | 20010504 | 11 | 20010504 |
8 | - OpenBSD CVS Sync | 12 | - OpenBSD CVS Sync |
@@ -5333,4 +5337,4 @@ | |||
5333 | - Wrote replacements for strlcpy and mkdtemp | 5337 | - Wrote replacements for strlcpy and mkdtemp |
5334 | - Released 1.0pre1 | 5338 | - Released 1.0pre1 |
5335 | 5339 | ||
5336 | $Id: ChangeLog,v 1.1197 2001/05/04 22:38:43 mouring Exp $ | 5340 | $Id: ChangeLog,v 1.1198 2001/05/04 22:40:28 mouring Exp $ |
diff --git a/channels.c b/channels.c index 23ea98ead..503a81450 100644 --- a/channels.c +++ b/channels.c | |||
@@ -40,7 +40,7 @@ | |||
40 | */ | 40 | */ |
41 | 41 | ||
42 | #include "includes.h" | 42 | #include "includes.h" |
43 | RCSID("$OpenBSD: channels.c,v 1.111 2001/05/03 15:07:39 stevesk Exp $"); | 43 | RCSID("$OpenBSD: channels.c,v 1.112 2001/05/04 14:34:34 markus Exp $"); |
44 | 44 | ||
45 | #include <openssl/rsa.h> | 45 | #include <openssl/rsa.h> |
46 | #include <openssl/dsa.h> | 46 | #include <openssl/dsa.h> |
@@ -657,7 +657,7 @@ void | |||
657 | channel_post_x11_listener(Channel *c, fd_set * readset, fd_set * writeset) | 657 | channel_post_x11_listener(Channel *c, fd_set * readset, fd_set * writeset) |
658 | { | 658 | { |
659 | struct sockaddr addr; | 659 | struct sockaddr addr; |
660 | int newsock, newch; | 660 | int newsock, newch, oldch; |
661 | socklen_t addrlen; | 661 | socklen_t addrlen; |
662 | char buf[16384], *remote_ipaddr; | 662 | char buf[16384], *remote_ipaddr; |
663 | int remote_port; | 663 | int remote_port; |
@@ -675,10 +675,12 @@ channel_post_x11_listener(Channel *c, fd_set * readset, fd_set * writeset) | |||
675 | snprintf(buf, sizeof buf, "X11 connection from %.200s port %d", | 675 | snprintf(buf, sizeof buf, "X11 connection from %.200s port %d", |
676 | remote_ipaddr, remote_port); | 676 | remote_ipaddr, remote_port); |
677 | 677 | ||
678 | oldch = c->self; | ||
678 | newch = channel_new("x11", | 679 | newch = channel_new("x11", |
679 | SSH_CHANNEL_OPENING, newsock, newsock, -1, | 680 | SSH_CHANNEL_OPENING, newsock, newsock, -1, |
680 | c->local_window_max, c->local_maxpacket, | 681 | c->local_window_max, c->local_maxpacket, |
681 | 0, xstrdup(buf), 1); | 682 | 0, xstrdup(buf), 1); |
683 | c = channel_lookup(oldch); | ||
682 | if (compat20) { | 684 | if (compat20) { |
683 | packet_start(SSH2_MSG_CHANNEL_OPEN); | 685 | packet_start(SSH2_MSG_CHANNEL_OPEN); |
684 | packet_put_cstring("x11"); | 686 | packet_put_cstring("x11"); |
@@ -762,7 +764,7 @@ channel_post_port_listener(Channel *c, fd_set * readset, fd_set * writeset) | |||
762 | { | 764 | { |
763 | Channel *nc; | 765 | Channel *nc; |
764 | struct sockaddr addr; | 766 | struct sockaddr addr; |
765 | int newsock, newch, nextstate; | 767 | int newsock, newch, nextstate, oldch; |
766 | socklen_t addrlen; | 768 | socklen_t addrlen; |
767 | char *rtype; | 769 | char *rtype; |
768 | 770 | ||
@@ -782,11 +784,13 @@ channel_post_port_listener(Channel *c, fd_set * readset, fd_set * writeset) | |||
782 | error("accept: %.100s", strerror(errno)); | 784 | error("accept: %.100s", strerror(errno)); |
783 | return; | 785 | return; |
784 | } | 786 | } |
787 | oldch = c->self; | ||
785 | newch = channel_new(rtype, | 788 | newch = channel_new(rtype, |
786 | nextstate, newsock, newsock, -1, | 789 | nextstate, newsock, newsock, -1, |
787 | c->local_window_max, c->local_maxpacket, | 790 | c->local_window_max, c->local_maxpacket, |
788 | 0, xstrdup(rtype), 1); | 791 | 0, xstrdup(rtype), 1); |
789 | 792 | ||
793 | c = channel_lookup(oldch); | ||
790 | nc = channel_lookup(newch); | 794 | nc = channel_lookup(newch); |
791 | if (nc == NULL) { | 795 | if (nc == NULL) { |
792 | error("xxx: no new channel:"); | 796 | error("xxx: no new channel:"); |
@@ -809,7 +813,7 @@ void | |||
809 | channel_post_auth_listener(Channel *c, fd_set * readset, fd_set * writeset) | 813 | channel_post_auth_listener(Channel *c, fd_set * readset, fd_set * writeset) |
810 | { | 814 | { |
811 | struct sockaddr addr; | 815 | struct sockaddr addr; |
812 | int newsock, newch; | 816 | int newsock, newch, oldch; |
813 | socklen_t addrlen; | 817 | socklen_t addrlen; |
814 | 818 | ||
815 | if (FD_ISSET(c->sock, readset)) { | 819 | if (FD_ISSET(c->sock, readset)) { |
@@ -819,10 +823,12 @@ channel_post_auth_listener(Channel *c, fd_set * readset, fd_set * writeset) | |||
819 | error("accept from auth socket: %.100s", strerror(errno)); | 823 | error("accept from auth socket: %.100s", strerror(errno)); |
820 | return; | 824 | return; |
821 | } | 825 | } |
826 | oldch = c->self; | ||
822 | newch = channel_new("accepted auth socket", | 827 | newch = channel_new("accepted auth socket", |
823 | SSH_CHANNEL_OPENING, newsock, newsock, -1, | 828 | SSH_CHANNEL_OPENING, newsock, newsock, -1, |
824 | c->local_window_max, c->local_maxpacket, | 829 | c->local_window_max, c->local_maxpacket, |
825 | 0, xstrdup("accepted auth socket"), 1); | 830 | 0, xstrdup("accepted auth socket"), 1); |
831 | c = channel_lookup(oldch); | ||
826 | if (compat20) { | 832 | if (compat20) { |
827 | packet_start(SSH2_MSG_CHANNEL_OPEN); | 833 | packet_start(SSH2_MSG_CHANNEL_OPEN); |
828 | packet_put_cstring("auth-agent@openssh.com"); | 834 | packet_put_cstring("auth-agent@openssh.com"); |
@@ -1138,6 +1144,7 @@ channel_handler(chan_fn *ftab[], fd_set * readset, fd_set * writeset) | |||
1138 | if (ftab[c->type] == NULL) | 1144 | if (ftab[c->type] == NULL) |
1139 | continue; | 1145 | continue; |
1140 | (*ftab[c->type])(c, readset, writeset); | 1146 | (*ftab[c->type])(c, readset, writeset); |
1147 | c = &channels[i]; /* XXX realloc */ | ||
1141 | if (chan_is_dead(c)) { | 1148 | if (chan_is_dead(c)) { |
1142 | /* | 1149 | /* |
1143 | * we have to remove the fd's from the select mask | 1150 | * we have to remove the fd's from the select mask |