summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2015-02-23 16:33:26 +0000
committerDamien Miller <djm@cvs.openbsd.org>2015-02-23 16:33:26 +0000
commitd66fb985479e97bf993d23e0487bcce0709ae45c (patch)
tree174d88ec820a9e63d03e4baffd4f4264eab6efc9
parent1e43a67d3107d5755daa937a3665abbbd620d452 (diff)
fix setting/clearing of TTY raw mode around UpdateHostKeys=ask
confirmation question; reported by Herb Goldman
-rw-r--r--usr.bin/ssh/clientloop.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/usr.bin/ssh/clientloop.c b/usr.bin/ssh/clientloop.c
index 644a1f2537f..980189a7a31 100644
--- a/usr.bin/ssh/clientloop.c
+++ b/usr.bin/ssh/clientloop.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clientloop.c,v 1.270 2015/02/20 22:17:21 djm Exp $ */
+/* $OpenBSD: clientloop.c,v 1.271 2015/02/23 16:33:25 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -2152,7 +2152,8 @@ hostkeys_find(struct hostkey_foreach_line *l, void *_ctx)
static void
update_known_hosts(struct hostkeys_update_ctx *ctx)
{
- int r, loglevel = options.update_hostkeys == SSH_UPDATE_HOSTKEYS_ASK ?
+ int r, was_raw = 0;
+ int loglevel = options.update_hostkeys == SSH_UPDATE_HOSTKEYS_ASK ?
SYSLOG_LEVEL_INFO : SYSLOG_LEVEL_VERBOSE;
char *fp, *response;
size_t i;
@@ -2176,7 +2177,10 @@ update_known_hosts(struct hostkeys_update_ctx *ctx)
free(fp);
}
if (options.update_hostkeys == SSH_UPDATE_HOSTKEYS_ASK) {
- leave_raw_mode(options.request_tty == REQUEST_TTY_FORCE);
+ if (get_saved_tio() != NULL) {
+ leave_raw_mode(1);
+ was_raw = 1;
+ }
response = NULL;
for (i = 0; !quit_pending && i < 3; i++) {
free(response);
@@ -2196,7 +2200,8 @@ update_known_hosts(struct hostkeys_update_ctx *ctx)
if (quit_pending || i >= 3 || response == NULL)
options.update_hostkeys = 0;
free(response);
- enter_raw_mode(options.request_tty == REQUEST_TTY_FORCE);
+ if (was_raw)
+ enter_raw_mode(1);
}
/*