diff options
Diffstat (limited to 'serverloop.c')
-rw-r--r-- | serverloop.c | 46 |
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" |
38 | RCSID("$OpenBSD: serverloop.c,v 1.69 2001/06/20 13:56:39 markus Exp $"); | 38 | RCSID("$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 | |||
87 | static volatile int child_terminated; /* The child has terminated. */ | 88 | static volatile int child_terminated; /* The child has terminated. */ |
88 | 89 | ||
89 | void server_init_dispatch(void); | 90 | /* prototypes */ |
91 | static void server_init_dispatch(void); | ||
90 | 92 | ||
91 | int client_alive_timeouts = 0; | 93 | int client_alive_timeouts = 0; |
92 | 94 | ||
93 | void | 95 | static void |
94 | sigchld_handler(int sig) | 96 | sigchld_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 | */ |
107 | void | 109 | static void |
108 | make_packets_from_stderr_data(void) | 110 | make_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 | */ |
136 | void | 138 | static void |
137 | make_packets_from_stdout_data(void) | 139 | make_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 | */ |
167 | void | 169 | static void |
168 | wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, int *maxfdp, | 170 | wait_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 | */ |
289 | void | 291 | static void |
290 | process_input(fd_set * readset) | 292 | process_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 | */ |
345 | void | 347 | static void |
346 | process_output(fd_set * writeset) | 348 | process_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 | */ |
393 | void | 395 | static void |
394 | drain_output(void) | 396 | drain_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 | ||
418 | void | 420 | static void |
419 | process_buffered_input_packets(void) | 421 | process_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 | ||
709 | void | 711 | static void |
710 | server_input_channel_failure(int type, int plen, void *ctxt) | 712 | server_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 | ||
722 | void | 724 | static void |
723 | server_input_stdin_data(int type, int plen, void *ctxt) | 725 | server_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 | ||
739 | void | 741 | static void |
740 | server_input_eof(int type, int plen, void *ctxt) | 742 | server_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 | ||
752 | void | 754 | static void |
753 | server_input_window_size(int type, int plen, void *ctxt) | 755 | server_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 | ||
766 | Channel * | 768 | static Channel * |
767 | server_request_direct_tcpip(char *ctype) | 769 | server_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 | ||
799 | Channel * | 801 | static Channel * |
800 | server_request_session(char *ctype) | 802 | server_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 | ||
830 | void | 832 | static void |
831 | server_input_channel_open(int type, int plen, void *ctxt) | 833 | server_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 | ||
880 | void | 882 | static void |
881 | server_input_global_request(int type, int plen, void *ctxt) | 883 | server_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 | ||
930 | void | 932 | static void |
931 | server_init_dispatch_20(void) | 933 | server_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 | } |
950 | void | 952 | static void |
951 | server_init_dispatch_13(void) | 953 | server_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 | } |
965 | void | 967 | static void |
966 | server_init_dispatch_15(void) | 968 | server_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 | } |
973 | void | 975 | static void |
974 | server_init_dispatch(void) | 976 | server_init_dispatch(void) |
975 | { | 977 | { |
976 | if (compat20) | 978 | if (compat20) |