summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/packet.c
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2020-01-30 07:20:06 +0000
committerDamien Miller <djm@cvs.openbsd.org>2020-01-30 07:20:06 +0000
commitdb979b512363863c86cd89ac51e99bebcb7cf348 (patch)
treec4362f614154d6c1d6965b709ae56287d5155308 /usr.bin/ssh/packet.c
parent4d147ed7365730cc9cc81c5389841661339be32e (diff)
have sshpkt_fatal() save/restore errno before we potentially
call strerror() (via ssh_err()); ok dtucker
Diffstat (limited to 'usr.bin/ssh/packet.c')
-rw-r--r--usr.bin/ssh/packet.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/ssh/packet.c b/usr.bin/ssh/packet.c
index bb8fff3ac9c..245bfc689ae 100644
--- a/usr.bin/ssh/packet.c
+++ b/usr.bin/ssh/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.289 2020/01/23 10:53:04 dtucker Exp $ */
+/* $OpenBSD: packet.c,v 1.290 2020/01/30 07:20:05 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1824,6 +1824,7 @@ static void
sshpkt_vfatal(struct ssh *ssh, int r, const char *fmt, va_list ap)
{
char *tag = NULL, remote_id[512];
+ int oerrno = errno;
sshpkt_fmt_connection_id(ssh, remote_id, sizeof(remote_id));
@@ -1851,6 +1852,7 @@ sshpkt_vfatal(struct ssh *ssh, int r, const char *fmt, va_list ap)
case SSH_ERR_NO_HOSTKEY_ALG_MATCH:
if (ssh && ssh->kex && ssh->kex->failed_choice) {
ssh_packet_clear_keys(ssh);
+ errno = oerrno;
logdie("Unable to negotiate with %s: %s. "
"Their offer: %s", remote_id, ssh_err(r),
ssh->kex->failed_choice);
@@ -1863,6 +1865,7 @@ sshpkt_vfatal(struct ssh *ssh, int r, const char *fmt, va_list ap)
__func__);
}
ssh_packet_clear_keys(ssh);
+ errno = oerrno;
logdie("%s%sConnection %s %s: %s",
tag != NULL ? tag : "", tag != NULL ? ": " : "",
ssh->state->server_side ? "from" : "to",