mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 05:48:07 -05:00
gnu: curlftpfs: Add patches to fix bugs.
* gnu/packages/file-systems.scm (curlftpfs)[source]: Add patches. * gnu/packages/patches/curlftpfs-fix-error-closing-file.patch, gnu/packages/patches/curlftpfs-fix-file-names.patch, gnu/packages/patches/curlftpfs-fix-memory-leak.patch, gnu/packages/patches/curlftpfs-fix-no_verify_hostname.patch: New files. * gnu/local.mk (dist_patch_DATA): Add them.
This commit is contained in:
parent
affea88cf5
commit
8244aea182
6 changed files with 159 additions and 2 deletions
|
@ -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 \
|
||||
|
|
|
@ -1012,8 +1012,12 @@ (define-public curlftpfs
|
|||
(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
|
||||
|
|
23
gnu/packages/patches/curlftpfs-fix-error-closing-file.patch
Normal file
23
gnu/packages/patches/curlftpfs-fix-error-closing-file.patch
Normal file
|
@ -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);
|
76
gnu/packages/patches/curlftpfs-fix-file-names.patch
Normal file
76
gnu/packages/patches/curlftpfs-fix-file-names.patch
Normal file
|
@ -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;
|
||||
}
|
23
gnu/packages/patches/curlftpfs-fix-memory-leak.patch
Normal file
23
gnu/packages/patches/curlftpfs-fix-memory-leak.patch
Normal file
|
@ -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);
|
27
gnu/packages/patches/curlftpfs-fix-no_verify_hostname.patch
Normal file
27
gnu/packages/patches/curlftpfs-fix-no_verify_hostname.patch
Normal file
|
@ -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);
|
Loading…
Reference in a new issue