]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
libssh2: Get the version at runtime if possible
authorJoel Depooter <joel.depooter@safe.com>
Thu, 23 Sep 2021 22:54:24 +0000 (15:54 -0700)
committerJay Satiro <raysatiro@yahoo.com>
Fri, 24 Sep 2021 05:41:53 +0000 (01:41 -0400)
Previously this code used a compile time constant, meaning that libcurl
always reported the libssh2 version that libcurl was built with. This
could differ from the libssh2 version actually being used. The new code
uses the CURL_LIBSSH2_VERSION macro, which is defined in ssh.h. The
macro calls the libssh2_version function if it is available, otherwise
it falls back to the compile time version.

Closes https://github.com/curl/curl/pull/7768

lib/vssh/libssh2.c

index a772f1f9b7fa749388551c39d23dc6f6372210d2..8ccfe68a871b2f27721a03878d5b43c8a25325f8 100644 (file)
@@ -3610,7 +3610,7 @@ void Curl_ssh_cleanup(void)
 
 void Curl_ssh_version(char *buffer, size_t buflen)
 {
-  (void)msnprintf(buffer, buflen, "libssh2/%s", LIBSSH2_VERSION);
+  (void)msnprintf(buffer, buflen, "libssh2/%s", CURL_LIBSSH2_VERSION);
 }
 
 /* The SSH session is associated with the *CONNECTION* but the callback user