summaryrefslogtreecommitdiff
path: root/serverloop.c
diff options
context:
space:
mode:
Diffstat (limited to 'serverloop.c')
-rw-r--r--serverloop.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/serverloop.c b/serverloop.c
index 1ce6c9106..1ffa4dbfb 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -35,7 +35,7 @@
35 */ 35 */
36 36
37#include "includes.h" 37#include "includes.h"
38RCSID("$OpenBSD: serverloop.c,v 1.69 2001/06/20 13:56:39 markus Exp $"); 38RCSID("$OpenBSD: serverloop.c,v 1.70 2001/06/23 15:12:19 itojun Exp $");
39 39
40#include "xmalloc.h" 40#include "xmalloc.h"
41#include "packet.h" 41#include "packet.h"
@@ -84,13 +84,15 @@ static u_int buffer_high; /* "Soft" max buffer size. */
84 * This SIGCHLD kludge is used to detect when the child exits. The server 84 * This SIGCHLD kludge is used to detect when the child exits. The server
85 * will exit after that, as soon as forwarded connections have terminated. 85 * will exit after that, as soon as forwarded connections have terminated.
86 */ 86 */
87
87static volatile int child_terminated; /* The child has terminated. */ 88static volatile int child_terminated; /* The child has terminated. */
88 89
89void server_init_dispatch(void); 90/* prototypes */
91static void server_init_dispatch(void);
90 92
91int client_alive_timeouts = 0; 93int client_alive_timeouts = 0;
92 94
93void 95static void
94sigchld_handler(int sig) 96sigchld_handler(int sig)
95{ 97{
96 int save_errno = errno; 98 int save_errno = errno;
@@ -104,7 +106,7 @@ sigchld_handler(int sig)
104 * Make packets from buffered stderr data, and buffer it for sending 106 * Make packets from buffered stderr data, and buffer it for sending
105 * to the client. 107 * to the client.
106 */ 108 */
107void 109static void
108make_packets_from_stderr_data(void) 110make_packets_from_stderr_data(void)
109{ 111{
110 int len; 112 int len;
@@ -133,7 +135,7 @@ make_packets_from_stderr_data(void)
133 * Make packets from buffered stdout data, and buffer it for sending to the 135 * Make packets from buffered stdout data, and buffer it for sending to the
134 * client. 136 * client.
135 */ 137 */
136void 138static void
137make_packets_from_stdout_data(void) 139make_packets_from_stdout_data(void)
138{ 140{
139 int len; 141 int len;
@@ -164,7 +166,7 @@ make_packets_from_stdout_data(void)
164 * have data or can accept data. Optionally, a maximum time can be specified 166 * have data or can accept data. Optionally, a maximum time can be specified
165 * for the duration of the wait (0 = infinite). 167 * for the duration of the wait (0 = infinite).
166 */ 168 */
167void 169static void
168wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, int *maxfdp, 170wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, int *maxfdp,
169 u_int max_time_milliseconds) 171 u_int max_time_milliseconds)
170{ 172{
@@ -286,7 +288,7 @@ retry_select:
286 * Processes input from the client and the program. Input data is stored 288 * Processes input from the client and the program. Input data is stored
287 * in buffers and processed later. 289 * in buffers and processed later.
288 */ 290 */
289void 291static void
290process_input(fd_set * readset) 292process_input(fd_set * readset)
291{ 293{
292 int len; 294 int len;
@@ -342,7 +344,7 @@ process_input(fd_set * readset)
342/* 344/*
343 * Sends data from internal buffers to client program stdin. 345 * Sends data from internal buffers to client program stdin.
344 */ 346 */
345void 347static void
346process_output(fd_set * writeset) 348process_output(fd_set * writeset)
347{ 349{
348 struct termios tio; 350 struct termios tio;
@@ -390,7 +392,7 @@ process_output(fd_set * writeset)
390 * Wait until all buffered output has been sent to the client. 392 * Wait until all buffered output has been sent to the client.
391 * This is used when the program terminates. 393 * This is used when the program terminates.
392 */ 394 */
393void 395static void
394drain_output(void) 396drain_output(void)
395{ 397{
396 /* Send any buffered stdout data to the client. */ 398 /* Send any buffered stdout data to the client. */
@@ -415,7 +417,7 @@ drain_output(void)
415 packet_write_wait(); 417 packet_write_wait();
416} 418}
417 419
418void 420static void
419process_buffered_input_packets(void) 421process_buffered_input_packets(void)
420{ 422{
421 dispatch_run(DISPATCH_NONBLOCK, NULL, compat20 ? xxx_kex : NULL); 423 dispatch_run(DISPATCH_NONBLOCK, NULL, compat20 ? xxx_kex : NULL);
@@ -706,7 +708,7 @@ server_loop2(void)
706 session_close_by_pid(pid, status); 708 session_close_by_pid(pid, status);
707} 709}
708 710
709void 711static void
710server_input_channel_failure(int type, int plen, void *ctxt) 712server_input_channel_failure(int type, int plen, void *ctxt)
711{ 713{
712 debug("Got CHANNEL_FAILURE for keepalive"); 714 debug("Got CHANNEL_FAILURE for keepalive");
@@ -719,7 +721,7 @@ server_input_channel_failure(int type, int plen, void *ctxt)
719} 721}
720 722
721 723
722void 724static void
723server_input_stdin_data(int type, int plen, void *ctxt) 725server_input_stdin_data(int type, int plen, void *ctxt)
724{ 726{
725 char *data; 727 char *data;
@@ -736,7 +738,7 @@ server_input_stdin_data(int type, int plen, void *ctxt)
736 xfree(data); 738 xfree(data);
737} 739}
738 740
739void 741static void
740server_input_eof(int type, int plen, void *ctxt) 742server_input_eof(int type, int plen, void *ctxt)
741{ 743{
742 /* 744 /*
@@ -749,7 +751,7 @@ server_input_eof(int type, int plen, void *ctxt)
749 stdin_eof = 1; 751 stdin_eof = 1;
750} 752}
751 753
752void 754static void
753server_input_window_size(int type, int plen, void *ctxt) 755server_input_window_size(int type, int plen, void *ctxt)
754{ 756{
755 int row = packet_get_int(); 757 int row = packet_get_int();
@@ -763,7 +765,7 @@ server_input_window_size(int type, int plen, void *ctxt)
763 pty_change_window_size(fdin, row, col, xpixel, ypixel); 765 pty_change_window_size(fdin, row, col, xpixel, ypixel);
764} 766}
765 767
766Channel * 768static Channel *
767server_request_direct_tcpip(char *ctype) 769server_request_direct_tcpip(char *ctype)
768{ 770{
769 Channel *c; 771 Channel *c;
@@ -796,7 +798,7 @@ server_request_direct_tcpip(char *ctype)
796 return c; 798 return c;
797} 799}
798 800
799Channel * 801static Channel *
800server_request_session(char *ctype) 802server_request_session(char *ctype)
801{ 803{
802 Channel *c; 804 Channel *c;
@@ -827,7 +829,7 @@ server_request_session(char *ctype)
827 return c; 829 return c;
828} 830}
829 831
830void 832static void
831server_input_channel_open(int type, int plen, void *ctxt) 833server_input_channel_open(int type, int plen, void *ctxt)
832{ 834{
833 Channel *c = NULL; 835 Channel *c = NULL;
@@ -877,7 +879,7 @@ server_input_channel_open(int type, int plen, void *ctxt)
877 xfree(ctype); 879 xfree(ctype);
878} 880}
879 881
880void 882static void
881server_input_global_request(int type, int plen, void *ctxt) 883server_input_global_request(int type, int plen, void *ctxt)
882{ 884{
883 char *rtype; 885 char *rtype;
@@ -927,7 +929,7 @@ server_input_global_request(int type, int plen, void *ctxt)
927 xfree(rtype); 929 xfree(rtype);
928} 930}
929 931
930void 932static void
931server_init_dispatch_20(void) 933server_init_dispatch_20(void)
932{ 934{
933 debug("server_init_dispatch_20"); 935 debug("server_init_dispatch_20");
@@ -947,7 +949,7 @@ server_init_dispatch_20(void)
947 /* rekeying */ 949 /* rekeying */
948 dispatch_set(SSH2_MSG_KEXINIT, &kex_input_kexinit); 950 dispatch_set(SSH2_MSG_KEXINIT, &kex_input_kexinit);
949} 951}
950void 952static void
951server_init_dispatch_13(void) 953server_init_dispatch_13(void)
952{ 954{
953 debug("server_init_dispatch_13"); 955 debug("server_init_dispatch_13");
@@ -962,7 +964,7 @@ server_init_dispatch_13(void)
962 dispatch_set(SSH_MSG_CHANNEL_OPEN_FAILURE, &channel_input_open_failure); 964 dispatch_set(SSH_MSG_CHANNEL_OPEN_FAILURE, &channel_input_open_failure);
963 dispatch_set(SSH_MSG_PORT_OPEN, &channel_input_port_open); 965 dispatch_set(SSH_MSG_PORT_OPEN, &channel_input_port_open);
964} 966}
965void 967static void
966server_init_dispatch_15(void) 968server_init_dispatch_15(void)
967{ 969{
968 server_init_dispatch_13(); 970 server_init_dispatch_13();
@@ -970,7 +972,7 @@ server_init_dispatch_15(void)
970 dispatch_set(SSH_MSG_CHANNEL_CLOSE, &channel_input_ieof); 972 dispatch_set(SSH_MSG_CHANNEL_CLOSE, &channel_input_ieof);
971 dispatch_set(SSH_MSG_CHANNEL_CLOSE_CONFIRMATION, &channel_input_oclose); 973 dispatch_set(SSH_MSG_CHANNEL_CLOSE_CONFIRMATION, &channel_input_oclose);
972} 974}
973void 975static void
974server_init_dispatch(void) 976server_init_dispatch(void)
975{ 977{
976 if (compat20) 978 if (compat20)