summaryrefslogtreecommitdiff
path: root/usr.bin/ssh
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2000-05-25 07:41:20 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2000-05-25 07:41:20 +0000
commit8f8d1012e23d9c20f955c2359feb84cbf84b9b6e (patch)
tree80024183e8ac3184a6441124ecb549ca319bcdeb /usr.bin/ssh
parente8d277e4bc4670f36f9b588e9b03c00b8f1b35e1 (diff)
group ssh1 vs. ssh2 in serverloop
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r--usr.bin/ssh/serverloop.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/usr.bin/ssh/serverloop.c b/usr.bin/ssh/serverloop.c
index c89bd48aaf1..74a800b9d96 100644
--- a/usr.bin/ssh/serverloop.c
+++ b/usr.bin/ssh/serverloop.c
@@ -159,33 +159,37 @@ retry_select:
/* Initialize select() masks. */
FD_ZERO(readset);
+ FD_ZERO(writeset);
- /*
- * Read packets from the client unless we have too much buffered
- * stdin or channel data.
- */
if (compat20) {
/* wrong: bad condition XXX */
if (channel_not_very_much_buffered_data())
FD_SET(connection_in, readset);
} else {
- if (buffer_len(&stdin_buffer) < 4096 &&
+ /*
+ * Read packets from the client unless we have too much
+ * buffered stdin or channel data.
+ */
+ if (buffer_len(&stdin_buffer) < buffer_high &&
channel_not_very_much_buffered_data())
FD_SET(connection_in, readset);
+ /*
+ * If there is not too much data already buffered going to
+ * the client, try to get some more data from the program.
+ */
+ if (packet_not_very_much_data_to_write()) {
+ if (!fdout_eof)
+ FD_SET(fdout, readset);
+ if (!fderr_eof)
+ FD_SET(fderr, readset);
+ }
+ /*
+ * If we have buffered data, try to write some of that data
+ * to the program.
+ */
+ if (fdin != -1 && buffer_len(&stdin_buffer) > 0)
+ FD_SET(fdin, writeset);
}
-
- /*
- * If there is not too much data already buffered going to the
- * client, try to get some more data from the program.
- */
- if (!compat20 && packet_not_very_much_data_to_write()) {
- if (!fdout_eof)
- FD_SET(fdout, readset);
- if (!fderr_eof)
- FD_SET(fderr, readset);
- }
- FD_ZERO(writeset);
-
/* Set masks for channel descriptors. */
channel_prepare_select(readset, writeset);
@@ -196,11 +200,6 @@ retry_select:
if (packet_have_data_to_write())
FD_SET(connection_out, writeset);
- /* If we have buffered data, try to write some of that data to the
- program. */
- if (!compat20 && fdin != -1 && buffer_len(&stdin_buffer) > 0)
- FD_SET(fdin, writeset);
-
/* Update the maximum descriptor number if appropriate. */
if (channel_max_fd() > max_fd)
max_fd = channel_max_fd();
@@ -369,6 +368,7 @@ process_buffered_input_packets()
void
server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg)
{
+ fd_set readset, writeset;
int wait_status; /* Status returned by wait(). */
pid_t wait_pid; /* pid returned by wait(). */
int waiting_termination = 0; /* Have displayed waiting close message. */
@@ -436,7 +436,6 @@ server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg)
/* Main loop of the server for the interactive session mode. */
for (;;) {
- fd_set readset, writeset;
/* Process buffered packets from the client. */
process_buffered_input_packets();
@@ -704,6 +703,9 @@ input_direct_tcpip(void)
originator = packet_get_string(NULL);
originator_port = packet_get_int();
packet_done();
+
+ debug("open direct-tcpip: from %s port %d to %s port %d",
+ originator, originator_port, target, target_port);
/* XXX check permission */
sock = channel_connect_to(target, target_port);
xfree(target);
@@ -755,7 +757,6 @@ server_input_channel_open(int type, int plen)
channel_free(id);
}
} else if (strcmp(ctype, "direct-tcpip") == 0) {
- debug("open direct-tcpip");
id = input_direct_tcpip();
if (id >= 0)
c = channel_lookup(id);