diff options
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | ssh.c | 29 |
2 files changed, 39 insertions, 4 deletions
@@ -31,6 +31,18 @@ | |||
31 | - more strict prototypes, include necessary headers | 31 | - more strict prototypes, include necessary headers |
32 | - use paths.h/pathnames.h decls | 32 | - use paths.h/pathnames.h decls |
33 | - size_t typecase to int -> u_long | 33 | - size_t typecase to int -> u_long |
34 | - markus@cvs.openbsd.org 2001/02/06 22:07:42 | ||
35 | [ssh.c] | ||
36 | fatal() if subsystem fails | ||
37 | - markus@cvs.openbsd.org 2001/02/06 22:43:02 | ||
38 | [ssh.c] | ||
39 | remove confusing callback code | ||
40 | - jakob@cvs.openbsd.org 2001/02/06 23:03:24 | ||
41 | [ssh.c] | ||
42 | add -1 option (force protocol version 1). ok markus@ | ||
43 | - jakob@cvs.openbsd.org 2001/02/06 23:06:21 | ||
44 | [ssh.c] | ||
45 | reorder -{1,2,4,6} options. ok markus@ | ||
34 | - (bal) Missing 'const' in readpass.h | 46 | - (bal) Missing 'const' in readpass.h |
35 | 47 | ||
36 | 20010208 | 48 | 20010208 |
@@ -3685,4 +3697,4 @@ | |||
3685 | - Wrote replacements for strlcpy and mkdtemp | 3697 | - Wrote replacements for strlcpy and mkdtemp |
3686 | - Released 1.0pre1 | 3698 | - Released 1.0pre1 |
3687 | 3699 | ||
3688 | $Id: ChangeLog,v 1.706 2001/02/09 02:23:10 mouring Exp $ | 3700 | $Id: ChangeLog,v 1.707 2001/02/09 02:36:43 mouring Exp $ |
@@ -63,6 +63,7 @@ RCSID("$OpenBSD: ssh.c,v 1.93 2001/02/08 19:30:52 itojun Exp $"); | |||
63 | #include "readconf.h" | 63 | #include "readconf.h" |
64 | #include "sshconnect.h" | 64 | #include "sshconnect.h" |
65 | #include "tildexpand.h" | 65 | #include "tildexpand.h" |
66 | #include "dispatch.h" | ||
66 | #include "misc.h" | 67 | #include "misc.h" |
67 | 68 | ||
68 | #ifdef HAVE___PROGNAME | 69 | #ifdef HAVE___PROGNAME |
@@ -180,9 +181,10 @@ usage(void) | |||
180 | fprintf(stderr, " -C Enable compression.\n"); | 181 | fprintf(stderr, " -C Enable compression.\n"); |
181 | fprintf(stderr, " -N Do not execute a shell or command.\n"); | 182 | fprintf(stderr, " -N Do not execute a shell or command.\n"); |
182 | fprintf(stderr, " -g Allow remote hosts to connect to forwarded ports.\n"); | 183 | fprintf(stderr, " -g Allow remote hosts to connect to forwarded ports.\n"); |
184 | fprintf(stderr, " -1 Force protocol version 1.\n"); | ||
185 | fprintf(stderr, " -2 Force protocol version 2.\n"); | ||
183 | fprintf(stderr, " -4 Use IPv4 only.\n"); | 186 | fprintf(stderr, " -4 Use IPv4 only.\n"); |
184 | fprintf(stderr, " -6 Use IPv6 only.\n"); | 187 | fprintf(stderr, " -6 Use IPv6 only.\n"); |
185 | fprintf(stderr, " -2 Force protocol version 2.\n"); | ||
186 | fprintf(stderr, " -o 'option' Process the option as if it was read from a configuration file.\n"); | 188 | fprintf(stderr, " -o 'option' Process the option as if it was read from a configuration file.\n"); |
187 | fprintf(stderr, " -s Invoke command (mandatory) as SSH2 subsystem.\n"); | 189 | fprintf(stderr, " -s Invoke command (mandatory) as SSH2 subsystem.\n"); |
188 | exit(1); | 190 | exit(1); |
@@ -331,6 +333,9 @@ main(int ac, char **av) | |||
331 | optarg = NULL; | 333 | optarg = NULL; |
332 | } | 334 | } |
333 | switch (opt) { | 335 | switch (opt) { |
336 | case '1': | ||
337 | options.protocol = SSH_PROTO_1; | ||
338 | break; | ||
334 | case '2': | 339 | case '2': |
335 | options.protocol = SSH_PROTO_2; | 340 | options.protocol = SSH_PROTO_2; |
336 | break; | 341 | break; |
@@ -939,6 +944,20 @@ ssh_session(void) | |||
939 | } | 944 | } |
940 | 945 | ||
941 | void | 946 | void |
947 | client_subsystem_reply(int type, int plen, void *ctxt) | ||
948 | { | ||
949 | int id, len; | ||
950 | |||
951 | id = packet_get_int(); | ||
952 | len = buffer_len(&command); | ||
953 | len = MAX(len, 900); | ||
954 | packet_done(); | ||
955 | if (type == SSH2_MSG_CHANNEL_FAILURE) | ||
956 | fatal("Request for subsystem '%.*s' failed on channel %d", | ||
957 | len, buffer_ptr(&command), id); | ||
958 | } | ||
959 | |||
960 | void | ||
942 | ssh_session2_callback(int id, void *arg) | 961 | ssh_session2_callback(int id, void *arg) |
943 | { | 962 | { |
944 | int len; | 963 | int len; |
@@ -995,7 +1014,11 @@ ssh_session2_callback(int id, void *arg) | |||
995 | len = 900; | 1014 | len = 900; |
996 | if (subsystem_flag) { | 1015 | if (subsystem_flag) { |
997 | debug("Sending subsystem: %.*s", len, buffer_ptr(&command)); | 1016 | debug("Sending subsystem: %.*s", len, buffer_ptr(&command)); |
998 | channel_request_start(id, "subsystem", 0); | 1017 | channel_request_start(id, "subsystem", /*want reply*/ 1); |
1018 | /* register callback for reply */ | ||
1019 | /* XXX we asume that client_loop has already been called */ | ||
1020 | dispatch_set(SSH2_MSG_CHANNEL_FAILURE, &client_subsystem_reply); | ||
1021 | dispatch_set(SSH2_MSG_CHANNEL_SUCCESS, &client_subsystem_reply); | ||
999 | } else { | 1022 | } else { |
1000 | debug("Sending command: %.*s", len, buffer_ptr(&command)); | 1023 | debug("Sending command: %.*s", len, buffer_ptr(&command)); |
1001 | channel_request_start(id, "exec", 0); | 1024 | channel_request_start(id, "exec", 0); |
@@ -1006,10 +1029,10 @@ ssh_session2_callback(int id, void *arg) | |||
1006 | channel_request(id, "shell", 0); | 1029 | channel_request(id, "shell", 0); |
1007 | } | 1030 | } |
1008 | /* channel_callback(id, SSH2_MSG_OPEN_CONFIGMATION, client_init, 0); */ | 1031 | /* channel_callback(id, SSH2_MSG_OPEN_CONFIGMATION, client_init, 0); */ |
1032 | |||
1009 | done: | 1033 | done: |
1010 | /* register different callback, etc. XXX */ | 1034 | /* register different callback, etc. XXX */ |
1011 | packet_set_interactive(interactive); | 1035 | packet_set_interactive(interactive); |
1012 | clientloop_set_session_ident(id); | ||
1013 | } | 1036 | } |
1014 | 1037 | ||
1015 | int | 1038 | int |