version 1.105, 2001/03/26 08:07:09 |
version 1.106, 2001/04/05 21:05:24 |
|
|
|
|
debug("client_init id %d arg %ld", id, (long)arg); |
debug("client_init id %d arg %ld", id, (long)arg); |
|
|
if (no_shell_flag) |
|
goto done; |
|
|
|
if (tty_flag) { |
if (tty_flag) { |
struct winsize ws; |
struct winsize ws; |
char *cp; |
char *cp; |
|
|
} |
} |
/* channel_callback(id, SSH2_MSG_OPEN_CONFIGMATION, client_init, 0); */ |
/* channel_callback(id, SSH2_MSG_OPEN_CONFIGMATION, client_init, 0); */ |
|
|
done: |
|
/* register different callback, etc. XXX */ |
/* register different callback, etc. XXX */ |
packet_set_interactive(interactive); |
packet_set_interactive(interactive); |
} |
} |
|
|
int |
int |
ssh_session2(void) |
ssh_session2_command(void) |
{ |
{ |
int window, packetmax, id; |
int id, window, packetmax; |
int in, out, err; |
int in, out, err; |
|
|
if (stdin_null_flag) { |
if (stdin_null_flag) { |
|
|
if (!isatty(err)) |
if (!isatty(err)) |
set_nonblock(err); |
set_nonblock(err); |
|
|
/* XXX should be pre-session */ |
|
ssh_init_forwarding(); |
|
|
|
/* If requested, let ssh continue in the background. */ |
|
if (fork_after_authentication_flag) |
|
if (daemon(1, 1) < 0) |
|
fatal("daemon() failed: %.200s", strerror(errno)); |
|
|
|
window = CHAN_SES_WINDOW_DEFAULT; |
window = CHAN_SES_WINDOW_DEFAULT; |
packetmax = CHAN_SES_PACKET_DEFAULT; |
packetmax = CHAN_SES_PACKET_DEFAULT; |
if (!tty_flag) { |
if (!tty_flag) { |
|
|
window, packetmax, CHAN_EXTENDED_WRITE, |
window, packetmax, CHAN_EXTENDED_WRITE, |
xstrdup("client-session"), /*nonblock*/0); |
xstrdup("client-session"), /*nonblock*/0); |
|
|
|
debug("channel_new: %d", id); |
|
|
channel_open(id); |
channel_open(id); |
channel_register_callback(id, SSH2_MSG_CHANNEL_OPEN_CONFIRMATION, |
channel_register_callback(id, SSH2_MSG_CHANNEL_OPEN_CONFIRMATION, |
ssh_session2_callback, (void *)0); |
ssh_session2_callback, (void *)0); |
|
|
|
return id; |
|
} |
|
|
|
int |
|
ssh_session2(void) |
|
{ |
|
int id; |
|
|
|
/* XXX should be pre-session */ |
|
ssh_init_forwarding(); |
|
|
|
id = no_shell_flag ? -1 : ssh_session2_command(); |
|
|
|
/* If requested, let ssh continue in the background. */ |
|
if (fork_after_authentication_flag) |
|
if (daemon(1, 1) < 0) |
|
fatal("daemon() failed: %.200s", strerror(errno)); |
|
|
return client_loop(tty_flag, tty_flag ? options.escape_char : -1, id); |
return client_loop(tty_flag, tty_flag ? options.escape_char : -1, id); |
} |
} |