diff options
author | Ben Lindstrom <mouring@eviladmin.org> | 2001-04-05 23:37:36 +0000 |
---|---|---|
committer | Ben Lindstrom <mouring@eviladmin.org> | 2001-04-05 23:37:36 +0000 |
commit | 4c3f77dd3b36eb400e802065e50ccad584d039b6 (patch) | |
tree | 1cc5d04ce5e980085db0ced47a34446f7d579ffc /ssh.c | |
parent | d7dd23ffed2b54d5443ef9c0d09324a56894c739 (diff) |
- markus@cvs.openbsd.org 2001/04/05 21:05:24
[clientloop.c ssh.c]
don't request a session for 'ssh -N', pointed out slade@shore.net
Diffstat (limited to 'ssh.c')
-rw-r--r-- | ssh.c | 38 |
1 files changed, 23 insertions, 15 deletions
@@ -39,7 +39,7 @@ | |||
39 | */ | 39 | */ |
40 | 40 | ||
41 | #include "includes.h" | 41 | #include "includes.h" |
42 | RCSID("$OpenBSD: ssh.c,v 1.105 2001/03/26 08:07:09 markus Exp $"); | 42 | RCSID("$OpenBSD: ssh.c,v 1.106 2001/04/05 21:05:24 markus Exp $"); |
43 | 43 | ||
44 | #include <openssl/evp.h> | 44 | #include <openssl/evp.h> |
45 | #include <openssl/err.h> | 45 | #include <openssl/err.h> |
@@ -946,9 +946,6 @@ ssh_session2_callback(int id, void *arg) | |||
946 | 946 | ||
947 | debug("client_init id %d arg %ld", id, (long)arg); | 947 | debug("client_init id %d arg %ld", id, (long)arg); |
948 | 948 | ||
949 | if (no_shell_flag) | ||
950 | goto done; | ||
951 | |||
952 | if (tty_flag) { | 949 | if (tty_flag) { |
953 | struct winsize ws; | 950 | struct winsize ws; |
954 | char *cp; | 951 | char *cp; |
@@ -1011,15 +1008,14 @@ ssh_session2_callback(int id, void *arg) | |||
1011 | } | 1008 | } |
1012 | /* channel_callback(id, SSH2_MSG_OPEN_CONFIGMATION, client_init, 0); */ | 1009 | /* channel_callback(id, SSH2_MSG_OPEN_CONFIGMATION, client_init, 0); */ |
1013 | 1010 | ||
1014 | done: | ||
1015 | /* register different callback, etc. XXX */ | 1011 | /* register different callback, etc. XXX */ |
1016 | packet_set_interactive(interactive); | 1012 | packet_set_interactive(interactive); |
1017 | } | 1013 | } |
1018 | 1014 | ||
1019 | int | 1015 | int |
1020 | ssh_session2(void) | 1016 | ssh_session2_command(void) |
1021 | { | 1017 | { |
1022 | int window, packetmax, id; | 1018 | int id, window, packetmax; |
1023 | int in, out, err; | 1019 | int in, out, err; |
1024 | 1020 | ||
1025 | if (stdin_null_flag) { | 1021 | if (stdin_null_flag) { |
@@ -1041,14 +1037,6 @@ ssh_session2(void) | |||
1041 | if (!isatty(err)) | 1037 | if (!isatty(err)) |
1042 | set_nonblock(err); | 1038 | set_nonblock(err); |
1043 | 1039 | ||
1044 | /* XXX should be pre-session */ | ||
1045 | ssh_init_forwarding(); | ||
1046 | |||
1047 | /* If requested, let ssh continue in the background. */ | ||
1048 | if (fork_after_authentication_flag) | ||
1049 | if (daemon(1, 1) < 0) | ||
1050 | fatal("daemon() failed: %.200s", strerror(errno)); | ||
1051 | |||
1052 | window = CHAN_SES_WINDOW_DEFAULT; | 1040 | window = CHAN_SES_WINDOW_DEFAULT; |
1053 | packetmax = CHAN_SES_PACKET_DEFAULT; | 1041 | packetmax = CHAN_SES_PACKET_DEFAULT; |
1054 | if (!tty_flag) { | 1042 | if (!tty_flag) { |
@@ -1060,10 +1048,30 @@ ssh_session2(void) | |||
1060 | window, packetmax, CHAN_EXTENDED_WRITE, | 1048 | window, packetmax, CHAN_EXTENDED_WRITE, |
1061 | xstrdup("client-session"), /*nonblock*/0); | 1049 | xstrdup("client-session"), /*nonblock*/0); |
1062 | 1050 | ||
1051 | debug("channel_new: %d", id); | ||
1052 | |||
1063 | channel_open(id); | 1053 | channel_open(id); |
1064 | channel_register_callback(id, SSH2_MSG_CHANNEL_OPEN_CONFIRMATION, | 1054 | channel_register_callback(id, SSH2_MSG_CHANNEL_OPEN_CONFIRMATION, |
1065 | ssh_session2_callback, (void *)0); | 1055 | ssh_session2_callback, (void *)0); |
1066 | 1056 | ||
1057 | return id; | ||
1058 | } | ||
1059 | |||
1060 | int | ||
1061 | ssh_session2(void) | ||
1062 | { | ||
1063 | int id; | ||
1064 | |||
1065 | /* XXX should be pre-session */ | ||
1066 | ssh_init_forwarding(); | ||
1067 | |||
1068 | id = no_shell_flag ? -1 : ssh_session2_command(); | ||
1069 | |||
1070 | /* If requested, let ssh continue in the background. */ | ||
1071 | if (fork_after_authentication_flag) | ||
1072 | if (daemon(1, 1) < 0) | ||
1073 | fatal("daemon() failed: %.200s", strerror(errno)); | ||
1074 | |||
1067 | return client_loop(tty_flag, tty_flag ? options.escape_char : -1, id); | 1075 | return client_loop(tty_flag, tty_flag ? options.escape_char : -1, id); |
1068 | } | 1076 | } |
1069 | 1077 | ||