2 * Author: Tatu Ylonen <ylo@cs.hut.fi>
3 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
5 * Server main loop for handling the interactive session.
7 * As far as I am concerned, the code I have written for this software
8 * can be used freely for any purpose. Any derived versions of this
9 * software must be clearly marked as such, and if the derived work is
10 * incompatible with the protocol description in the RFC file, it must be
11 * called by a name other than "ssh" or "Secure Shell".
13 * SSH2 support by Markus Friedl.
14 * Copyright (c) 2000 Markus Friedl. All rights reserved.
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
19 * 1. Redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer.
21 * 2. Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution.
25 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
26 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
27 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
28 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
29 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
30 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 RCSID("$OpenBSD: serverloop.c,v 1.34 2000/10/27 07:32:18 markus Exp $");
52 #include "auth-options.h"
54 extern ServerOptions options;
56 static Buffer stdin_buffer; /* Buffer for stdin data. */
57 static Buffer stdout_buffer; /* Buffer for stdout data. */
58 static Buffer stderr_buffer; /* Buffer for stderr data. */
59 static int fdin; /* Descriptor for stdin (for writing) */
60 static int fdout; /* Descriptor for stdout (for reading);
61 May be same number as fdin. */
62 static int fderr; /* Descriptor for stderr. May be -1. */
63 static long stdin_bytes = 0; /* Number of bytes written to stdin. */
64 static long stdout_bytes = 0; /* Number of stdout bytes sent to client. */
65 static long stderr_bytes = 0; /* Number of stderr bytes sent to client. */
66 static long fdout_bytes = 0; /* Number of stdout bytes read from program. */
67 static int stdin_eof = 0; /* EOF message received from client. */
68 static int fdout_eof = 0; /* EOF encountered reading from fdout. */
69 static int fderr_eof = 0; /* EOF encountered readung from fderr. */
70 static int connection_in; /* Connection to client (input). */
71 static int connection_out; /* Connection to client (output). */
72 static unsigned int buffer_high;/* "Soft" max buffer size. */
73 static int max_fd; /* Max file descriptor number for select(). */
76 * This SIGCHLD kludge is used to detect when the child exits. The server
77 * will exit after that, as soon as forwarded connections have terminated.
79 * After SIGCHLD child_has_selected is set to 1 after the first pass
80 * through the wait_until_can_do_something() select(). This ensures
81 * that the child's output gets a chance to drain before it is yanked.
84 static pid_t child_pid; /* Pid of the child. */
85 static volatile int child_terminated; /* The child has terminated. */
86 static volatile int child_has_selected; /* Child has had chance to drain. */
87 static volatile int child_wait_status; /* Status from wait(). */
89 void server_init_dispatch(void);
92 sigchld_handler(int sig)
94 int save_errno = errno;
97 debug("Received SIGCHLD.");
98 wait_pid = wait((int *) &child_wait_status);
100 if (wait_pid != child_pid)
101 error("Strange, got SIGCHLD and wait returned pid %d but child is %d",
102 wait_pid, child_pid);
103 if (WIFEXITED(child_wait_status) ||
104 WIFSIGNALED(child_wait_status)) {
105 child_terminated = 1;
106 child_has_selected = 0;
109 signal(SIGCHLD, sigchld_handler);
113 sigchld_handler2(int sig)
115 int save_errno = errno;
116 debug("Received SIGCHLD.");
117 child_terminated = 1;
118 child_has_selected = 0;
123 * Make packets from buffered stderr data, and buffer it for sending
127 make_packets_from_stderr_data()
131 /* Send buffered stderr data to the client. */
132 while (buffer_len(&stderr_buffer) > 0 &&
133 packet_not_very_much_data_to_write()) {
134 len = buffer_len(&stderr_buffer);
135 if (packet_is_interactive()) {
139 /* Keep the packets at reasonable size. */
140 if (len > packet_get_maxsize())
141 len = packet_get_maxsize();
143 packet_start(SSH_SMSG_STDERR_DATA);
144 packet_put_string(buffer_ptr(&stderr_buffer), len);
146 buffer_consume(&stderr_buffer, len);
152 * Make packets from buffered stdout data, and buffer it for sending to the
156 make_packets_from_stdout_data()
160 /* Send buffered stdout data to the client. */
161 while (buffer_len(&stdout_buffer) > 0 &&
162 packet_not_very_much_data_to_write()) {
163 len = buffer_len(&stdout_buffer);
164 if (packet_is_interactive()) {
168 /* Keep the packets at reasonable size. */
169 if (len > packet_get_maxsize())
170 len = packet_get_maxsize();
172 packet_start(SSH_SMSG_STDOUT_DATA);
173 packet_put_string(buffer_ptr(&stdout_buffer), len);
175 buffer_consume(&stdout_buffer, len);
181 * Sleep in select() until we can do something. This will initialize the
182 * select masks. Upon return, the masks will indicate which descriptors
183 * have data or can accept data. Optionally, a maximum time can be specified
184 * for the duration of the wait (0 = infinite).
187 wait_until_can_do_something(fd_set * readset, fd_set * writeset,
188 unsigned int max_time_milliseconds)
190 struct timeval tv, *tvp;
193 /* When select fails we restart from here. */
196 /* Initialize select() masks. */
201 /* wrong: bad condition XXX */
202 if (channel_not_very_much_buffered_data())
203 FD_SET(connection_in, readset);
206 * Read packets from the client unless we have too much
207 * buffered stdin or channel data.
209 if (buffer_len(&stdin_buffer) < buffer_high &&
210 channel_not_very_much_buffered_data())
211 FD_SET(connection_in, readset);
213 * If there is not too much data already buffered going to
214 * the client, try to get some more data from the program.
216 if (packet_not_very_much_data_to_write()) {
218 FD_SET(fdout, readset);
220 FD_SET(fderr, readset);
223 * If we have buffered data, try to write some of that data
226 if (fdin != -1 && buffer_len(&stdin_buffer) > 0)
227 FD_SET(fdin, writeset);
229 /* Set masks for channel descriptors. */
230 channel_prepare_select(readset, writeset);
233 * If we have buffered packet data going to the client, mark that
236 if (packet_have_data_to_write())
237 FD_SET(connection_out, writeset);
239 /* Update the maximum descriptor number if appropriate. */
240 if (channel_max_fd() > max_fd)
241 max_fd = channel_max_fd();
244 * If child has terminated and there is enough buffer space to read
245 * from it, then read as much as is available and exit.
247 if (child_terminated && packet_not_very_much_data_to_write())
248 if (max_time_milliseconds == 0)
249 max_time_milliseconds = 100;
251 if (max_time_milliseconds == 0)
254 tv.tv_sec = max_time_milliseconds / 1000;
255 tv.tv_usec = 1000 * (max_time_milliseconds % 1000);
259 debug("tvp!=NULL kid %d mili %d", child_terminated, max_time_milliseconds);
261 /* Wait for something to happen, or the timeout to expire. */
262 ret = select(max_fd + 1, readset, writeset, NULL, tvp);
266 error("select: %.100s", strerror(errno));
271 if (child_terminated)
272 child_has_selected = 1;
276 * Processes input from the client and the program. Input data is stored
277 * in buffers and processed later.
280 process_input(fd_set * readset)
285 /* Read and buffer any input data from the client. */
286 if (FD_ISSET(connection_in, readset)) {
287 len = read(connection_in, buf, sizeof(buf));
289 verbose("Connection closed by remote host.");
291 } else if (len < 0) {
292 if (errno != EINTR && errno != EAGAIN) {
293 verbose("Read error from remote host: %.100s", strerror(errno));
297 /* Buffer any received data. */
298 packet_process_incoming(buf, len);
304 /* Read and buffer any available stdout data from the program. */
305 if (!fdout_eof && FD_ISSET(fdout, readset)) {
306 len = read(fdout, buf, sizeof(buf));
307 if (len < 0 && (errno == EINTR || errno == EAGAIN)) {
309 } else if (len <= 0) {
312 buffer_append(&stdout_buffer, buf, len);
316 /* Read and buffer any available stderr data from the program. */
317 if (!fderr_eof && FD_ISSET(fderr, readset)) {
318 len = read(fderr, buf, sizeof(buf));
319 if (len < 0 && (errno == EINTR || errno == EAGAIN)) {
321 } else if (len <= 0) {
324 buffer_append(&stderr_buffer, buf, len);
330 * Sends data from internal buffers to client program stdin.
333 process_output(fd_set * writeset)
337 /* Write buffered data to program stdin. */
338 if (!compat20 && fdin != -1 && FD_ISSET(fdin, writeset)) {
339 len = write(fdin, buffer_ptr(&stdin_buffer),
340 buffer_len(&stdin_buffer));
341 if (len < 0 && (errno == EINTR || errno == EAGAIN)) {
343 } else if (len <= 0) {
350 shutdown(fdin, SHUT_WR); /* We will no longer send. */
354 /* Successful write. Consume the data from the buffer. */
355 buffer_consume(&stdin_buffer, len);
356 /* Update the count of bytes written to the program. */
360 /* Send any buffered packet data to the client. */
361 if (FD_ISSET(connection_out, writeset))
366 * Wait until all buffered output has been sent to the client.
367 * This is used when the program terminates.
372 /* Send any buffered stdout data to the client. */
373 if (buffer_len(&stdout_buffer) > 0) {
374 packet_start(SSH_SMSG_STDOUT_DATA);
375 packet_put_string(buffer_ptr(&stdout_buffer),
376 buffer_len(&stdout_buffer));
378 /* Update the count of sent bytes. */
379 stdout_bytes += buffer_len(&stdout_buffer);
381 /* Send any buffered stderr data to the client. */
382 if (buffer_len(&stderr_buffer) > 0) {
383 packet_start(SSH_SMSG_STDERR_DATA);
384 packet_put_string(buffer_ptr(&stderr_buffer),
385 buffer_len(&stderr_buffer));
387 /* Update the count of sent bytes. */
388 stderr_bytes += buffer_len(&stderr_buffer);
390 /* Wait until all buffered data has been written to the client. */
395 process_buffered_input_packets()
397 dispatch_run(DISPATCH_NONBLOCK, NULL, NULL);
401 * Performs the interactive session. This handles data transmission between
402 * the client and the program. Note that the notion of stdin, stdout, and
403 * stderr in this function is sort of reversed: this function writes to
404 * stdin (of the child program), and reads from stdout and stderr (of the
408 server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg)
410 fd_set readset, writeset;
411 int wait_status; /* Status returned by wait(). */
412 pid_t wait_pid; /* pid returned by wait(). */
413 int waiting_termination = 0; /* Have displayed waiting close message. */
414 unsigned int max_time_milliseconds;
415 unsigned int previous_stdout_buffer_bytes;
416 unsigned int stdout_buffer_bytes;
419 debug("Entering interactive session.");
421 /* Initialize the SIGCHLD kludge. */
423 child_terminated = 0;
424 child_has_selected = 0;
425 signal(SIGCHLD, sigchld_handler);
426 signal(SIGPIPE, SIG_IGN);
428 /* Initialize our global variables. */
436 /* we don't have stderr for interactive terminal sessions, see below */
440 connection_in = packet_get_connection_in();
441 connection_out = packet_get_connection_out();
443 previous_stdout_buffer_bytes = 0;
445 /* Set approximate I/O buffer size. */
446 if (packet_is_interactive())
449 buffer_high = 64 * 1024;
451 /* Initialize max_fd to the maximum of the known file descriptors. */
455 if (fderr != -1 && fderr > max_fd)
457 if (connection_in > max_fd)
458 max_fd = connection_in;
459 if (connection_out > max_fd)
460 max_fd = connection_out;
462 /* Initialize Initialize buffers. */
463 buffer_init(&stdin_buffer);
464 buffer_init(&stdout_buffer);
465 buffer_init(&stderr_buffer);
468 * If we have no separate fderr (which is the case when we have a pty
469 * - there we cannot make difference between data sent to stdout and
470 * stderr), indicate that we have seen an EOF from stderr. This way
471 * we don\'t need to check the descriptor everywhere.
476 server_init_dispatch();
478 /* Main loop of the server for the interactive session mode. */
481 /* Process buffered packets from the client. */
482 process_buffered_input_packets();
485 * If we have received eof, and there is no more pending
486 * input data, cause a real eof by closing fdin.
488 if (stdin_eof && fdin != -1 && buffer_len(&stdin_buffer) == 0) {
495 shutdown(fdin, SHUT_WR); /* We will no longer send. */
499 /* Make packets from buffered stderr data to send to the client. */
500 make_packets_from_stderr_data();
503 * Make packets from buffered stdout data to send to the
504 * client. If there is very little to send, this arranges to
505 * not send them now, but to wait a short while to see if we
506 * are getting more data. This is necessary, as some systems
507 * wake up readers from a pty after each separate character.
509 max_time_milliseconds = 0;
510 stdout_buffer_bytes = buffer_len(&stdout_buffer);
511 if (stdout_buffer_bytes != 0 && stdout_buffer_bytes < 256 &&
512 stdout_buffer_bytes != previous_stdout_buffer_bytes) {
513 /* try again after a while */
514 max_time_milliseconds = 10;
517 make_packets_from_stdout_data();
519 previous_stdout_buffer_bytes = buffer_len(&stdout_buffer);
521 /* Send channel data to the client. */
522 if (packet_not_very_much_data_to_write())
523 channel_output_poll();
526 * Bail out of the loop if the program has closed its output
527 * descriptors, and we have no more data to send to the
528 * client, and there is no pending buffered data.
530 if (((fdout_eof && fderr_eof) ||
531 (child_terminated && child_has_selected)) &&
532 !packet_have_data_to_write() &&
533 (buffer_len(&stdout_buffer) == 0) &&
534 (buffer_len(&stderr_buffer) == 0)) {
535 if (!channel_still_open())
537 if (!waiting_termination) {
538 const char *s = "Waiting for forwarded connections to terminate...\r\n";
540 waiting_termination = 1;
541 buffer_append(&stderr_buffer, s, strlen(s));
543 /* Display list of open channels. */
544 cp = channel_open_message();
545 buffer_append(&stderr_buffer, cp, strlen(cp));
549 /* Sleep in select() until we can do something. */
550 wait_until_can_do_something(&readset, &writeset,
551 max_time_milliseconds);
553 /* Process any channel events. */
554 channel_after_select(&readset, &writeset);
556 /* Process input from the client and from program stdout/stderr. */
557 process_input(&readset);
559 /* Process output to the client and to program stdin. */
560 process_output(&writeset);
563 /* Cleanup and termination code. */
565 /* Wait until all output has been sent to the client. */
568 debug("End of interactive session; stdin %ld, stdout (read %ld, sent %ld), stderr %ld bytes.",
569 stdin_bytes, fdout_bytes, stdout_bytes, stderr_bytes);
571 /* Free and clear the buffers. */
572 buffer_free(&stdin_buffer);
573 buffer_free(&stdout_buffer);
574 buffer_free(&stderr_buffer);
576 /* Close the file descriptors. */
589 /* Stop listening for channels; this removes unix domain sockets. */
590 channel_stop_listening();
592 /* Wait for the child to exit. Get its exit status. */
593 wait_pid = wait(&wait_status);
596 * It is possible that the wait was handled by SIGCHLD
597 * handler. This may result in either: this call
598 * returning with EINTR, or: this call returning ECHILD.
600 if (child_terminated)
601 wait_status = child_wait_status;
603 packet_disconnect("wait: %.100s", strerror(errno));
605 /* Check if it matches the process we forked. */
607 error("Strange, wait returned pid %d, expected %d",
611 /* We no longer want our SIGCHLD handler to be called. */
612 signal(SIGCHLD, SIG_DFL);
614 /* Check if it exited normally. */
615 if (WIFEXITED(wait_status)) {
616 /* Yes, normal exit. Get exit status and send it to the client. */
617 debug("Command exited with status %d.", WEXITSTATUS(wait_status));
618 packet_start(SSH_SMSG_EXITSTATUS);
619 packet_put_int(WEXITSTATUS(wait_status));
624 * Wait for exit confirmation. Note that there might be
625 * other packets coming before it; however, the program has
626 * already died so we just ignore them. The client is
627 * supposed to respond with the confirmation when it receives
632 type = packet_read(&plen);
634 while (type != SSH_CMSG_EXIT_CONFIRMATION);
636 debug("Received exit confirmation.");
639 /* Check if the program terminated due to a signal. */
640 if (WIFSIGNALED(wait_status))
641 packet_disconnect("Command terminated on signal %d.",
642 WTERMSIG(wait_status));
644 /* Some weird exit cause. Just exit. */
645 packet_disconnect("wait returned status %04x.", wait_status);
652 fd_set readset, writeset;
657 debug("Entering interactive session for SSH2.");
659 signal(SIGCHLD, sigchld_handler2);
660 signal(SIGPIPE, SIG_IGN);
661 child_terminated = 0;
662 connection_in = packet_get_connection_in();
663 connection_out = packet_get_connection_out();
664 max_fd = connection_in;
665 if (connection_out > max_fd)
666 max_fd = connection_out;
667 server_init_dispatch();
670 process_buffered_input_packets();
671 if (!had_channel && channel_still_open())
673 if (had_channel && !channel_still_open()) {
674 debug("!channel_still_open.");
677 if (packet_not_very_much_data_to_write())
678 channel_output_poll();
679 wait_until_can_do_something(&readset, &writeset, 0);
680 if (child_terminated && child_has_selected) {
681 /* XXX: race - assumes only one child has terminated */
682 while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
683 session_close_by_pid(pid, status);
684 child_terminated = 0;
685 child_has_selected = 0;
686 signal(SIGCHLD, sigchld_handler2);
688 channel_after_select(&readset, &writeset);
689 process_input(&readset);
690 process_output(&writeset);
692 signal(SIGCHLD, SIG_DFL);
693 while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
694 session_close_by_pid(pid, status);
695 channel_stop_listening();
699 server_input_stdin_data(int type, int plen, void *ctxt)
702 unsigned int data_len;
704 /* Stdin data from the client. Append it to the buffer. */
705 /* Ignore any data if the client has closed stdin. */
708 data = packet_get_string(&data_len);
709 packet_integrity_check(plen, (4 + data_len), type);
710 buffer_append(&stdin_buffer, data, data_len);
711 memset(data, 0, data_len);
716 server_input_eof(int type, int plen, void *ctxt)
719 * Eof from the client. The stdin descriptor to the
720 * program will be closed when all buffered data has
723 debug("EOF received for stdin.");
724 packet_integrity_check(plen, 0, type);
729 server_input_window_size(int type, int plen, void *ctxt)
731 int row = packet_get_int();
732 int col = packet_get_int();
733 int xpixel = packet_get_int();
734 int ypixel = packet_get_int();
736 debug("Window change received.");
737 packet_integrity_check(plen, 4 * 4, type);
739 pty_change_window_size(fdin, row, col, xpixel, ypixel);
743 input_direct_tcpip(void)
746 char *target, *originator;
747 int target_port, originator_port;
749 target = packet_get_string(NULL);
750 target_port = packet_get_int();
751 originator = packet_get_string(NULL);
752 originator_port = packet_get_int();
755 debug("open direct-tcpip: from %s port %d to %s port %d",
756 originator, originator_port, target, target_port);
758 /* XXX check permission */
759 if (no_port_forwarding_flag || !options.allow_tcp_forwarding) {
764 sock = channel_connect_to(target, target_port);
769 return channel_new("direct-tcpip", SSH_CHANNEL_OPEN,
770 sock, sock, -1, CHAN_TCP_WINDOW_DEFAULT,
771 CHAN_TCP_PACKET_DEFAULT, 0, xstrdup("direct-tcpip"), 1);
775 server_input_channel_open(int type, int plen, void *ctxt)
785 ctype = packet_get_string(&len);
786 rchan = packet_get_int();
787 rwindow = packet_get_int();
788 rmaxpack = packet_get_int();
790 debug("server_input_channel_open: ctype %s rchan %d win %d max %d",
791 ctype, rchan, rwindow, rmaxpack);
793 if (strcmp(ctype, "session") == 0) {
794 debug("open session");
797 * A server session has no fd to read or write
798 * until a CHANNEL_REQUEST for a shell is made,
799 * so we set the type to SSH_CHANNEL_LARVAL.
800 * Additionally, a callback for handling all
801 * CHANNEL_REQUEST messages is registered.
803 id = channel_new(ctype, SSH_CHANNEL_LARVAL,
804 -1, -1, -1, 0, CHAN_SES_PACKET_DEFAULT,
805 0, xstrdup("server-session"), 1);
806 if (session_open(id) == 1) {
807 channel_register_callback(id, SSH2_MSG_CHANNEL_REQUEST,
808 session_input_channel_req, (void *)0);
809 channel_register_cleanup(id, session_close_by_channel);
810 c = channel_lookup(id);
812 debug("session open failed, free channel %d", id);
815 } else if (strcmp(ctype, "direct-tcpip") == 0) {
816 id = input_direct_tcpip();
818 c = channel_lookup(id);
821 debug("confirm %s", ctype);
822 c->remote_id = rchan;
823 c->remote_window = rwindow;
824 c->remote_maxpacket = rmaxpack;
826 packet_start(SSH2_MSG_CHANNEL_OPEN_CONFIRMATION);
827 packet_put_int(c->remote_id);
828 packet_put_int(c->self);
829 packet_put_int(c->local_window);
830 packet_put_int(c->local_maxpacket);
833 debug("failure %s", ctype);
834 packet_start(SSH2_MSG_CHANNEL_OPEN_FAILURE);
835 packet_put_int(rchan);
836 packet_put_int(SSH2_OPEN_ADMINISTRATIVELY_PROHIBITED);
837 packet_put_cstring("bla bla");
838 packet_put_cstring("");
845 server_init_dispatch_20()
847 debug("server_init_dispatch_20");
848 dispatch_init(&dispatch_protocol_error);
849 dispatch_set(SSH2_MSG_CHANNEL_CLOSE, &channel_input_oclose);
850 dispatch_set(SSH2_MSG_CHANNEL_DATA, &channel_input_data);
851 dispatch_set(SSH2_MSG_CHANNEL_EOF, &channel_input_ieof);
852 dispatch_set(SSH2_MSG_CHANNEL_EXTENDED_DATA, &channel_input_extended_data);
853 dispatch_set(SSH2_MSG_CHANNEL_OPEN, &server_input_channel_open);
854 dispatch_set(SSH2_MSG_CHANNEL_OPEN_CONFIRMATION, &channel_input_open_confirmation);
855 dispatch_set(SSH2_MSG_CHANNEL_OPEN_FAILURE, &channel_input_open_failure);
856 dispatch_set(SSH2_MSG_CHANNEL_REQUEST, &channel_input_channel_request);
857 dispatch_set(SSH2_MSG_CHANNEL_WINDOW_ADJUST, &channel_input_window_adjust);
860 server_init_dispatch_13()
862 debug("server_init_dispatch_13");
864 dispatch_set(SSH_CMSG_EOF, &server_input_eof);
865 dispatch_set(SSH_CMSG_STDIN_DATA, &server_input_stdin_data);
866 dispatch_set(SSH_CMSG_WINDOW_SIZE, &server_input_window_size);
867 dispatch_set(SSH_MSG_CHANNEL_CLOSE, &channel_input_close);
868 dispatch_set(SSH_MSG_CHANNEL_CLOSE_CONFIRMATION, &channel_input_close_confirmation);
869 dispatch_set(SSH_MSG_CHANNEL_DATA, &channel_input_data);
870 dispatch_set(SSH_MSG_CHANNEL_OPEN_CONFIRMATION, &channel_input_open_confirmation);
871 dispatch_set(SSH_MSG_CHANNEL_OPEN_FAILURE, &channel_input_open_failure);
872 dispatch_set(SSH_MSG_PORT_OPEN, &channel_input_port_open);
875 server_init_dispatch_15()
877 server_init_dispatch_13();
878 debug("server_init_dispatch_15");
879 dispatch_set(SSH_MSG_CHANNEL_CLOSE, &channel_input_ieof);
880 dispatch_set(SSH_MSG_CHANNEL_CLOSE_CONFIRMATION, &channel_input_oclose);
883 server_init_dispatch()
886 server_init_dispatch_20();
888 server_init_dispatch_13();
890 server_init_dispatch_15();