Skip to content

Commit 8225f0a

Browse files
committed
openssh: backport patch to fix "invalid format"
Due to a bug in newer OpenSSH versions, when the public key is absent, loading a private key in OpenSSL format will print the warning "invalid format". This has been fixed in OpenSSH, but not released yet. So we simply backport that fix. This fixes git-for-windows/git#2743 Signed-off-by: Johannes Schindelin <[email protected]>
1 parent ce2d7ce commit 8225f0a

File tree

2 files changed

+52
-2
lines changed

2 files changed

+52
-2
lines changed

openssh/PKGBUILD

+5-2
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ source=("https://cloudflare.cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/${pkgna
1414
0001-Forward-port-MSys2-patches.patch
1515
0002-openssh-work-around-Cygwin-declaring-setkey.patch
1616
0003-openssh-skip-privilege-separation-tests.patch
17-
0004-Allow-scp-to-copy-files-that-start-with-a-Windows-dr.patch)
17+
0004-Allow-scp-to-copy-files-that-start-with-a-Windows-dr.patch
18+
c514f3c0522855b4d548286eaa113e209051a6d2.patch)
1819
sha256sums=('f2befbe0472fe7eb75d23340eb17531cb6b3aac24075e2066b41f814e12387b2'
1920
'SKIP'
2021
'572d8aa267a493205e3e6d5b194bf1800e161c3745a07e36cdf325b8014c99b8'
2122
'7eca1a47c2b523945899d5b7ad0418e00e7a5a30f4d6a6d3414a7328b520fd7e'
2223
'e06ff5a726761d067e67e0f42ecad8d4786a8f31d3269dedf034798f3e9103ca'
23-
'edad721c623aa96506c23444aedfdea8b7a4659574b55b05755e913879dbf3c6')
24+
'edad721c623aa96506c23444aedfdea8b7a4659574b55b05755e913879dbf3c6'
25+
'ec9469a19f57138bb22f42691f0db591d4f700462e415580ab41e4ff79364021')
2426
validpgpkeys=('59C2118ED206D927E667EBE3D3E5F56B6D920D30')
2527

2628
backup=('etc/ssh/ssh_config' 'etc/ssh/sshd_config')
@@ -31,6 +33,7 @@ prepare() {
3133
patch -p1 -i ${srcdir}/0002-openssh-work-around-Cygwin-declaring-setkey.patch
3234
patch -p1 -i ${srcdir}/0003-openssh-skip-privilege-separation-tests.patch
3335
patch -p1 -i ${srcdir}/0004-Allow-scp-to-copy-files-that-start-with-a-Windows-dr.patch
36+
patch -p1 -i ${srcdir}/c514f3c0522855b4d548286eaa113e209051a6d2.patch
3437
autoreconf -fvi
3538
}
3639

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
From c514f3c0522855b4d548286eaa113e209051a6d2 Mon Sep 17 00:00:00 2001
2+
3+
Date: Thu, 18 Jun 2020 23:33:38 +0000
4+
Subject: [PATCH] upstream: avoid spurious "Unable to load host key" message
5+
when
6+
7+
sshd can load a private key but no public counterpart; with & ok markus@
8+
9+
OpenBSD-Commit-ID: 0713cbdf9aa1ff8ac7b1f78b09ac911af510f81b
10+
---
11+
authfile.c | 10 ++++++++--
12+
1 file changed, 8 insertions(+), 2 deletions(-)
13+
14+
diff --git a/authfile.c b/authfile.c
15+
index 35ccf576c..946f50ca8 100644
16+
--- a/authfile.c
17+
+++ b/authfile.c
18+
@@ -1,4 +1,4 @@
19+
-/* $OpenBSD: authfile.c,v 1.140 2020/04/17 07:15:11 djm Exp $ */
20+
+/* $OpenBSD: authfile.c,v 1.141 2020/06/18 23:33:38 djm Exp $ */
21+
/*
22+
* Copyright (c) 2000, 2013 Markus Friedl. All rights reserved.
23+
*
24+
@@ -263,7 +263,7 @@ int
25+
sshkey_load_public(const char *filename, struct sshkey **keyp, char **commentp)
26+
{
27+
char *pubfile = NULL;
28+
- int r;
29+
+ int r, oerrno;
30+
31+
if (keyp != NULL)
32+
*keyp = NULL;
33+
@@ -283,8 +283,14 @@ sshkey_load_public(const char *filename, struct sshkey **keyp, char **commentp)
34+
if ((r = sshkey_load_pubkey_from_private(filename, keyp)) == 0)
35+
goto out;
36+
37+
+ /* Pretend we couldn't find the key */
38+
+ r = SSH_ERR_SYSTEM_ERROR;
39+
+ errno = ENOENT;
40+
+
41+
out:
42+
+ oerrno = errno;
43+
free(pubfile);
44+
+ errno = oerrno;
45+
return r;
46+
}
47+

0 commit comments

Comments
 (0)