comparison cli-auth.c @ 302:973fccb59ea4 ucc-axis-hack

propagate from branch 'au.asn.ucc.matt.dropbear' (head 11034278bd1917bebcbdc69cf53b1891ce9db121) to branch 'au.asn.ucc.matt.dropbear.ucc-axis-hack' (head 10a1f614fec73d0820c3f61160d9db409b9beb46)
author Matt Johnston <matt@ucc.asn.au>
date Sat, 25 Mar 2006 12:59:58 +0000
parents baea1d43e7eb
children 8f3ec7c104d9
comparison
equal deleted inserted replaced
299:740e782679be 302:973fccb59ea4
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 }