comparison session.h @ 1495:0c16b4ccbd54

make signal flags volatile, simplify handling
author Matt Johnston <matt@ucc.asn.au>
date Wed, 14 Feb 2018 23:06:01 +0800
parents 533e070b3126
children d68d61e7056a
comparison
equal deleted inserted replaced
1494:da095983a60b 1495:0c16b4ccbd54
38 #include "tcpfwd.h" 38 #include "tcpfwd.h"
39 #include "chansession.h" 39 #include "chansession.h"
40 #include "dbutil.h" 40 #include "dbutil.h"
41 #include "netio.h" 41 #include "netio.h"
42 42
43 extern int sessinitdone; /* Is set to 0 somewhere */
44 extern int exitflag;
45
46 void common_session_init(int sock_in, int sock_out); 43 void common_session_init(int sock_in, int sock_out);
47 void session_loop(void(*loophandler)()) ATTRIB_NORETURN; 44 void session_loop(void(*loophandler)()) ATTRIB_NORETURN;
48 void session_cleanup(void); 45 void session_cleanup(void);
49 void send_session_identification(void); 46 void send_session_identification(void);
50 void send_msg_ignore(void); 47 void send_msg_ignore(void);
155 152
156 unsigned char lastpacket; /* What the last received packet type was */ 153 unsigned char lastpacket; /* What the last received packet type was */
157 154
158 int signal_pipe[2]; /* stores endpoints of a self-pipe used for 155 int signal_pipe[2]; /* stores endpoints of a self-pipe used for
159 race-free signal handling */ 156 race-free signal handling */
157 int channel_signal_pending; /* Flag set when the signal pipe is triggered */
160 158
161 m_list conn_pending; 159 m_list conn_pending;
162 160
163 /* time of the last packet send/receive, for keepalive. Not real-world clock */ 161 /* time of the last packet send/receive, for keepalive. Not real-world clock */
164 time_t last_packet_time_keepalive_sent; 162 time_t last_packet_time_keepalive_sent;
201 /* Channel related */ 199 /* Channel related */
202 struct Channel ** channels; /* these pointers may be null */ 200 struct Channel ** channels; /* these pointers may be null */
203 unsigned int chansize; /* the number of Channel*s allocated for channels */ 201 unsigned int chansize; /* the number of Channel*s allocated for channels */
204 unsigned int chancount; /* the number of Channel*s in use */ 202 unsigned int chancount; /* the number of Channel*s in use */
205 const struct ChanType **chantypes; /* The valid channel types */ 203 const struct ChanType **chantypes; /* The valid channel types */
206 int channel_signal_pending; /* Flag set by sigchld handler */
207 204
208 /* TCP priority level for the main "port 22" tcp socket */ 205 /* TCP priority level for the main "port 22" tcp socket */
209 enum dropbear_prio socket_prio; 206 enum dropbear_prio socket_prio;
210 207
211 /* TCP forwarding - where manage listeners */ 208 /* TCP forwarding - where manage listeners */
214 211
215 /* Whether to allow binding to privileged ports (<1024). This doesn't 212 /* Whether to allow binding to privileged ports (<1024). This doesn't
216 * really belong here, but nowhere else fits nicely */ 213 * really belong here, but nowhere else fits nicely */
217 int allowprivport; 214 int allowprivport;
218 215
216 /* this is set when we get SIGINT or SIGTERM, the handler is in main.c */
217 volatile int exitflag;
218 /* set once the ses structure (and cli_ses/svr_ses) have been populated to their initial state */
219 int init_done;
219 }; 220 };
220 221
221 struct serversession { 222 struct serversession {
222 223
223 /* Server specific options */ 224 /* Server specific options */
281 int stderrflags; 282 int stderrflags;
282 283
283 /* for escape char handling */ 284 /* for escape char handling */
284 int last_char; 285 int last_char;
285 286
286 int winchange; /* Set to 1 when a windowchange signal happens */ 287 volatile int winchange; /* Set to 1 when a windowchange signal happens */
287 288
288 int lastauthtype; /* either AUTH_TYPE_PUBKEY or AUTH_TYPE_PASSWORD, 289 int lastauthtype; /* either AUTH_TYPE_PUBKEY or AUTH_TYPE_PASSWORD,
289 for the last type of auth we tried */ 290 for the last type of auth we tried */
290 int ignore_next_auth_response; 291 int ignore_next_auth_response;
291 #if DROPBEAR_CLI_INTERACT_AUTH 292 #if DROPBEAR_CLI_INTERACT_AUTH