comparison session.h @ 1733:d529a52b2f7c coverity coverity

merge coverity from main
author Matt Johnston <matt@ucc.asn.au>
date Fri, 26 Jun 2020 21:07:34 +0800
parents 41bf8f216644
children d1b279aa5ed1
comparison
equal deleted inserted replaced
1643:b59623a64678 1733:d529a52b2f7c
36 #include "packet.h" 36 #include "packet.h"
37 #include "tcpfwd.h" 37 #include "tcpfwd.h"
38 #include "chansession.h" 38 #include "chansession.h"
39 #include "dbutil.h" 39 #include "dbutil.h"
40 #include "netio.h" 40 #include "netio.h"
41 #if DROPBEAR_PLUGIN
42 #include "pubkeyapi.h"
43 #endif
44 #include "gcm.h"
45 #include "chachapoly.h"
41 46
42 void common_session_init(int sock_in, int sock_out); 47 void common_session_init(int sock_in, int sock_out);
43 void session_loop(void(*loophandler)(void)) ATTRIB_NORETURN; 48 void session_loop(void(*loophandler)(void)) ATTRIB_NORETURN;
44 void session_cleanup(void); 49 void session_cleanup(void);
45 void send_session_identification(void); 50 void send_session_identification(void);
72 #ifndef DISABLE_ZLIB 77 #ifndef DISABLE_ZLIB
73 z_streamp zstream; 78 z_streamp zstream;
74 #endif 79 #endif
75 /* actual keys */ 80 /* actual keys */
76 union { 81 union {
82 #if DROPBEAR_ENABLE_CBC_MODE
77 symmetric_CBC cbc; 83 symmetric_CBC cbc;
84 #endif
78 #if DROPBEAR_ENABLE_CTR_MODE 85 #if DROPBEAR_ENABLE_CTR_MODE
79 symmetric_CTR ctr; 86 symmetric_CTR ctr;
87 #endif
88 #if DROPBEAR_ENABLE_GCM_MODE
89 dropbear_gcm_state gcm;
90 #endif
91 #if DROPBEAR_CHACHA20POLY1305
92 dropbear_chachapoly_state chachapoly;
80 #endif 93 #endif
81 } cipher_state; 94 } cipher_state;
82 unsigned char mackey[MAX_MAC_LEN]; 95 unsigned char mackey[MAX_MAC_LEN];
83 int valid; 96 int valid;
84 }; 97 };
87 100
88 struct key_context_directional recv; 101 struct key_context_directional recv;
89 struct key_context_directional trans; 102 struct key_context_directional trans;
90 103
91 const struct dropbear_kex *algo_kex; 104 const struct dropbear_kex *algo_kex;
92 int algo_hostkey; 105 enum signkey_type algo_hostkey; /* server key type */
106 enum signature_type algo_signature; /* server signature type */
93 107
94 int allow_compress; /* whether compression has started (useful in 108 int allow_compress; /* whether compression has started (useful in
95 [email protected] delayed compression case) */ 109 [email protected] delayed compression case) */
96 }; 110 };
97 111
179 buffer* transkexinit; /* the kexinit packet we send should be kept so we 193 buffer* transkexinit; /* the kexinit packet we send should be kept so we
180 can add it to the hash when generating keys */ 194 can add it to the hash when generating keys */
181 195
182 /* Enables/disables compression */ 196 /* Enables/disables compression */
183 algo_type *compress_algos; 197 algo_type *compress_algos;
198
199 /* Other side allows SSH_MSG_EXT_INFO. Currently only set for server */
200 int allow_ext_info;
184 201
185 /* a list of queued replies that should be sent after a KEX has 202 /* a list of queued replies that should be sent after a KEX has
186 concluded (ie, while dataallowed was unset)*/ 203 concluded (ie, while dataallowed was unset)*/
187 struct packetlist *reply_queue_head, *reply_queue_tail; 204 struct packetlist *reply_queue_head, *reply_queue_tail;
188 205
214 231
215 /* this is set when we get SIGINT or SIGTERM, the handler is in main.c */ 232 /* this is set when we get SIGINT or SIGTERM, the handler is in main.c */
216 volatile int exitflag; 233 volatile int exitflag;
217 /* set once the ses structure (and cli_ses/svr_ses) have been populated to their initial state */ 234 /* set once the ses structure (and cli_ses/svr_ses) have been populated to their initial state */
218 int init_done; 235 int init_done;
236
237 #if DROPBEAR_PLUGIN
238 struct PluginSession * plugin_session;
239 #endif
219 }; 240 };
220 241
221 struct serversession { 242 struct serversession {
222 243
223 /* Server specific options */ 244 /* Server specific options */
239 260
240 #if DROPBEAR_VFORK 261 #if DROPBEAR_VFORK
241 pid_t server_pid; 262 pid_t server_pid;
242 #endif 263 #endif
243 264
265 #if DROPBEAR_PLUGIN
266 /* The shared library handle */
267 void *plugin_handle;
268
269 /* The instance created by the plugin_new function */
270 struct PluginInstance *plugin_instance;
271 #endif
244 }; 272 };
245 273
246 typedef enum { 274 typedef enum {
247 KEX_NOTHING, 275 KEX_NOTHING,
248 KEXINIT_RCVD, 276 KEXINIT_RCVD,
267 struct kex_curve25519_param *curve25519_param; 295 struct kex_curve25519_param *curve25519_param;
268 const struct dropbear_kex *param_kex_algo; /* KEX algorithm corresponding to current dh_e and dh_x */ 296 const struct dropbear_kex *param_kex_algo; /* KEX algorithm corresponding to current dh_e and dh_x */
269 297
270 cli_kex_state kex_state; /* Used for progressing KEX */ 298 cli_kex_state kex_state; /* Used for progressing KEX */
271 cli_state state; /* Used to progress auth/channelsession etc */ 299 cli_state state; /* Used to progress auth/channelsession etc */
272 unsigned donefirstkex : 1; /* Set when we set sentnewkeys, never reset */
273 300
274 int tty_raw_mode; /* Whether we're in raw mode (and have to clean up) */ 301 int tty_raw_mode; /* Whether we're in raw mode (and have to clean up) */
275 struct termios saved_tio; 302 struct termios saved_tio;
276 int stdincopy; 303 int stdincopy;
277 int stdinflags; 304 int stdinflags;
295 info request from the server for 322 info request from the server for
296 interactive auth.*/ 323 interactive auth.*/
297 #endif 324 #endif
298 sign_key *lastprivkey; 325 sign_key *lastprivkey;
299 326
327 buffer *server_sig_algs;
328
300 int retval; /* What the command exit status was - we emulate it */ 329 int retval; /* What the command exit status was - we emulate it */
301 #if 0 330 #if 0
302 TODO 331 TODO
303 struct AgentkeyList *agentkeys; /* Keys to use for public-key auth */ 332 struct AgentkeyList *agentkeys; /* Keys to use for public-key auth */
304 #endif 333 #endif