summaryrefslogtreecommitdiff
path: root/clientloop.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2015-02-23 16:33:25 +0000
committerDamien Miller <djm@mindrot.org>2015-02-24 03:47:44 +1100
commitf2293a65392b54ac721f66bc0b44462e8d1d81f8 (patch)
tree667d8ae6946e122d5598fbd32cf26cde582d78fd /clientloop.c
parentf2004cd1adf34492eae0a44b1ef84e0e31b06088 (diff)
upstream commit
fix setting/clearing of TTY raw mode around UpdateHostKeys=ask confirmation question; reported by Herb Goldman
Diffstat (limited to 'clientloop.c')
-rw-r--r--clientloop.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/clientloop.c b/clientloop.c
index ca3a4595b..8969869b6 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: clientloop.c,v 1.270 2015/02/20 22:17:21 djm Exp $ */ 1/* $OpenBSD: clientloop.c,v 1.271 2015/02/23 16:33:25 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -2170,7 +2170,8 @@ hostkeys_find(struct hostkey_foreach_line *l, void *_ctx)
2170static void 2170static void
2171update_known_hosts(struct hostkeys_update_ctx *ctx) 2171update_known_hosts(struct hostkeys_update_ctx *ctx)
2172{ 2172{
2173 int r, loglevel = options.update_hostkeys == SSH_UPDATE_HOSTKEYS_ASK ? 2173 int r, was_raw = 0;
2174 int loglevel = options.update_hostkeys == SSH_UPDATE_HOSTKEYS_ASK ?
2174 SYSLOG_LEVEL_INFO : SYSLOG_LEVEL_VERBOSE; 2175 SYSLOG_LEVEL_INFO : SYSLOG_LEVEL_VERBOSE;
2175 char *fp, *response; 2176 char *fp, *response;
2176 size_t i; 2177 size_t i;
@@ -2194,7 +2195,10 @@ update_known_hosts(struct hostkeys_update_ctx *ctx)
2194 free(fp); 2195 free(fp);
2195 } 2196 }
2196 if (options.update_hostkeys == SSH_UPDATE_HOSTKEYS_ASK) { 2197 if (options.update_hostkeys == SSH_UPDATE_HOSTKEYS_ASK) {
2197 leave_raw_mode(options.request_tty == REQUEST_TTY_FORCE); 2198 if (get_saved_tio() != NULL) {
2199 leave_raw_mode(1);
2200 was_raw = 1;
2201 }
2198 response = NULL; 2202 response = NULL;
2199 for (i = 0; !quit_pending && i < 3; i++) { 2203 for (i = 0; !quit_pending && i < 3; i++) {
2200 free(response); 2204 free(response);
@@ -2214,7 +2218,8 @@ update_known_hosts(struct hostkeys_update_ctx *ctx)
2214 if (quit_pending || i >= 3 || response == NULL) 2218 if (quit_pending || i >= 3 || response == NULL)
2215 options.update_hostkeys = 0; 2219 options.update_hostkeys = 0;
2216 free(response); 2220 free(response);
2217 enter_raw_mode(options.request_tty == REQUEST_TTY_FORCE); 2221 if (was_raw)
2222 enter_raw_mode(1);
2218 } 2223 }
2219 2224
2220 /* 2225 /*