Skip to content

Commit 93c65c0

Browse files
committed
libssh: when using IPv6 numerical address, add brackets
Reported-by: henrikjehgmti on github Fixes curl#15522 Closes curl#15524
1 parent 9416e49 commit 93c65c0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/vssh/libssh.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -2191,7 +2191,14 @@ static CURLcode myssh_connect(struct Curl_easy *data, bool *done)
21912191
return CURLE_FAILED_INIT;
21922192
}
21932193

2194-
rc = ssh_options_set(ssh->ssh_session, SSH_OPTIONS_HOST, conn->host.name);
2194+
if(conn->bits.ipv6_ip) {
2195+
char ipv6[MAX_IPADR_LEN];
2196+
msnprintf(ipv6, sizeof(ipv6), "[%s]", conn->host.name);
2197+
rc = ssh_options_set(ssh->ssh_session, SSH_OPTIONS_HOST, ipv6);
2198+
}
2199+
else
2200+
rc = ssh_options_set(ssh->ssh_session, SSH_OPTIONS_HOST, conn->host.name);
2201+
21952202
if(rc != SSH_OK) {
21962203
failf(data, "Could not set remote host");
21972204
return CURLE_FAILED_INIT;

0 commit comments

Comments
 (0)