diff cli-authpasswd.c @ 463:33d5e9fb0f78 agent-client

propagate from branch 'au.asn.ucc.matt.dropbear' (head fb7080ca6e254faaf7cfaee93b0ab6ab6de4ed59) to branch 'au.asn.ucc.matt.dropbear.cli-agent' (head 78d02301ae8310efa2639f15da0ea62dea110e4b)
author Matt Johnston <matt@ucc.asn.au>
date Thu, 29 Nov 2007 11:38:06 +0000
parents bde853a9e680
children c45d65392c1a
line wrap: on
line diff
--- a/cli-authpasswd.c	Thu Aug 16 13:34:37 2007 +0000
+++ b/cli-authpasswd.c	Thu Nov 29 11:38:06 2007 +0000
@@ -38,7 +38,9 @@
 	char* askpass_prog = NULL;
 
 	askpass_prog = getenv("SSH_ASKPASS");
-	return askpass_prog && !isatty(STDIN_FILENO) && getenv("DISPLAY");
+	return askpass_prog && 
+		((!isatty(STDIN_FILENO) && getenv("DISPLAY") )
+		 	|| getenv("SSH_ASKPASS_ALWAYS"));
 }
 
 /* returns a statically allocated password from a helper app, or NULL
@@ -125,10 +127,16 @@
 				cli_opts.username, cli_opts.remotehost);
 #ifdef ENABLE_CLI_ASKPASS_HELPER
 	if (want_askpass())
+	{
 		password = gui_getpass(prompt);
-	else
+		if (!password) {
+			dropbear_exit("No password");
+		}
+	} else
 #endif
+	{
 		password = getpass_or_cancel(prompt);
+	}
 
 	buf_putbyte(ses.writepayload, SSH_MSG_USERAUTH_REQUEST);