diff options
author | Damien Miller <djm@mindrot.org> | 2000-04-30 10:00:53 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2000-04-30 10:00:53 +1000 |
commit | bd483e76909905f28d1604125f70c7cf8271f66e (patch) | |
tree | 4363a925d1f530b444c5726601ecf9efc684c218 /clientloop.c | |
parent | c998f9eb7cfb3bfef8c78b0a47bdb6db29a871e8 (diff) |
- More OpenBSD updates:
[session.c]
- don't call chan_write_failed() if we are not writing
[auth-rsa.c auth1.c authfd.c hostfile.c ssh-agent.c]
- keysize warnings error() -> log()
Diffstat (limited to 'clientloop.c')
-rw-r--r-- | clientloop.c | 67 |
1 files changed, 65 insertions, 2 deletions
diff --git a/clientloop.c b/clientloop.c index 0296dac77..0ee9fc32a 100644 --- a/clientloop.c +++ b/clientloop.c | |||
@@ -16,7 +16,7 @@ | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include "includes.h" | 18 | #include "includes.h" |
19 | RCSID("$Id: clientloop.c,v 1.12 2000/04/19 21:42:21 damien Exp $"); | 19 | RCSID("$Id: clientloop.c,v 1.13 2000/04/30 00:00:54 damien Exp $"); |
20 | 20 | ||
21 | #include "xmalloc.h" | 21 | #include "xmalloc.h" |
22 | #include "ssh.h" | 22 | #include "ssh.h" |
@@ -954,6 +954,69 @@ client_input_exit_status(int type, int plen) | |||
954 | quit_pending = 1; | 954 | quit_pending = 1; |
955 | } | 955 | } |
956 | 956 | ||
957 | /* XXXX move to generic input handler */ | ||
958 | void | ||
959 | client_input_channel_open(int type, int plen) | ||
960 | { | ||
961 | Channel *c = NULL; | ||
962 | char *ctype; | ||
963 | int id; | ||
964 | unsigned int len; | ||
965 | int rchan; | ||
966 | int rmaxpack; | ||
967 | int rwindow; | ||
968 | |||
969 | ctype = packet_get_string(&len); | ||
970 | rchan = packet_get_int(); | ||
971 | rwindow = packet_get_int(); | ||
972 | rmaxpack = packet_get_int(); | ||
973 | |||
974 | log("server_input_open: ctype %s rchan %d win %d max %d", | ||
975 | ctype, rchan, rwindow, rmaxpack); | ||
976 | |||
977 | if (strcmp(ctype, "x11") == 0) { | ||
978 | int sock; | ||
979 | char *originator; | ||
980 | int originator_port; | ||
981 | originator = packet_get_string(NULL); | ||
982 | originator_port = packet_get_int(); | ||
983 | packet_done(); | ||
984 | /* XXX check permission */ | ||
985 | xfree(originator); | ||
986 | /* XXX move to channels.c */ | ||
987 | sock = x11_connect_display(); | ||
988 | if (sock >= 0) { | ||
989 | id = channel_new("x11", SSH_CHANNEL_X11_OPEN, | ||
990 | sock, sock, -1, 4*1024, 32*1024, 0, | ||
991 | xstrdup("x11")); | ||
992 | c = channel_lookup(id); | ||
993 | } | ||
994 | } | ||
995 | /* XXX duplicate : */ | ||
996 | if (c != NULL) { | ||
997 | debug("confirm %s", ctype); | ||
998 | c->remote_id = rchan; | ||
999 | c->remote_window = rwindow; | ||
1000 | c->remote_maxpacket = rmaxpack; | ||
1001 | |||
1002 | packet_start(SSH2_MSG_CHANNEL_OPEN_CONFIRMATION); | ||
1003 | packet_put_int(c->remote_id); | ||
1004 | packet_put_int(c->self); | ||
1005 | packet_put_int(c->local_window); | ||
1006 | packet_put_int(c->local_maxpacket); | ||
1007 | packet_send(); | ||
1008 | } else { | ||
1009 | debug("failure %s", ctype); | ||
1010 | packet_start(SSH2_MSG_CHANNEL_OPEN_FAILURE); | ||
1011 | packet_put_int(rchan); | ||
1012 | packet_put_int(SSH2_OPEN_ADMINISTRATIVELY_PROHIBITED); | ||
1013 | packet_put_cstring("bla bla"); | ||
1014 | packet_put_cstring(""); | ||
1015 | packet_send(); | ||
1016 | } | ||
1017 | xfree(ctype); | ||
1018 | } | ||
1019 | |||
957 | void | 1020 | void |
958 | client_init_dispatch_20() | 1021 | client_init_dispatch_20() |
959 | { | 1022 | { |
@@ -962,6 +1025,7 @@ client_init_dispatch_20() | |||
962 | dispatch_set(SSH2_MSG_CHANNEL_DATA, &channel_input_data); | 1025 | dispatch_set(SSH2_MSG_CHANNEL_DATA, &channel_input_data); |
963 | dispatch_set(SSH2_MSG_CHANNEL_EOF, &channel_input_ieof); | 1026 | dispatch_set(SSH2_MSG_CHANNEL_EOF, &channel_input_ieof); |
964 | dispatch_set(SSH2_MSG_CHANNEL_EXTENDED_DATA, &channel_input_extended_data); | 1027 | dispatch_set(SSH2_MSG_CHANNEL_EXTENDED_DATA, &channel_input_extended_data); |
1028 | dispatch_set(SSH2_MSG_CHANNEL_OPEN, &client_input_channel_open); | ||
965 | dispatch_set(SSH2_MSG_CHANNEL_OPEN_CONFIRMATION, &channel_input_open_confirmation); | 1029 | dispatch_set(SSH2_MSG_CHANNEL_OPEN_CONFIRMATION, &channel_input_open_confirmation); |
966 | dispatch_set(SSH2_MSG_CHANNEL_OPEN_FAILURE, &channel_input_open_failure); | 1030 | dispatch_set(SSH2_MSG_CHANNEL_OPEN_FAILURE, &channel_input_open_failure); |
967 | dispatch_set(SSH2_MSG_CHANNEL_REQUEST, &channel_input_channel_request); | 1031 | dispatch_set(SSH2_MSG_CHANNEL_REQUEST, &channel_input_channel_request); |
@@ -974,7 +1038,6 @@ client_init_dispatch_13() | |||
974 | dispatch_set(SSH_MSG_CHANNEL_CLOSE, &channel_input_close); | 1038 | dispatch_set(SSH_MSG_CHANNEL_CLOSE, &channel_input_close); |
975 | dispatch_set(SSH_MSG_CHANNEL_CLOSE_CONFIRMATION, &channel_input_close_confirmation); | 1039 | dispatch_set(SSH_MSG_CHANNEL_CLOSE_CONFIRMATION, &channel_input_close_confirmation); |
976 | dispatch_set(SSH_MSG_CHANNEL_DATA, &channel_input_data); | 1040 | dispatch_set(SSH_MSG_CHANNEL_DATA, &channel_input_data); |
977 | dispatch_set(SSH_MSG_CHANNEL_DATA, &channel_input_data); | ||
978 | dispatch_set(SSH_MSG_CHANNEL_OPEN_CONFIRMATION, &channel_input_open_confirmation); | 1041 | dispatch_set(SSH_MSG_CHANNEL_OPEN_CONFIRMATION, &channel_input_open_confirmation); |
979 | dispatch_set(SSH_MSG_CHANNEL_OPEN_FAILURE, &channel_input_open_failure); | 1042 | dispatch_set(SSH_MSG_CHANNEL_OPEN_FAILURE, &channel_input_open_failure); |
980 | dispatch_set(SSH_MSG_PORT_OPEN, &channel_input_port_open); | 1043 | dispatch_set(SSH_MSG_PORT_OPEN, &channel_input_port_open); |