Mercurial > dropbear
comparison cli-auth.c @ 330:5488db2e9e4e
merge of 332f709a4cb39cde4cedab7c3be89e05f3023067
and ca4ca78b82c5d430c69ce01bf794e8886ce81431
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 10 Jun 2006 16:39:40 +0000 |
parents | baea1d43e7eb |
children | 8f3ec7c104d9 |
comparison
equal
deleted
inserted
replaced
329:8ed0dce45126 | 330:5488db2e9e4e |
---|---|
234 cli_ses.lastauthtype = AUTH_TYPE_NONE; | 234 cli_ses.lastauthtype = AUTH_TYPE_NONE; |
235 } | 235 } |
236 | 236 |
237 void cli_auth_try() { | 237 void cli_auth_try() { |
238 | 238 |
239 int finished = 0; | |
239 TRACE(("enter cli_auth_try")) | 240 TRACE(("enter cli_auth_try")) |
240 int finished = 0; | |
241 | 241 |
242 CHECKCLEARTOWRITE(); | 242 CHECKCLEARTOWRITE(); |
243 | 243 |
244 /* Order to try is pubkey, interactive, password. | 244 /* Order to try is pubkey, interactive, password. |
245 * As soon as "finished" is set for one, we don't do any more. */ | 245 * As soon as "finished" is set for one, we don't do any more. */ |
276 dropbear_exit("No auth methods could be used."); | 276 dropbear_exit("No auth methods could be used."); |
277 } | 277 } |
278 | 278 |
279 TRACE(("leave cli_auth_try")) | 279 TRACE(("leave cli_auth_try")) |
280 } | 280 } |
281 | |
282 /* A helper for getpass() that exits if the user cancels. The returned | |
283 * password is statically allocated by getpass() */ | |
284 char* getpass_or_cancel() | |
285 { | |
286 char* password = NULL; | |
287 | |
288 password = getpass("Password: "); | |
289 | |
290 /* 0x03 is a ctrl-c character in the buffer. */ | |
291 if (password == NULL || strchr(password, '\3') != NULL) { | |
292 dropbear_close("Interrupted."); | |
293 } | |
294 return password; | |
295 } |