- markus@cvs.openbsd.org 2001/02/06 22:07:42
[ssh.c] fatal() if subsystem fails - markus@cvs.openbsd.org 2001/02/06 22:43:02 [ssh.c] remove confusing callback code - jakob@cvs.openbsd.org 2001/02/06 23:03:24 [ssh.c] add -1 option (force protocol version 1). ok markus@ - jakob@cvs.openbsd.org 2001/02/06 23:06:21 [ssh.c] reorder -{1,2,4,6} options. ok markus@
This commit is contained in:
parent
b0407fc670
commit
1e7d30611b
14
ChangeLog
14
ChangeLog
|
@ -31,6 +31,18 @@
|
||||||
- more strict prototypes, include necessary headers
|
- more strict prototypes, include necessary headers
|
||||||
- use paths.h/pathnames.h decls
|
- use paths.h/pathnames.h decls
|
||||||
- size_t typecase to int -> u_long
|
- size_t typecase to int -> u_long
|
||||||
|
- markus@cvs.openbsd.org 2001/02/06 22:07:42
|
||||||
|
[ssh.c]
|
||||||
|
fatal() if subsystem fails
|
||||||
|
- markus@cvs.openbsd.org 2001/02/06 22:43:02
|
||||||
|
[ssh.c]
|
||||||
|
remove confusing callback code
|
||||||
|
- jakob@cvs.openbsd.org 2001/02/06 23:03:24
|
||||||
|
[ssh.c]
|
||||||
|
add -1 option (force protocol version 1). ok markus@
|
||||||
|
- jakob@cvs.openbsd.org 2001/02/06 23:06:21
|
||||||
|
[ssh.c]
|
||||||
|
reorder -{1,2,4,6} options. ok markus@
|
||||||
- (bal) Missing 'const' in readpass.h
|
- (bal) Missing 'const' in readpass.h
|
||||||
|
|
||||||
20010208
|
20010208
|
||||||
|
@ -3685,4 +3697,4 @@
|
||||||
- Wrote replacements for strlcpy and mkdtemp
|
- Wrote replacements for strlcpy and mkdtemp
|
||||||
- Released 1.0pre1
|
- Released 1.0pre1
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.706 2001/02/09 02:23:10 mouring Exp $
|
$Id: ChangeLog,v 1.707 2001/02/09 02:36:43 mouring Exp $
|
||||||
|
|
29
ssh.c
29
ssh.c
|
@ -63,6 +63,7 @@ RCSID("$OpenBSD: ssh.c,v 1.93 2001/02/08 19:30:52 itojun Exp $");
|
||||||
#include "readconf.h"
|
#include "readconf.h"
|
||||||
#include "sshconnect.h"
|
#include "sshconnect.h"
|
||||||
#include "tildexpand.h"
|
#include "tildexpand.h"
|
||||||
|
#include "dispatch.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
#ifdef HAVE___PROGNAME
|
#ifdef HAVE___PROGNAME
|
||||||
|
@ -180,9 +181,10 @@ usage(void)
|
||||||
fprintf(stderr, " -C Enable compression.\n");
|
fprintf(stderr, " -C Enable compression.\n");
|
||||||
fprintf(stderr, " -N Do not execute a shell or command.\n");
|
fprintf(stderr, " -N Do not execute a shell or command.\n");
|
||||||
fprintf(stderr, " -g Allow remote hosts to connect to forwarded ports.\n");
|
fprintf(stderr, " -g Allow remote hosts to connect to forwarded ports.\n");
|
||||||
|
fprintf(stderr, " -1 Force protocol version 1.\n");
|
||||||
|
fprintf(stderr, " -2 Force protocol version 2.\n");
|
||||||
fprintf(stderr, " -4 Use IPv4 only.\n");
|
fprintf(stderr, " -4 Use IPv4 only.\n");
|
||||||
fprintf(stderr, " -6 Use IPv6 only.\n");
|
fprintf(stderr, " -6 Use IPv6 only.\n");
|
||||||
fprintf(stderr, " -2 Force protocol version 2.\n");
|
|
||||||
fprintf(stderr, " -o 'option' Process the option as if it was read from a configuration file.\n");
|
fprintf(stderr, " -o 'option' Process the option as if it was read from a configuration file.\n");
|
||||||
fprintf(stderr, " -s Invoke command (mandatory) as SSH2 subsystem.\n");
|
fprintf(stderr, " -s Invoke command (mandatory) as SSH2 subsystem.\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -331,6 +333,9 @@ main(int ac, char **av)
|
||||||
optarg = NULL;
|
optarg = NULL;
|
||||||
}
|
}
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
|
case '1':
|
||||||
|
options.protocol = SSH_PROTO_1;
|
||||||
|
break;
|
||||||
case '2':
|
case '2':
|
||||||
options.protocol = SSH_PROTO_2;
|
options.protocol = SSH_PROTO_2;
|
||||||
break;
|
break;
|
||||||
|
@ -938,6 +943,20 @@ ssh_session(void)
|
||||||
return client_loop(have_tty, tty_flag ? options.escape_char : -1, 0);
|
return client_loop(have_tty, tty_flag ? options.escape_char : -1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
client_subsystem_reply(int type, int plen, void *ctxt)
|
||||||
|
{
|
||||||
|
int id, len;
|
||||||
|
|
||||||
|
id = packet_get_int();
|
||||||
|
len = buffer_len(&command);
|
||||||
|
len = MAX(len, 900);
|
||||||
|
packet_done();
|
||||||
|
if (type == SSH2_MSG_CHANNEL_FAILURE)
|
||||||
|
fatal("Request for subsystem '%.*s' failed on channel %d",
|
||||||
|
len, buffer_ptr(&command), id);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ssh_session2_callback(int id, void *arg)
|
ssh_session2_callback(int id, void *arg)
|
||||||
{
|
{
|
||||||
|
@ -995,7 +1014,11 @@ ssh_session2_callback(int id, void *arg)
|
||||||
len = 900;
|
len = 900;
|
||||||
if (subsystem_flag) {
|
if (subsystem_flag) {
|
||||||
debug("Sending subsystem: %.*s", len, buffer_ptr(&command));
|
debug("Sending subsystem: %.*s", len, buffer_ptr(&command));
|
||||||
channel_request_start(id, "subsystem", 0);
|
channel_request_start(id, "subsystem", /*want reply*/ 1);
|
||||||
|
/* register callback for reply */
|
||||||
|
/* XXX we asume that client_loop has already been called */
|
||||||
|
dispatch_set(SSH2_MSG_CHANNEL_FAILURE, &client_subsystem_reply);
|
||||||
|
dispatch_set(SSH2_MSG_CHANNEL_SUCCESS, &client_subsystem_reply);
|
||||||
} else {
|
} else {
|
||||||
debug("Sending command: %.*s", len, buffer_ptr(&command));
|
debug("Sending command: %.*s", len, buffer_ptr(&command));
|
||||||
channel_request_start(id, "exec", 0);
|
channel_request_start(id, "exec", 0);
|
||||||
|
@ -1006,10 +1029,10 @@ ssh_session2_callback(int id, void *arg)
|
||||||
channel_request(id, "shell", 0);
|
channel_request(id, "shell", 0);
|
||||||
}
|
}
|
||||||
/* channel_callback(id, SSH2_MSG_OPEN_CONFIGMATION, client_init, 0); */
|
/* channel_callback(id, SSH2_MSG_OPEN_CONFIGMATION, client_init, 0); */
|
||||||
|
|
||||||
done:
|
done:
|
||||||
/* register different callback, etc. XXX */
|
/* register different callback, etc. XXX */
|
||||||
packet_set_interactive(interactive);
|
packet_set_interactive(interactive);
|
||||||
clientloop_set_session_ident(id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Reference in New Issue