[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 141/220: vssh: move ssh init/cleanup functions into
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 141/220: vssh: move ssh init/cleanup functions into backend code |
Date: |
Thu, 12 Sep 2019 17:28:21 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit d6dea75af7c00e396cffa2e74350352703312180
Author: Daniel Stenberg <address@hidden>
AuthorDate: Fri Aug 16 16:16:33 2019 +0200
vssh: move ssh init/cleanup functions into backend code
---
lib/easy.c | 20 +++-----------------
lib/ssh.h | 7 ++++++-
lib/vssh/libssh.c | 13 +++++++++++++
lib/vssh/libssh2.c | 19 +++++++++++++++++++
4 files changed, 41 insertions(+), 18 deletions(-)
diff --git a/lib/easy.c b/lib/easy.c
index b8d94c740..1d49a0366 100644
--- a/lib/easy.c
+++ b/lib/easy.c
@@ -187,16 +187,8 @@ static CURLcode global_init(long flags, bool memoryfuncs)
(void)Curl_ipv6works();
-#if defined(USE_LIBSSH2) && defined(HAVE_LIBSSH2_INIT)
- if(libssh2_init(0)) {
- DEBUGF(fprintf(stderr, "Error: libssh2_init failed\n"));
- return CURLE_FAILED_INIT;
- }
-#endif
-
-#if defined(USE_LIBSSH)
- if(ssh_init()) {
- DEBUGF(fprintf(stderr, "Error: libssh_init failed\n"));
+#if defined(USE_SSH)
+ if(Curl_ssh_init()) {
return CURLE_FAILED_INIT;
}
#endif
@@ -274,13 +266,7 @@ void curl_global_cleanup(void)
Curl_amiga_cleanup();
-#if defined(USE_LIBSSH2) && defined(HAVE_LIBSSH2_EXIT)
- (void)libssh2_exit();
-#endif
-
-#if defined(USE_LIBSSH)
- (void)ssh_finalize();
-#endif
+ Curl_ssh_cleanup();
init_flags = 0;
}
diff --git a/lib/ssh.h b/lib/ssh.h
index 0620aac32..96bb64099 100644
--- a/lib/ssh.h
+++ b/lib/ssh.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2019, Daniel Stenberg, <address@hidden>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -240,6 +240,11 @@ extern const struct Curl_handler Curl_handler_sftp;
extern const struct Curl_handler Curl_handler_scp;
extern const struct Curl_handler Curl_handler_sftp;
+CURLcode Curl_ssh_init(void);
+void Curl_ssh_cleanup(void);
+
+#else
+#define Curl_ssh_cleanup()
#endif /* USE_LIBSSH2 */
#endif /* HEADER_CURL_SSH_H */
diff --git a/lib/vssh/libssh.c b/lib/vssh/libssh.c
index 4b34b0212..d8186e0b2 100644
--- a/lib/vssh/libssh.c
+++ b/lib/vssh/libssh.c
@@ -2725,5 +2725,18 @@ static void sftp_quote_stat(struct connectdata *conn)
return;
}
+CURLcode Curl_ssh_init(void)
+{
+ if(ssh_init()) {
+ DEBUGF(fprintf(stderr, "Error: libssh_init failed\n"));
+ return CURLE_FAILED_INIT;
+ }
+ return CURLE_OK;
+}
+
+void Curl_ssh_cleanup(void)
+{
+ (void)ssh_finalize();
+}
#endif /* USE_LIBSSH */
diff --git a/lib/vssh/libssh2.c b/lib/vssh/libssh2.c
index 5dd6ee29e..011f1ecf3 100644
--- a/lib/vssh/libssh2.c
+++ b/lib/vssh/libssh2.c
@@ -3320,4 +3320,23 @@ static const char *sftp_libssh2_strerror(int err)
return "Unknown error in libssh2";
}
+CURLcode Curl_ssh_init(void)
+{
+#ifdef HAVE_LIBSSH2_INIT
+ if(libssh2_init(0)) {
+ DEBUGF(fprintf(stderr, "Error: libssh2_init failed\n"));
+ return CURLE_FAILED_INIT;
+ }
+#endif
+ return CURLE_OK;
+}
+
+void Curl_ssh_cleanup(void)
+{
+#ifdef HAVE_LIBSSH2_EXIT
+ (void)libssh2_exit();
+#endif
+}
+
+
#endif /* USE_LIBSSH2 */
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [GNUnet-SVN] [gnurl] 133/220: configure: use -lquiche to link to quiche, (continued)
- [GNUnet-SVN] [gnurl] 133/220: configure: use -lquiche to link to quiche, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 144/220: quiche: register debug callback once and earlier, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 138/220: RELEASE-NOTES: synced, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 140/220: vssh: create directory for SSH backend code, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 145/220: ngtcp2: move the h3 initing to immediately after the rx key, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 130/220: ngtcp2: deal with stream close, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 131/220: ngtcp2: add missing nghttp3_conn_add_write_offset call, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 132/220: ngtcp2: provide the callbacks as a static struct, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 85/220: curl: make use of CURLINFO_RETRY_AFTER when retrying, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 89/220: alt-svc: send Alt-Used: in redirected requests, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 141/220: vssh: move ssh init/cleanup functions into backend code,
gnunet <=
- [GNUnet-SVN] [gnurl] 114/220: CURLOPT_ALTSVC_CTRL.3: remove CURLALTSVC_ALTUSED, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 120/220: curl_version_info: make the quic_version a const, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 126/220: connect: connections are persistent by default for HTTP/3, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 134/220: travis: reduce number of torture tests in 'coverage', gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 150/220: configure: use pkg-config to detect quiche, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 129/220: ngtcp2: Consume QUIC STREAM data properly, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 137/220: travis: add a quiche build, gnunet, 2019/09/12
- [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