From e9c8689f8d774cfe1fff60bcbd009d473f5933d8 Mon Sep 17 00:00:00 2001 From: Fufu Fang Date: Mon, 28 Oct 2019 00:50:28 +0000 Subject: [PATCH] added -insecure_tls --- src/link.c | 3 +++ src/main.c | 6 ++++++ src/util.c | 2 ++ src/util.h | 2 ++ 4 files changed, 13 insertions(+) diff --git a/src/link.c b/src/link.c index 3cc9f0b..9bad95c 100644 --- a/src/link.c +++ b/src/link.c @@ -169,6 +169,9 @@ static CURL *Link_to_curl(Link *link) curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 15); curl_easy_setopt(curl, CURLOPT_SHARE, CURL_SHARE); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_memory_callback); + if (CONFIG.insecure_tls) { + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); + } // curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); diff --git a/src/main.c b/src/main.c index 7de1638..f326d4e 100644 --- a/src/main.c +++ b/src/main.c @@ -154,6 +154,7 @@ parse_arg_list(int argc, char **argv, char ***fuse_argv, int *fuse_argc) {"sonic-id3", no_argument, NULL, 'L'}, /* 17 */ {"no-range-check", no_argument, NULL, 'L'}, /* 18 */ {"sonic-insecure", no_argument, NULL, 'L'}, /* 19 */ + {"insecure-tls", no_argument, NULL, 'L'}, /* 20 */ {0, 0, 0, 0} }; while ((c = @@ -236,6 +237,9 @@ parse_arg_list(int argc, char **argv, char ***fuse_argv, int *fuse_argc) case 19: CONFIG.sonic_insecure = 1; break; + case 20: + CONFIG.insecure_tls = 1; + break; default: fprintf(stderr, "see httpdirfs -h for usage\n"); return 1; @@ -310,6 +314,8 @@ HTTPDirFS options:\n\ --user-agent Set user agent string (default: \"HTTPDirFS\")\n\ --no-range-check Disable the build-in check for the server's support\n\ for HTTP range requests\n\ + --insecure_tls Disable licurl TLS certificate verification by\n\ + setting CURLOPT_SSL_VERIFYHOST to 0\n\ \n\ For mounting a Airsonic / Subsonic server:\n\ --sonic-username The username for your Airsonic / Subsonic server\n\ diff --git a/src/util.c b/src/util.c index 3832e67..f2141bd 100644 --- a/src/util.c +++ b/src/util.c @@ -74,6 +74,8 @@ void Config_init(void) CONFIG.no_range_check = 0; + CONFIG.insecure_tls = 0; + /*--------------- Cache related ---------------*/ CONFIG.cache_enabled = 0; diff --git a/src/util.h b/src/util.h index 28c68d1..d7c7c15 100644 --- a/src/util.h +++ b/src/util.h @@ -55,6 +55,8 @@ typedef struct { int http_wait_sec; /** \brief Disable check for the server's support of HTTP range request */ int no_range_check; + /** \brief Disable TLS certificate verification */ + int insecure_tls; /** \brief Whether cache mode is enabled */ int cache_enabled;