Skip to content

Commit

Permalink
libssh: when using IPv6 numerical address, add brackets
Browse files Browse the repository at this point in the history
Reported-by: henrikjehgmti on github
Fixes curl#15522
Closes curl#15524
  • Loading branch information
bagder committed Nov 9, 2024
1 parent 9416e49 commit 93c65c0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/vssh/libssh.c
Original file line number Diff line number Diff line change
Expand Up @@ -2191,7 +2191,14 @@ static CURLcode myssh_connect(struct Curl_easy *data, bool *done)
return CURLE_FAILED_INIT;
}

rc = ssh_options_set(ssh->ssh_session, SSH_OPTIONS_HOST, conn->host.name);
if(conn->bits.ipv6_ip) {
char ipv6[MAX_IPADR_LEN];
msnprintf(ipv6, sizeof(ipv6), "[%s]", conn->host.name);
rc = ssh_options_set(ssh->ssh_session, SSH_OPTIONS_HOST, ipv6);
}
else
rc = ssh_options_set(ssh->ssh_session, SSH_OPTIONS_HOST, conn->host.name);

if(rc != SSH_OK) {
failf(data, "Could not set remote host");
return CURLE_FAILED_INIT;
Expand Down

0 comments on commit 93c65c0

Please sign in to comment.