summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--channels.c48
-rw-r--r--channels.h5
-rw-r--r--clientloop.c4
-rw-r--r--serverloop.c4
-rw-r--r--sshd.c8
6 files changed, 67 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 77f228707..6d5531376 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
120001206
2 - (bal) OpenSSH CVS updates:
3 - markus@cvs.openbsd.org 2000/12/05 20:34:09
4 [channels.c channels.h clientloop.c serverloop.c]
5 async connects for -R/-L; ok deraadt@
6 - todd@cvs.openssh.org 2000/12/05 16:47:28
7 [sshd.c]
8 tweak comment to reflect real location of pid file; ok provos@
9
120001205 1020001205
2 - (bal) OpenSSH CVS updates: 11 - (bal) OpenSSH CVS updates:
3 - markus@cvs.openbsd.org 2000/12/04 19:24:02 12 - markus@cvs.openbsd.org 2000/12/04 19:24:02
@@ -16,7 +25,8 @@
16 remove fallback to SSH_BUG_HMAC now that the drafts are updated 25 remove fallback to SSH_BUG_HMAC now that the drafts are updated
17 - markus@cvs.openbsd.org 2000/12/03 11:27:55 26 - markus@cvs.openbsd.org 2000/12/03 11:27:55
18 [compat.c] 27 [compat.c]
19 correctly match "2.1.0.pl2 SSH" etc; from pekkas@netcore.fi/bugzilla.redhat 28 correctly match "2.1.0.pl2 SSH" etc; from
29 pekkas@netcore.fi/bugzilla.redhat
20 - markus@cvs.openbsd.org 2000/12/03 11:15:03 30 - markus@cvs.openbsd.org 2000/12/03 11:15:03
21 [auth2.c compat.c compat.h sshconnect2.c] 31 [auth2.c compat.c compat.h sshconnect2.c]
22 support f-secure/ssh.com 2.0.12; ok niels@ 32 support f-secure/ssh.com 2.0.12; ok niels@
diff --git a/channels.c b/channels.c
index 91a1b50c3..49023a278 100644
--- a/channels.c
+++ b/channels.c
@@ -40,7 +40,7 @@
40 */ 40 */
41 41
42#include "includes.h" 42#include "includes.h"
43RCSID("$OpenBSD: channels.c,v 1.74 2000/11/30 22:54:31 markus Exp $"); 43RCSID("$OpenBSD: channels.c,v 1.75 2000/12/05 20:34:09 markus Exp $");
44 44
45#include "ssh.h" 45#include "ssh.h"
46#include "packet.h" 46#include "packet.h"
@@ -346,6 +346,13 @@ channel_pre_listener(Channel *c, fd_set * readset, fd_set * writeset)
346} 346}
347 347
348void 348void
349channel_pre_connecting(Channel *c, fd_set * readset, fd_set * writeset)
350{
351 debug3("channel %d: waiting for connection", c->self);
352 FD_SET(c->sock, writeset);
353}
354
355void
349channel_pre_open_13(Channel *c, fd_set * readset, fd_set * writeset) 356channel_pre_open_13(Channel *c, fd_set * readset, fd_set * writeset)
350{ 357{
351 if (buffer_len(&c->input) < packet_get_maxsize()) 358 if (buffer_len(&c->input) < packet_get_maxsize())
@@ -685,6 +692,28 @@ channel_post_auth_listener(Channel *c, fd_set * readset, fd_set * writeset)
685 } 692 }
686} 693}
687 694
695void
696channel_post_connecting(Channel *c, fd_set * readset, fd_set * writeset)
697{
698 if (FD_ISSET(c->sock, writeset)) {
699 int err = 0;
700 int sz = sizeof(err);
701 c->type = SSH_CHANNEL_OPEN;
702 if (getsockopt(c->sock, SOL_SOCKET, SO_ERROR, (char *)&err, &sz) < 0) {
703 debug("getsockopt SO_ERROR failed");
704 } else {
705 if (err == 0) {
706 debug("channel %d: connected)", c->self);
707 } else {
708 debug("channel %d: not connected: %s",
709 c->self, strerror(err));
710 chan_read_failed(c);
711 chan_write_failed(c);
712 }
713 }
714 }
715}
716
688int 717int
689channel_handle_rfd(Channel *c, fd_set * readset, fd_set * writeset) 718channel_handle_rfd(Channel *c, fd_set * readset, fd_set * writeset)
690{ 719{
@@ -843,12 +872,14 @@ channel_handler_init_20(void)
843 channel_pre[SSH_CHANNEL_RPORT_LISTENER] = &channel_pre_listener; 872 channel_pre[SSH_CHANNEL_RPORT_LISTENER] = &channel_pre_listener;
844 channel_pre[SSH_CHANNEL_X11_LISTENER] = &channel_pre_listener; 873 channel_pre[SSH_CHANNEL_X11_LISTENER] = &channel_pre_listener;
845 channel_pre[SSH_CHANNEL_AUTH_SOCKET] = &channel_pre_listener; 874 channel_pre[SSH_CHANNEL_AUTH_SOCKET] = &channel_pre_listener;
875 channel_pre[SSH_CHANNEL_CONNECTING] = &channel_pre_connecting;
846 876
847 channel_post[SSH_CHANNEL_OPEN] = &channel_post_open_2; 877 channel_post[SSH_CHANNEL_OPEN] = &channel_post_open_2;
848 channel_post[SSH_CHANNEL_PORT_LISTENER] = &channel_post_port_listener; 878 channel_post[SSH_CHANNEL_PORT_LISTENER] = &channel_post_port_listener;
849 channel_post[SSH_CHANNEL_RPORT_LISTENER] = &channel_post_port_listener; 879 channel_post[SSH_CHANNEL_RPORT_LISTENER] = &channel_post_port_listener;
850 channel_post[SSH_CHANNEL_X11_LISTENER] = &channel_post_x11_listener; 880 channel_post[SSH_CHANNEL_X11_LISTENER] = &channel_post_x11_listener;
851 channel_post[SSH_CHANNEL_AUTH_SOCKET] = &channel_post_auth_listener; 881 channel_post[SSH_CHANNEL_AUTH_SOCKET] = &channel_post_auth_listener;
882 channel_post[SSH_CHANNEL_CONNECTING] = &channel_post_connecting;
852} 883}
853 884
854void 885void
@@ -861,12 +892,14 @@ channel_handler_init_13(void)
861 channel_pre[SSH_CHANNEL_AUTH_SOCKET] = &channel_pre_listener; 892 channel_pre[SSH_CHANNEL_AUTH_SOCKET] = &channel_pre_listener;
862 channel_pre[SSH_CHANNEL_INPUT_DRAINING] = &channel_pre_input_draining; 893 channel_pre[SSH_CHANNEL_INPUT_DRAINING] = &channel_pre_input_draining;
863 channel_pre[SSH_CHANNEL_OUTPUT_DRAINING] = &channel_pre_output_draining; 894 channel_pre[SSH_CHANNEL_OUTPUT_DRAINING] = &channel_pre_output_draining;
895 channel_pre[SSH_CHANNEL_CONNECTING] = &channel_pre_connecting;
864 896
865 channel_post[SSH_CHANNEL_OPEN] = &channel_post_open_1; 897 channel_post[SSH_CHANNEL_OPEN] = &channel_post_open_1;
866 channel_post[SSH_CHANNEL_X11_LISTENER] = &channel_post_x11_listener; 898 channel_post[SSH_CHANNEL_X11_LISTENER] = &channel_post_x11_listener;
867 channel_post[SSH_CHANNEL_PORT_LISTENER] = &channel_post_port_listener; 899 channel_post[SSH_CHANNEL_PORT_LISTENER] = &channel_post_port_listener;
868 channel_post[SSH_CHANNEL_AUTH_SOCKET] = &channel_post_auth_listener; 900 channel_post[SSH_CHANNEL_AUTH_SOCKET] = &channel_post_auth_listener;
869 channel_post[SSH_CHANNEL_OUTPUT_DRAINING] = &channel_post_output_drain_13; 901 channel_post[SSH_CHANNEL_OUTPUT_DRAINING] = &channel_post_output_drain_13;
902 channel_post[SSH_CHANNEL_CONNECTING] = &channel_post_connecting;
870} 903}
871 904
872void 905void
@@ -877,11 +910,13 @@ channel_handler_init_15(void)
877 channel_pre[SSH_CHANNEL_X11_LISTENER] = &channel_pre_listener; 910 channel_pre[SSH_CHANNEL_X11_LISTENER] = &channel_pre_listener;
878 channel_pre[SSH_CHANNEL_PORT_LISTENER] = &channel_pre_listener; 911 channel_pre[SSH_CHANNEL_PORT_LISTENER] = &channel_pre_listener;
879 channel_pre[SSH_CHANNEL_AUTH_SOCKET] = &channel_pre_listener; 912 channel_pre[SSH_CHANNEL_AUTH_SOCKET] = &channel_pre_listener;
913 channel_pre[SSH_CHANNEL_CONNECTING] = &channel_pre_connecting;
880 914
881 channel_post[SSH_CHANNEL_X11_LISTENER] = &channel_post_x11_listener; 915 channel_post[SSH_CHANNEL_X11_LISTENER] = &channel_post_x11_listener;
882 channel_post[SSH_CHANNEL_PORT_LISTENER] = &channel_post_port_listener; 916 channel_post[SSH_CHANNEL_PORT_LISTENER] = &channel_post_port_listener;
883 channel_post[SSH_CHANNEL_AUTH_SOCKET] = &channel_post_auth_listener; 917 channel_post[SSH_CHANNEL_AUTH_SOCKET] = &channel_post_auth_listener;
884 channel_post[SSH_CHANNEL_OPEN] = &channel_post_open_1; 918 channel_post[SSH_CHANNEL_OPEN] = &channel_post_open_1;
919 channel_post[SSH_CHANNEL_CONNECTING] = &channel_post_connecting;
885} 920}
886 921
887void 922void
@@ -1397,6 +1432,7 @@ channel_still_open()
1397 case SSH_CHANNEL_RPORT_LISTENER: 1432 case SSH_CHANNEL_RPORT_LISTENER:
1398 case SSH_CHANNEL_CLOSED: 1433 case SSH_CHANNEL_CLOSED:
1399 case SSH_CHANNEL_AUTH_SOCKET: 1434 case SSH_CHANNEL_AUTH_SOCKET:
1435 case SSH_CHANNEL_CONNECTING: /* XXX ??? */
1400 continue; 1436 continue;
1401 case SSH_CHANNEL_LARVAL: 1437 case SSH_CHANNEL_LARVAL:
1402 if (!compat20) 1438 if (!compat20)
@@ -1446,6 +1482,7 @@ channel_open_message()
1446 continue; 1482 continue;
1447 case SSH_CHANNEL_LARVAL: 1483 case SSH_CHANNEL_LARVAL:
1448 case SSH_CHANNEL_OPENING: 1484 case SSH_CHANNEL_OPENING:
1485 case SSH_CHANNEL_CONNECTING:
1449 case SSH_CHANNEL_OPEN: 1486 case SSH_CHANNEL_OPEN:
1450 case SSH_CHANNEL_X11_OPEN: 1487 case SSH_CHANNEL_X11_OPEN:
1451 case SSH_CHANNEL_INPUT_DRAINING: 1488 case SSH_CHANNEL_INPUT_DRAINING:
@@ -1702,8 +1739,11 @@ channel_connect_to(const char *host, u_short host_port)
1702 error("socket: %.100s", strerror(errno)); 1739 error("socket: %.100s", strerror(errno));
1703 continue; 1740 continue;
1704 } 1741 }
1742 if (fcntl(sock, F_SETFL, O_NDELAY) < 0)
1743 fatal("connect_to: F_SETFL: %s", strerror(errno));
1705 /* Connect to the host/port. */ 1744 /* Connect to the host/port. */
1706 if (connect(sock, ai->ai_addr, ai->ai_addrlen) < 0) { 1745 if (connect(sock, ai->ai_addr, ai->ai_addrlen) < 0 &&
1746 errno != EINPROGRESS) {
1707 error("connect %.100s port %s: %.100s", ntop, strport, 1747 error("connect %.100s port %s: %.100s", ntop, strport,
1708 strerror(errno)); 1748 strerror(errno));
1709 close(sock); 1749 close(sock);
@@ -1789,7 +1829,9 @@ channel_input_port_open(int type, int plen, void *ctxt)
1789 sock = denied ? -1 : channel_connect_to(host, host_port); 1829 sock = denied ? -1 : channel_connect_to(host, host_port);
1790 if (sock > 0) { 1830 if (sock > 0) {
1791 /* Allocate a channel for this connection. */ 1831 /* Allocate a channel for this connection. */
1792 newch = channel_allocate(SSH_CHANNEL_OPEN, sock, originator_string); 1832 newch = channel_allocate(SSH_CHANNEL_CONNECTING,
1833 sock, originator_string);
1834/*XXX delay answer? */
1793 channels[newch].remote_id = remote_channel; 1835 channels[newch].remote_id = remote_channel;
1794 1836
1795 packet_start(SSH_MSG_CHANNEL_OPEN_CONFIRMATION); 1837 packet_start(SSH_MSG_CHANNEL_OPEN_CONFIRMATION);
diff --git a/channels.h b/channels.h
index 8f5e987fc..45b783fb3 100644
--- a/channels.h
+++ b/channels.h
@@ -32,7 +32,7 @@
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */ 34 */
35/* RCSID("$OpenBSD: channels.h,v 1.23 2000/11/06 23:04:56 markus Exp $"); */ 35/* RCSID("$OpenBSD: channels.h,v 1.24 2000/12/05 20:34:10 markus Exp $"); */
36 36
37#ifndef CHANNELS_H 37#ifndef CHANNELS_H
38#define CHANNELS_H 38#define CHANNELS_H
@@ -50,7 +50,8 @@
50#define SSH_CHANNEL_OUTPUT_DRAINING 9 /* sending remaining data to app */ 50#define SSH_CHANNEL_OUTPUT_DRAINING 9 /* sending remaining data to app */
51#define SSH_CHANNEL_LARVAL 10 /* larval session */ 51#define SSH_CHANNEL_LARVAL 10 /* larval session */
52#define SSH_CHANNEL_RPORT_LISTENER 11 /* Listening to a R-style port */ 52#define SSH_CHANNEL_RPORT_LISTENER 11 /* Listening to a R-style port */
53#define SSH_CHANNEL_MAX_TYPE 12 53#define SSH_CHANNEL_CONNECTING 12
54#define SSH_CHANNEL_MAX_TYPE 13
54 55
55/* 56/*
56 * Data structure for channel data. This is iniailized in channel_allocate 57 * Data structure for channel data. This is iniailized in channel_allocate
diff --git a/clientloop.c b/clientloop.c
index 8f16d2fb9..3a0f977b0 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -59,7 +59,7 @@
59 */ 59 */
60 60
61#include "includes.h" 61#include "includes.h"
62RCSID("$OpenBSD: clientloop.c,v 1.40 2000/11/06 23:04:56 markus Exp $"); 62RCSID("$OpenBSD: clientloop.c,v 1.41 2000/12/05 20:34:10 markus Exp $");
63 63
64#include "xmalloc.h" 64#include "xmalloc.h"
65#include "ssh.h" 65#include "ssh.h"
@@ -1041,7 +1041,7 @@ client_request_forwarded_tcpip(const char *request_type, int rchan)
1041 sock = channel_connect_by_listen_adress(listen_port); 1041 sock = channel_connect_by_listen_adress(listen_port);
1042 if (sock >= 0) { 1042 if (sock >= 0) {
1043 newch = channel_new("forwarded-tcpip", 1043 newch = channel_new("forwarded-tcpip",
1044 SSH_CHANNEL_OPEN, sock, sock, -1, 1044 SSH_CHANNEL_CONNECTING, sock, sock, -1,
1045 CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_WINDOW_DEFAULT, 0, 1045 CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_WINDOW_DEFAULT, 0,
1046 xstrdup(originator_address), 1); 1046 xstrdup(originator_address), 1);
1047 c = channel_lookup(newch); 1047 c = channel_lookup(newch);
diff --git a/serverloop.c b/serverloop.c
index d1816b52c..79ef3607b 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -35,7 +35,7 @@
35 */ 35 */
36 36
37#include "includes.h" 37#include "includes.h"
38RCSID("$OpenBSD: serverloop.c,v 1.35 2000/11/06 23:04:56 markus Exp $"); 38RCSID("$OpenBSD: serverloop.c,v 1.36 2000/12/05 20:34:10 markus Exp $");
39 39
40#include "xmalloc.h" 40#include "xmalloc.h"
41#include "ssh.h" 41#include "ssh.h"
@@ -750,7 +750,7 @@ server_request_direct_tcpip(char *ctype)
750 xfree(originator); 750 xfree(originator);
751 if (sock < 0) 751 if (sock < 0)
752 return NULL; 752 return NULL;
753 newch = channel_new(ctype, SSH_CHANNEL_OPEN, 753 newch = channel_new(ctype, SSH_CHANNEL_CONNECTING,
754 sock, sock, -1, CHAN_TCP_WINDOW_DEFAULT, 754 sock, sock, -1, CHAN_TCP_WINDOW_DEFAULT,
755 CHAN_TCP_PACKET_DEFAULT, 0, xstrdup("direct-tcpip"), 1); 755 CHAN_TCP_PACKET_DEFAULT, 0, xstrdup("direct-tcpip"), 1);
756 return (newch >= 0) ? channel_lookup(newch) : NULL; 756 return (newch >= 0) ? channel_lookup(newch) : NULL;
diff --git a/sshd.c b/sshd.c
index 4a01ebec7..4bd0cbe88 100644
--- a/sshd.c
+++ b/sshd.c
@@ -40,7 +40,7 @@
40 */ 40 */
41 41
42#include "includes.h" 42#include "includes.h"
43RCSID("$OpenBSD: sshd.c,v 1.135 2000/11/29 21:11:59 markus Exp $"); 43RCSID("$OpenBSD: sshd.c,v 1.136 2000/12/05 16:47:28 todd Exp $");
44 44
45#include "xmalloc.h" 45#include "xmalloc.h"
46#include "rsa.h" 46#include "rsa.h"
@@ -881,9 +881,9 @@ main(int ac, char **av)
881 881
882 if (!debug_flag) { 882 if (!debug_flag) {
883 /* 883 /*
884 * Record our pid in /etc/sshd_pid to make it easier 884 * Record our pid in /var/run/sshd.pid to make it
885 * to kill the correct sshd. We don\'t want to do 885 * easier to kill the correct sshd. We don't want to
886 * this before the bind above because the bind will 886 * do this before the bind above because the bind will
887 * fail if there already is a daemon, and this will 887 * fail if there already is a daemon, and this will
888 * overwrite any old pid in the file. 888 * overwrite any old pid in the file.
889 */ 889 */