changeset 170:a62cb364f615

Read "y/n" response for fingerprints from /dev/tty directly so that dbclient will work with scp.
author Matt Johnston <matt@ucc.asn.au>
date Tue, 11 Jan 2005 16:17:03 +0000
parents 21e99b6190dd
children 8e68dbe8687b
files CHANGES cli-kex.c
diffstat 2 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES	Fri Jan 07 16:39:48 2005 +0000
+++ b/CHANGES	Tue Jan 11 16:17:03 2005 +0000
@@ -1,3 +1,6 @@
+- Read "y/n" response for fingerprints from /dev/tty directly so that dbclient
+  will work with scp.
+
 0.44 - Mon Jan 3 2005
 
 - SECURITY: Fix for PAM auth so that usernames are logged and conversation
--- a/cli-kex.c	Fri Jan 07 16:39:48 2005 +0000
+++ b/cli-kex.c	Tue Jan 11 16:17:03 2005 +0000
@@ -115,13 +115,23 @@
 static void ask_to_confirm(unsigned char* keyblob, unsigned int keybloblen) {
 
 	char* fp = NULL;
+	FILE *tty = NULL;
+	char response = 'z';
 
 	fp = sign_key_fingerprint(keyblob, keybloblen);
 	fprintf(stderr, "\nHost '%s' is not in the trusted hosts file.\n(fingerprint %s)\nDo you want to continue connecting? (y/n)\n", 
 			cli_opts.remotehost, 
 			fp);
 
-	if (getc(stdin) == 'y') {
+	tty = fopen(_PATH_TTY, "r");
+	if (tty) {
+		response = getc(tty);
+		fclose(tty);
+	} else {
+		response = getc(stdin);
+	}
+
+	if (response == 'y') {
 		m_free(fp);
 		return;
 	}