[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 143/220: ssh: add a generic Curl_ssh_version functi
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 143/220: ssh: add a generic Curl_ssh_version function for SSH backends |
Date: |
Thu, 12 Sep 2019 17:28:23 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit ea28a6cb2f168ce0b4e01c0f05e3675687dbd497
Author: Daniel Stenberg <address@hidden>
AuthorDate: Fri Aug 16 15:32:05 2019 +0200
ssh: add a generic Curl_ssh_version function for SSH backends
Closes #4235
---
lib/ssh.h | 8 ++++++--
lib/version.c | 32 ++++++++------------------------
lib/vssh/libssh.c | 5 +++++
lib/vssh/libssh2.c | 4 ++++
4 files changed, 23 insertions(+), 26 deletions(-)
diff --git a/lib/ssh.h b/lib/ssh.h
index 96bb64099..3213c5a52 100644
--- a/lib/ssh.h
+++ b/lib/ssh.h
@@ -239,12 +239,16 @@ extern const struct Curl_handler Curl_handler_sftp;
extern const struct Curl_handler Curl_handler_scp;
extern const struct Curl_handler Curl_handler_sftp;
+#endif /* USE_LIBSSH2 */
+#ifdef USE_SSH
+/* generic SSH backend functions */
CURLcode Curl_ssh_init(void);
void Curl_ssh_cleanup(void);
-
+size_t Curl_ssh_version(char *buffer, size_t buflen);
#else
+/* for non-SSH builds */
#define Curl_ssh_cleanup()
-#endif /* USE_LIBSSH2 */
+#endif
#endif /* HEADER_CURL_SSH_H */
diff --git a/lib/version.c b/lib/version.c
index afad726d8..ae2b09d31 100644
--- a/lib/version.c
+++ b/lib/version.c
@@ -54,18 +54,6 @@
#include <librtmp/rtmp.h>
#endif
-#ifdef USE_LIBSSH2
-#include <libssh2.h>
-#endif
-
-#ifdef HAVE_LIBSSH2_VERSION
-/* get it run-time if possible */
-#define CURL_LIBSSH2_VERSION libssh2_version(0)
-#else
-/* use build-time if run-time not possible */
-#define CURL_LIBSSH2_VERSION LIBSSH2_VERSION
-#endif
-
#ifdef HAVE_ZLIB_H
#include <zlib.h>
#ifdef __SYMBIAN32__
@@ -173,13 +161,12 @@ char *curl_version(void)
left -= len;
ptr += len;
#endif
-#ifdef USE_LIBSSH2
- len = msnprintf(ptr, left, " libssh2/%s", CURL_LIBSSH2_VERSION);
- left -= len;
- ptr += len;
-#endif
-#ifdef USE_LIBSSH
- len = msnprintf(ptr, left, " libssh/%s", CURL_LIBSSH_VERSION);
+#ifdef USE_SSH
+ if(left) {
+ *ptr++=' ';
+ left--;
+ }
+ len = Curl_ssh_version(ptr, left);
left -= len;
ptr += len;
#endif
@@ -458,11 +445,8 @@ curl_version_info_data *curl_version_info(CURLversion
stamp)
#endif /* _LIBICONV_VERSION */
#endif
-#if defined(USE_LIBSSH2)
- msnprintf(ssh_buffer, sizeof(ssh_buffer), "libssh2/%s", LIBSSH2_VERSION);
- version_info.libssh_version = ssh_buffer;
-#elif defined(USE_LIBSSH)
- msnprintf(ssh_buffer, sizeof(ssh_buffer), "libssh/%s", CURL_LIBSSH_VERSION);
+#if defined(USE_SSH)
+ Curl_ssh_version(ssh_buffer, sizeof(ssh_buffer));
version_info.libssh_version = ssh_buffer;
#endif
diff --git a/lib/vssh/libssh.c b/lib/vssh/libssh.c
index d8186e0b2..76956a3c1 100644
--- a/lib/vssh/libssh.c
+++ b/lib/vssh/libssh.c
@@ -2739,4 +2739,9 @@ void Curl_ssh_cleanup(void)
(void)ssh_finalize();
}
+size_t Curl_ssh_version(char *buffer, size_t buflen)
+{
+ return msnprintf(buffer, buflen, "libssh/%s", CURL_LIBSSH_VERSION);
+}
+
#endif /* USE_LIBSSH */
diff --git a/lib/vssh/libssh2.c b/lib/vssh/libssh2.c
index 011f1ecf3..2b25a514f 100644
--- a/lib/vssh/libssh2.c
+++ b/lib/vssh/libssh2.c
@@ -3338,5 +3338,9 @@ void Curl_ssh_cleanup(void)
#endif
}
+size_t Curl_ssh_version(char *buffer, size_t buflen)
+{
+ return msnprintf(buffer, buflen, "libssh2/%s", LIBSSH2_VERSION);
+}
#endif /* USE_LIBSSH2 */
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [GNUnet-SVN] [gnurl] 149/220: CURLOPT_SSL_VERIFYHOST: treat the value 1 as 2, (continued)
- [GNUnet-SVN] [gnurl] 149/220: CURLOPT_SSL_VERIFYHOST: treat the value 1 as 2, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 154/220: openssl: build warning free with boringssl, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 165/220: ngtcp2: use nghttp3_version(), gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 166/220: ngtcp2: improve h3 response receiving, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 136/220: http: fix use of credentials from URL when using HTTP proxy, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 155/220: spnego_sspi: add typecast to fix build warning, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 152/220: ngtcp2: make postfields-set posts work, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 162/220: http: the 'closed' struct field is used by both ngh2 and ngh3, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 164/220: ngtcp2: sync with upstream API changes, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 167/220: ngtcp2: add support for SSLKEYLOGFILE, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 143/220: ssh: add a generic Curl_ssh_version function for SSH backends,
gnunet <=
- [GNUnet-SVN] [gnurl] 139/220: TODO/ROADMAP: remove "refuse downgrade redirects" and HTTP/3, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 146/220: ngtcp2: use ngtcp2_version() to get the run-time version, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 156/220: cleanup: remove DOT_CHAR completely, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 171/220: vauth: return CURLE_AUTH_ERROR on gss_init_sec_context() failure, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 173/220: RELEASE-NOTES: synced, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 142/220: base64: check for SSH, not specific SSH backends, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 147/220: netrc: make the code try ".netrc" on Windows as well, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 148/220: curl: use .curlrc (with a dot) on Windows as well, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 163/220: scp: fix directory name length used in memcpy, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 176/220: HTTP3: switched openssl branch to use, gnunet, 2019/09/12