~ubuntu-branches/debian/stretch/dropbear/stretch

« back to all changes in this revision

Viewing changes to session.h

  • Committer: Package Import Robot
  • Author(s): Gerrit Pape, Matt Johnston, Gerrit Pape
  • Date: 2013-10-25 15:00:48 UTC
  • mfrom: (1.4.6)
  • Revision ID: package-import@ubuntu.com-20131025150048-3jq765x96xayk392
Tags: 2013.60-1
[ Matt Johnston ]
* New upstream release.

[ Gerrit Pape ]
* debian/diff/0004-cve-2013-4421.diff, 0005-user-disclosure.diff:
  remove; fixed upstream.
* debian/dropbear.postinst: don't fail if initramfs-tools it not
  installed (closes: #692653).

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
 
45
45
void common_session_init(int sock_in, int sock_out);
46
46
void session_loop(void(*loophandler)());
47
 
void common_session_cleanup();
48
 
void session_identification();
 
47
void session_cleanup();
 
48
void send_session_identification();
49
49
void send_msg_ignore();
50
50
 
51
51
const char* get_user_shell();
58
58
 
59
59
/* Client */
60
60
void cli_session(int sock_in, int sock_out);
61
 
void cli_session_cleanup();
62
61
void cleantext(unsigned char* dirtytext);
63
62
 
64
63
/* crypto parameters that are stored individually for transmit and receive */
65
64
struct key_context_directional {
66
 
        const struct dropbear_cipher *algo_crypt; /* NULL for none */
 
65
        const struct dropbear_cipher *algo_crypt;
67
66
        const struct dropbear_cipher_mode *crypt_mode;
68
 
        const struct dropbear_hash *algo_mac; /* NULL for none */
 
67
        const struct dropbear_hash *algo_mac;
69
68
        int hash_index; /* lookup for libtomcrypt */
70
69
        char algo_comp; /* compression */
71
70
#ifndef DISABLE_ZLIB
78
77
                symmetric_CTR ctr;
79
78
#endif
80
79
        } cipher_state;
81
 
        unsigned char mackey[MAX_MAC_KEY];
 
80
        unsigned char mackey[MAX_MAC_LEN];
 
81
        int valid;
82
82
};
83
83
 
84
84
struct key_context {
111
111
        int sock_in;
112
112
        int sock_out;
113
113
 
114
 
        unsigned char *remoteident;
 
114
        /* remotehost will be initially NULL as we delay
 
115
         * reading the remote version string. it will be set
 
116
         * by the time any recv_() packet methods are called */
 
117
        unsigned char *remoteident; 
115
118
 
116
119
        int maxfd; /* the maximum file descriptor to check with select() */
117
120
 
132
135
        unsigned dataallowed : 1; /* whether we can send data packets or we are in
133
136
                                                                 the middle of a KEX or something */
134
137
 
135
 
        unsigned char requirenext; /* byte indicating what packet we require next, 
136
 
                                                                or 0x00 for any */
 
138
        unsigned char requirenext[2]; /* bytes indicating what packets we require next, 
 
139
                                                                         or 0x00 for any. Second option can only be
 
140
                                                                         used if the first byte is also set */
137
141
 
138
142
        unsigned char ignorenext; /* whether to ignore the next packet,
139
143
                                                                 used for kex_follows stuff */
169
173
           concluded (ie, while dataallowed was unset)*/
170
174
        struct packetlist *reply_queue_head, *reply_queue_tail;
171
175
 
172
 
        algo_type*(*buf_match_algo)(buffer*buf, algo_type localalgos[],
173
 
                        int *goodguess); /* The function to use to choose which algorithm
174
 
                                                                to use from the ones presented by the remote
175
 
                                                                side. Is specific to the client/server mode,
176
 
                                                                hence the function-pointer callback.*/
177
 
 
178
176
        void(*remoteclosed)(); /* A callback to handle closure of the
179
177
                                                                          remote connection */
180
178
 
 
179
        void(*extra_session_cleanup)(); /* client or server specific cleanup */
 
180
        void(*send_kex_first_guess)();
181
181
 
182
182
        struct AuthState authstate; /* Common amongst client and server, since most
183
183
                                                                   struct elements are common */
218
218
        /* The resolved remote address, used for lastlog etc */
219
219
        char *remotehost;
220
220
 
221
 
#ifdef __uClinux__
 
221
#ifdef USE_VFORK
222
222
        pid_t server_pid;
223
223
#endif
224
224
 
233
233
 
234
234
typedef enum {
235
235
        STATE_NOTHING,
236
 
        SERVICE_AUTH_REQ_SENT,
237
 
        SERVICE_AUTH_ACCEPT_RCVD,
238
 
        SERVICE_CONN_REQ_SENT,
239
 
        SERVICE_CONN_ACCEPT_RCVD,
240
236
        USERAUTH_REQ_SENT,
241
237
        USERAUTH_FAIL_RCVD,
242
238
        USERAUTH_SUCCESS_RCVD,
246
242
struct clientsession {
247
243
 
248
244
        mp_int *dh_e, *dh_x; /* Used during KEX */
 
245
        int dh_val_algo; /* KEX algorithm corresponding to current dh_e and dh_x */
249
246
        cli_kex_state kex_state; /* Used for progressing KEX */
250
247
        cli_state state; /* Used to progress auth/channelsession etc */
251
248
        unsigned donefirstkex : 1; /* Set when we set sentnewkeys, never reset */
259
256
        int stderrcopy;
260
257
        int stderrflags;
261
258
 
 
259
        /* for escape char handling */
 
260
        int last_char;
 
261
 
262
262
        int winchange; /* Set to 1 when a windowchange signal happens */
263
263
 
264
264
        int lastauthtype; /* either AUTH_TYPE_PUBKEY or AUTH_TYPE_PASSWORD,
269
269
        int interact_request_received; /* flag whether we've received an 
270
270
                                                                          info request from the server for
271
271
                                                                          interactive auth.*/
 
272
 
 
273
        int cipher_none_after_auth; /* Set to 1 if the user requested "none"
 
274
                                                                   auth */
272
275
#endif
273
276
        sign_key *lastprivkey;
274
277