summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnu/local.mk4
-rw-r--r--gnu/packages/file-systems.scm8
-rw-r--r--gnu/packages/patches/curlftpfs-fix-error-closing-file.patch23
-rw-r--r--gnu/packages/patches/curlftpfs-fix-file-names.patch76
-rw-r--r--gnu/packages/patches/curlftpfs-fix-memory-leak.patch23
-rw-r--r--gnu/packages/patches/curlftpfs-fix-no_verify_hostname.patch27
6 files changed, 159 insertions, 2 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index ae2f3dd49f..d069dd420e 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1038,6 +1038,10 @@ dist_patch_DATA = \
%D%/packages/patches/clucene-contribs-lib.patch \
%D%/packages/patches/cube-nocheck.patch \
%D%/packages/patches/curl-use-ssl-cert-env.patch \
+ %D%/packages/patches/curlftpfs-fix-error-closing-file.patch \
+ %D%/packages/patches/curlftpfs-fix-file-names.patch \
+ %D%/packages/patches/curlftpfs-fix-memory-leak.patch \
+ %D%/packages/patches/curlftpfs-fix-no_verify_hostname.patch \
%D%/packages/patches/cursynth-wave-rand.patch \
%D%/packages/patches/cvs-CVE-2017-12836.patch \
%D%/packages/patches/d-feet-drop-unused-meson-argument.patch \
diff --git a/gnu/packages/file-systems.scm b/gnu/packages/file-systems.scm
index c3cb96e151..0798325029 100644
--- a/gnu/packages/file-systems.scm
+++ b/gnu/packages/file-systems.scm
@@ -1012,8 +1012,12 @@ All of this is accomplished without a centralized metadata server.")
(uri (string-append "mirror://sourceforge/curlftpfs/curlftpfs/" version
"/curlftpfs-" version ".tar.gz"))
(sha256
- (base32
- "0n397hmv21jsr1j7zx3m21i7ryscdhkdsyqpvvns12q7qwwlgd2f"))))
+ (base32 "0n397hmv21jsr1j7zx3m21i7ryscdhkdsyqpvvns12q7qwwlgd2f"))
+ (patches
+ (search-patches "curlftpfs-fix-error-closing-file.patch"
+ "curlftpfs-fix-file-names.patch"
+ "curlftpfs-fix-memory-leak.patch"
+ "curlftpfs-fix-no_verify_hostname.patch"))))
(build-system gnu-build-system)
(arguments
`(#:phases
diff --git a/gnu/packages/patches/curlftpfs-fix-error-closing-file.patch b/gnu/packages/patches/curlftpfs-fix-error-closing-file.patch
new file mode 100644
index 0000000000..c90b7e9094
--- /dev/null
+++ b/gnu/packages/patches/curlftpfs-fix-error-closing-file.patch
@@ -0,0 +1,23 @@
+From d27d1cd3a79959ff1eb8439b06e108149f21141f Mon Sep 17 00:00:00 2001
+From: Joseph Lansdowne <j49137@gmail.com>
+Date: Sun, 31 Mar 2019 19:26:10 +0100
+Subject: [PATCH] fix error on closing written file
+
+---
+ ChangeLog | 1 +
+ ftpfs.c | 2 +-
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/ftpfs.c b/ftpfs.c
+index 0346354..34f8c38 100644
+--- a/ftpfs.c
++++ b/ftpfs.c
+@@ -503,7 +503,7 @@ static void *ftpfs_write_thread(void *data) {
+
+ curl_easy_setopt_or_die(fh->write_conn, CURLOPT_URL, fh->full_path);
+ curl_easy_setopt_or_die(fh->write_conn, CURLOPT_UPLOAD, 1);
+- curl_easy_setopt_or_die(fh->write_conn, CURLOPT_INFILESIZE, -1);
++ curl_easy_setopt_or_die(fh->write_conn, CURLOPT_INFILESIZE, -1L);
+ curl_easy_setopt_or_die(fh->write_conn, CURLOPT_READFUNCTION, write_data_bg);
+ curl_easy_setopt_or_die(fh->write_conn, CURLOPT_READDATA, fh);
+ curl_easy_setopt_or_die(fh->write_conn, CURLOPT_LOW_SPEED_LIMIT, 1);
diff --git a/gnu/packages/patches/curlftpfs-fix-file-names.patch b/gnu/packages/patches/curlftpfs-fix-file-names.patch
new file mode 100644
index 0000000000..04979a3b0c
--- /dev/null
+++ b/gnu/packages/patches/curlftpfs-fix-file-names.patch
@@ -0,0 +1,76 @@
+From bc3fb45db30741a60d4e8904cbd4d6118fb85741 Mon Sep 17 00:00:00 2001
+From: Joseph Lansdowne <j49137@gmail.com>
+Date: Sun, 31 Mar 2019 19:25:26 +0100
+Subject: [PATCH] fix filenames with url-reserved characters
+
+---
+ ChangeLog | 2 +-
+ path_utils.c | 28 +++++++++++++++++-----------
+ 2 files changed, 18 insertions(+), 12 deletions(-)
+
+diff --git a/path_utils.c b/path_utils.c
+index db3d7e4..4f747bb 100644
+--- a/path_utils.c
++++ b/path_utils.c
+@@ -39,9 +39,11 @@ char* get_full_path(const char* path) {
+ path = converted_path;
+ }
+
+- ret = g_strdup_printf("%s%s", ftpfs.host, path);
++ const char *const escaped_path = g_uri_escape_string(path, "/", FALSE);
++ ret = g_strdup_printf("%s%s", ftpfs.host, escaped_path);
+
+ free(converted_path);
++ free((char *) escaped_path);
+
+ return ret;
+ }
+@@ -58,9 +60,12 @@ char* get_fulldir_path(const char* path) {
+ path = converted_path;
+ }
+
+- ret = g_strdup_printf("%s%s%s", ftpfs.host, path, strlen(path) ? "/" : "");
++ const char *const escaped_path = g_uri_escape_string(path, "/", FALSE);
++ ret = g_strdup_printf(
++ "%s%s%s", ftpfs.host, escaped_path, strlen(escaped_path) ? "/" : "");
+
+ free(converted_path);
++ free((char *) escaped_path);
+
+ return ret;
+ }
+@@ -71,24 +76,25 @@ char* get_dir_path(const char* path) {
+ const char *lastdir;
+
+ ++path;
+-
+- lastdir = strrchr(path, '/');
+- if (lastdir == NULL) lastdir = path;
+
+- if (ftpfs.codepage && (lastdir - path > 0)) {
+- converted_path = g_strndup(path, lastdir - path);
++ if (ftpfs.codepage) {
++ converted_path = g_strdup(path);
+ convert_charsets(ftpfs.iocharset, ftpfs.codepage, &converted_path);
+ path = converted_path;
+- lastdir = path + strlen(path);
+ }
+
++ const char *const escaped_path = g_uri_escape_string(path, "/", FALSE);
++ lastdir = strrchr(escaped_path, '/');
++ if (lastdir == NULL) lastdir = escaped_path;
++
+ ret = g_strdup_printf("%s%.*s%s",
+ ftpfs.host,
+- lastdir - path,
+- path,
+- lastdir - path ? "/" : "");
++ lastdir - escaped_path,
++ escaped_path,
++ lastdir - escaped_path ? "/" : "");
+
+ free(converted_path);
++ free((char *) escaped_path);
+
+ return ret;
+ }
diff --git a/gnu/packages/patches/curlftpfs-fix-memory-leak.patch b/gnu/packages/patches/curlftpfs-fix-memory-leak.patch
new file mode 100644
index 0000000000..eea801957e
--- /dev/null
+++ b/gnu/packages/patches/curlftpfs-fix-memory-leak.patch
@@ -0,0 +1,23 @@
+From 2d01202eee44d8bad5bb982e72829b4a98d58bcd Mon Sep 17 00:00:00 2001
+From: Joseph Lansdowne <j49137@gmail.com>
+Date: Thu, 4 Apr 2019 20:37:06 +0100
+Subject: [PATCH] fix memory leak
+
+---
+ ChangeLog | 1 +
+ ftpfs.c | 2 ++
+ 2 files changed, 3 insertions(+)
+
+diff --git a/ftpfs.c b/ftpfs.c
+index 34f8c38..020e559 100644
+--- a/ftpfs.c
++++ b/ftpfs.c
+@@ -607,6 +607,8 @@ static int finish_write_thread(struct ftpfs_file *fh)
+
+
+ static void free_ftpfs_file(struct ftpfs_file *fh) {
++ buf_free(&fh->buf);
++ buf_free(&fh->stream_buf);
+ if (fh->write_conn)
+ curl_easy_cleanup(fh->write_conn);
+ g_free(fh->full_path);
diff --git a/gnu/packages/patches/curlftpfs-fix-no_verify_hostname.patch b/gnu/packages/patches/curlftpfs-fix-no_verify_hostname.patch
new file mode 100644
index 0000000000..67a3e933ad
--- /dev/null
+++ b/gnu/packages/patches/curlftpfs-fix-no_verify_hostname.patch
@@ -0,0 +1,27 @@
+From b2ae7a152921bf36a39f01de43769ee90cbbd253 Mon Sep 17 00:00:00 2001
+From: Joseph Lansdowne <j49137@gmail.com>
+Date: Tue, 9 Apr 2019 21:08:32 +0100
+Subject: [PATCH] fix option `no_verify_hostname`
+
+Broke with a curl upgrade at some point. 1 is no longer a valid option
+- not sure exactly what it used to do.
+---
+ ChangeLog | 3 +++
+ ftpfs.c | 4 +---
+ 2 files changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/ftpfs.c b/ftpfs.c
+index 020e559..207d5fd 100644
+--- a/ftpfs.c
++++ b/ftpfs.c
+@@ -1627,9 +1627,7 @@ static void set_common_curl_stuff(CURL* easy) {
+ }
+
+ if (ftpfs.no_verify_hostname) {
+- /* The default is 2 which verifies even the host string. This sets to 1
+- * which means verify the host but not the string. */
+- curl_easy_setopt_or_die(easy, CURLOPT_SSL_VERIFYHOST, 1);
++ curl_easy_setopt_or_die(easy, CURLOPT_SSL_VERIFYHOST, 0);
+ }
+
+ curl_easy_setopt_or_die(easy, CURLOPT_INTERFACE, ftpfs.interface);