summaryrefslogtreecommitdiffhomepage
path: root/cli-auth.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2006-03-08 12:53:09 +0000
committerMatt Johnston <matt@ucc.asn.au>2006-03-08 12:53:09 +0000
commite4697de1757849bccfeb201ed2f2f98996e11934 (patch)
tree4490ac0dce1170ba5d1f0db4c9dc68ab4a764aa2 /cli-auth.c
parent1dc06524446b6ed8fa152ff99b0d5763214737f2 (diff)
parentb5989964979e3ee885eeb6d0758d96605b131a7b (diff)
merge of 4cbdd6e0a0d8c061075b9ed7609a06c4547f67d3
and 5d396842815593611f0d61762440145d1fc74d5a --HG-- extra : convert_revision : 4c883eb469d2d251ee8abddbc11ae4005db6da17
Diffstat (limited to 'cli-auth.c')
-rw-r--r--cli-auth.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/cli-auth.c b/cli-auth.c
index 6a6d53a..d08de9a 100644
--- a/cli-auth.c
+++ b/cli-auth.c
@@ -278,3 +278,18 @@ void cli_auth_try() {
TRACE(("leave cli_auth_try"))
}
+
+/* A helper for getpass() that exits if the user cancels. The returned
+ * password is statically allocated by getpass() */
+char* getpass_or_cancel()
+{
+ char* password = NULL;
+
+ password = getpass("Password: ");
+
+ /* 0x03 is a ctrl-c character in the buffer. */
+ if (password == NULL || strchr(password, '\3') != NULL) {
+ dropbear_close("Interrupted.");
+ }
+ return password;
+}