diff options
author | Damien Miller <djm@mindrot.org> | 2000-05-30 13:44:51 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2000-05-30 13:44:51 +1000 |
commit | b1715dc0cf5ea91707b437310f63b17bed2dc7a6 (patch) | |
tree | f7fe557697d12b37c6be6a97c6ce083d23fd07de /serverloop.c | |
parent | 9448c002db7427058ecca76760f3a75e379bf0a1 (diff) |
- OpenBSD CVS updates:
- markus@cvs.openbsd.org
[session.c]
make x11-fwd work w/ localhost (xauth add host/unix:11)
[cipher.c compat.c readconf.c servconf.c]
check strtok() != NULL; ok niels@
[key.c]
fix key_read() for uuencoded keys w/o '='
[serverloop.c]
group ssh1 vs. ssh2 in serverloop
[kex.c kex.h myproposal.h sshconnect2.c sshd.c]
split kexinit/kexdh, factor out common code
[readconf.c ssh.1 ssh.c]
forwardagent defaults to no, add ssh -A
- theo@cvs.openbsd.org
[session.c]
just some line shortening
Diffstat (limited to 'serverloop.c')
-rw-r--r-- | serverloop.c | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/serverloop.c b/serverloop.c index 977ed41f6..b08fcfd92 100644 --- a/serverloop.c +++ b/serverloop.c | |||
@@ -164,33 +164,37 @@ retry_select: | |||
164 | 164 | ||
165 | /* Initialize select() masks. */ | 165 | /* Initialize select() masks. */ |
166 | FD_ZERO(readset); | 166 | FD_ZERO(readset); |
167 | FD_ZERO(writeset); | ||
167 | 168 | ||
168 | /* | ||
169 | * Read packets from the client unless we have too much buffered | ||
170 | * stdin or channel data. | ||
171 | */ | ||
172 | if (compat20) { | 169 | if (compat20) { |
173 | /* wrong: bad condition XXX */ | 170 | /* wrong: bad condition XXX */ |
174 | if (channel_not_very_much_buffered_data()) | 171 | if (channel_not_very_much_buffered_data()) |
175 | FD_SET(connection_in, readset); | 172 | FD_SET(connection_in, readset); |
176 | } else { | 173 | } else { |
177 | if (buffer_len(&stdin_buffer) < 4096 && | 174 | /* |
175 | * Read packets from the client unless we have too much | ||
176 | * buffered stdin or channel data. | ||
177 | */ | ||
178 | if (buffer_len(&stdin_buffer) < buffer_high && | ||
178 | channel_not_very_much_buffered_data()) | 179 | channel_not_very_much_buffered_data()) |
179 | FD_SET(connection_in, readset); | 180 | FD_SET(connection_in, readset); |
181 | /* | ||
182 | * If there is not too much data already buffered going to | ||
183 | * the client, try to get some more data from the program. | ||
184 | */ | ||
185 | if (packet_not_very_much_data_to_write()) { | ||
186 | if (!fdout_eof) | ||
187 | FD_SET(fdout, readset); | ||
188 | if (!fderr_eof) | ||
189 | FD_SET(fderr, readset); | ||
190 | } | ||
191 | /* | ||
192 | * If we have buffered data, try to write some of that data | ||
193 | * to the program. | ||
194 | */ | ||
195 | if (fdin != -1 && buffer_len(&stdin_buffer) > 0) | ||
196 | FD_SET(fdin, writeset); | ||
180 | } | 197 | } |
181 | |||
182 | /* | ||
183 | * If there is not too much data already buffered going to the | ||
184 | * client, try to get some more data from the program. | ||
185 | */ | ||
186 | if (!compat20 && packet_not_very_much_data_to_write()) { | ||
187 | if (!fdout_eof) | ||
188 | FD_SET(fdout, readset); | ||
189 | if (!fderr_eof) | ||
190 | FD_SET(fderr, readset); | ||
191 | } | ||
192 | FD_ZERO(writeset); | ||
193 | |||
194 | /* Set masks for channel descriptors. */ | 198 | /* Set masks for channel descriptors. */ |
195 | channel_prepare_select(readset, writeset); | 199 | channel_prepare_select(readset, writeset); |
196 | 200 | ||
@@ -201,11 +205,6 @@ retry_select: | |||
201 | if (packet_have_data_to_write()) | 205 | if (packet_have_data_to_write()) |
202 | FD_SET(connection_out, writeset); | 206 | FD_SET(connection_out, writeset); |
203 | 207 | ||
204 | /* If we have buffered data, try to write some of that data to the | ||
205 | program. */ | ||
206 | if (!compat20 && fdin != -1 && buffer_len(&stdin_buffer) > 0) | ||
207 | FD_SET(fdin, writeset); | ||
208 | |||
209 | /* Update the maximum descriptor number if appropriate. */ | 208 | /* Update the maximum descriptor number if appropriate. */ |
210 | if (channel_max_fd() > max_fd) | 209 | if (channel_max_fd() > max_fd) |
211 | max_fd = channel_max_fd(); | 210 | max_fd = channel_max_fd(); |
@@ -377,6 +376,7 @@ process_buffered_input_packets() | |||
377 | void | 376 | void |
378 | server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg) | 377 | server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg) |
379 | { | 378 | { |
379 | fd_set readset, writeset; | ||
380 | int wait_status; /* Status returned by wait(). */ | 380 | int wait_status; /* Status returned by wait(). */ |
381 | pid_t wait_pid; /* pid returned by wait(). */ | 381 | pid_t wait_pid; /* pid returned by wait(). */ |
382 | int waiting_termination = 0; /* Have displayed waiting close message. */ | 382 | int waiting_termination = 0; /* Have displayed waiting close message. */ |
@@ -445,7 +445,6 @@ server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg) | |||
445 | 445 | ||
446 | /* Main loop of the server for the interactive session mode. */ | 446 | /* Main loop of the server for the interactive session mode. */ |
447 | for (;;) { | 447 | for (;;) { |
448 | fd_set readset, writeset; | ||
449 | 448 | ||
450 | /* Process buffered packets from the client. */ | 449 | /* Process buffered packets from the client. */ |
451 | process_buffered_input_packets(); | 450 | process_buffered_input_packets(); |
@@ -717,6 +716,9 @@ input_direct_tcpip(void) | |||
717 | originator = packet_get_string(NULL); | 716 | originator = packet_get_string(NULL); |
718 | originator_port = packet_get_int(); | 717 | originator_port = packet_get_int(); |
719 | packet_done(); | 718 | packet_done(); |
719 | |||
720 | debug("open direct-tcpip: from %s port %d to %s port %d", | ||
721 | originator, originator_port, target, target_port); | ||
720 | /* XXX check permission */ | 722 | /* XXX check permission */ |
721 | sock = channel_connect_to(target, target_port); | 723 | sock = channel_connect_to(target, target_port); |
722 | xfree(target); | 724 | xfree(target); |
@@ -768,7 +770,6 @@ server_input_channel_open(int type, int plen) | |||
768 | channel_free(id); | 770 | channel_free(id); |
769 | } | 771 | } |
770 | } else if (strcmp(ctype, "direct-tcpip") == 0) { | 772 | } else if (strcmp(ctype, "direct-tcpip") == 0) { |
771 | debug("open direct-tcpip"); | ||
772 | id = input_direct_tcpip(); | 773 | id = input_direct_tcpip(); |
773 | if (id >= 0) | 774 | if (id >= 0) |
774 | c = channel_lookup(id); | 775 | c = channel_lookup(id); |