Mercurial > dropbear
comparison session.h @ 33:f789045062e6
Progressing client support
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 27 Jul 2004 16:30:46 +0000 |
parents | 0969767bca0d |
children | e2a1eaa19f22 |
comparison
equal
deleted
inserted
replaced
32:8fd0cdbb5b1b | 33:f789045062e6 |
---|---|
43 void session_loop(void(*loophandler)()); | 43 void session_loop(void(*loophandler)()); |
44 void common_session_cleanup(); | 44 void common_session_cleanup(); |
45 void checktimeouts(); | 45 void checktimeouts(); |
46 void session_identification(); | 46 void session_identification(); |
47 | 47 |
48 extern void(*session_remoteclosed)(); | |
49 | 48 |
50 /* Server */ | 49 /* Server */ |
51 void svr_session(int sock, int childpipe, char *remotehost); | 50 void svr_session(int sock, int childpipe, char *remotehost); |
52 void svr_dropbear_exit(int exitcode, const char* format, va_list param); | 51 void svr_dropbear_exit(int exitcode, const char* format, va_list param); |
53 void svr_dropbear_log(int priority, const char* format, va_list param); | 52 void svr_dropbear_log(int priority, const char* format, va_list param); |
133 unsigned char hash[SHA1_HASH_SIZE]; /* the hash*/ | 132 unsigned char hash[SHA1_HASH_SIZE]; /* the hash*/ |
134 buffer* kexhashbuf; /* session hash buffer calculated from various packets*/ | 133 buffer* kexhashbuf; /* session hash buffer calculated from various packets*/ |
135 buffer* transkexinit; /* the kexinit packet we send should be kept so we | 134 buffer* transkexinit; /* the kexinit packet we send should be kept so we |
136 can add it to the hash when generating keys */ | 135 can add it to the hash when generating keys */ |
137 | 136 |
138 | 137 algo_type*(*buf_match_algo)(buffer*buf, algo_type localalgos[], |
139 unsigned char authdone; /* Indicates when authentication has been | 138 int *goodguess); /* The function to use to choose which algorithm |
140 completed. This applies to both client and | 139 to use from the ones presented by the remote |
141 server - in the server it gets set to 1 when | 140 side. Is specific to the client/server mode, |
142 authentication is successful, in the client it | 141 hence the function-pointer callback.*/ |
143 is set when the server has told us that auth | 142 |
144 succeeded */ | 143 void(*remoteclosed)(); /* A callback to handle closure of the |
144 remote connection */ | |
145 | |
146 | |
147 struct AuthState authstate; /* Common amongst client and server, since most | |
148 struct elements are common */ | |
145 | 149 |
146 /* Channel related */ | 150 /* Channel related */ |
147 struct Channel ** channels; /* these pointers may be null */ | 151 struct Channel ** channels; /* these pointers may be null */ |
148 unsigned int chansize; /* the number of Channel*s allocated for channels */ | 152 unsigned int chansize; /* the number of Channel*s allocated for channels */ |
149 const struct ChanType **chantypes; /* The valid channel types */ | 153 const struct ChanType **chantypes; /* The valid channel types */ |
163 struct serversession { | 167 struct serversession { |
164 | 168 |
165 /* Server specific options */ | 169 /* Server specific options */ |
166 int childpipe; /* kept open until we successfully authenticate */ | 170 int childpipe; /* kept open until we successfully authenticate */ |
167 /* userauth */ | 171 /* userauth */ |
168 struct AuthState authstate; | |
169 | 172 |
170 struct ChildPid * childpids; /* array of mappings childpid<->channel */ | 173 struct ChildPid * childpids; /* array of mappings childpid<->channel */ |
171 unsigned int childpidsize; | 174 unsigned int childpidsize; |
172 | 175 |
173 }; | 176 }; |
174 | 177 |
175 typedef enum { | 178 typedef enum { |
176 NOTHING, | 179 KEX_NOTHING, |
177 KEXINIT_RCVD, | 180 KEXINIT_RCVD, |
178 KEXDH_INIT_SENT, | 181 KEXDH_INIT_SENT, |
179 KEXDH_REPLY_RCVD, | 182 KEXDONE, |
183 | |
184 } cli_kex_state; | |
185 | |
186 typedef enum { | |
187 STATE_NOTHING, | |
188 SERVICE_AUTH_REQ_SENT, | |
189 SERVICE_AUTH_ACCEPT_RCVD, | |
190 SERVICE_CONN_REQ_SENT, | |
191 SERVICE_CONN_ACCEPT_RCVD, | |
192 USERAUTH_METHODS_SENT, | |
193 USERAUTH_REQ_SENT, | |
194 USERAUTH_FAIL_RCVD, | |
180 | 195 |
181 } cli_state; | 196 } cli_state; |
182 | 197 |
183 struct clientsession { | 198 struct clientsession { |
184 | 199 |
185 mp_int *dh_e, *dh_x; /* Used during KEX */ | 200 mp_int *dh_e, *dh_x; /* Used during KEX */ |
186 cli_state state; /* Used to progress the KEX/auth/channelsession etc */ | 201 cli_kex_state kex_state; /* Used for progressing KEX */ |
202 cli_state state; /* Used to progress auth/channelsession etc */ | |
187 int something; /* XXX */ | 203 int something; /* XXX */ |
188 unsigned donefirstkex : 1; /* Set when we set sentnewkeys, never reset */ | 204 unsigned donefirstkex : 1; /* Set when we set sentnewkeys, never reset */ |
189 | 205 |
190 }; | 206 }; |
191 | 207 |