Skip to content

Commit 9f985c6

Browse files
libgit2: fix for broken SSH host callback
1 parent ae53238 commit 9f985c6

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

deps/Versions.make

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ CURL_JLL_NAME := LibCURL
3333
LAPACK_VER := 3.9.0
3434

3535
# LibGit2
36-
LIBGIT2_JLL_VER := 1.2.1+0
36+
LIBGIT2_JLL_VER := 1.2.2+0
3737
LIBGIT2_JLL_NAME := LibGit2
3838

3939
# LibSSH2
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
693080c66702c9ff106b0935f01d1f96
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
f21d5846b443188a0c604255dce77603ea861db8d4c6fc55cebd5db6da07e94ae40f0a165221c95e13db9df8777fddb05f55c865f554f45e56cd442332a95336

deps/patches/libgit2-hostkey.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ index e8cd2d180..54293cd31 100644
1818

1919
/**
2020
diff --git a/src/transports/ssh.c b/src/transports/ssh.c
21-
index f4ed05bb1..049697796 100644
21+
index f4ed05bb1..ec6366a5f 100644
2222
--- a/src/transports/ssh.c
2323
+++ b/src/transports/ssh.c
2424
@@ -523,6 +523,7 @@ static int _git_ssh_setup_conn(
@@ -47,7 +47,7 @@ index f4ed05bb1..049697796 100644
4747
cert_ptr = &cert;
4848

4949
- error = t->owner->certificate_check_cb((git_cert *) cert_ptr, 0, urldata.host, t->owner->message_cb_payload);
50-
+ if (git_net_url_is_default_port(&urldata)) {
50+
+ if (atoi(urldata.port) == SSH_DEFAULT_PORT) {
5151
+ host_and_port = urldata.host;
5252
+ } else {
5353
+ size_t n = strlen(urldata.host) + strlen(urldata.port) + 2;

stdlib/LibGit2/src/callbacks.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,14 +440,15 @@ end
440440
function ssh_knownhost_check(
441441
files :: AbstractVector{<:AbstractString},
442442
host :: AbstractString,
443-
key :: String,
443+
key :: Vector{UInt8},
444444
)
445445
if (m = match(r"^(.+):(\d+)$", host)) !== nothing
446446
host = m.captures[1]
447447
port = parse(Int, m.captures[2])
448448
else
449449
port = 22 # default SSH port
450450
end
451+
len = length(key)
451452
mask = Consts.LIBSSH2_KNOWNHOST_TYPE_PLAIN |
452453
Consts.LIBSSH2_KNOWNHOST_KEYENC_RAW
453454
session = @ccall "libssh2".libssh2_session_init_ex(
@@ -471,13 +472,12 @@ function ssh_knownhost_check(
471472
@ccall "libssh2".libssh2_knownhost_free(hosts::Ptr{Cvoid})::Cvoid
472473
continue
473474
end
474-
size = ncodeunits(key)
475475
check = @ccall "libssh2".libssh2_knownhost_checkp(
476476
hosts :: Ptr{Cvoid},
477477
host :: Cstring,
478478
port :: Cint,
479479
key :: Ptr{UInt8},
480-
size :: Csize_t,
480+
len :: Csize_t,
481481
mask :: Cint,
482482
C_NULL :: Ptr{Ptr{KnownHost}},
483483
) :: Cint

0 commit comments

Comments
 (0)