The unified diff between revisions [f3f6f865..] and [1c8128fb..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'cli-auth.c'
#
#
# patch "cli-auth.c"
# from [eb6d2144c4d4b27aaa50b7b1a1f2b879a9c0a06f]
# to [3b308d18cc57b0b95f782bc7e4d8ea118a974343]
#
============================================================
--- cli-auth.c eb6d2144c4d4b27aaa50b7b1a1f2b879a9c0a06f
+++ cli-auth.c 3b308d18cc57b0b95f782bc7e4d8ea118a974343
@@ -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;
+}