From 804c1c52ec6e0389cbe6f882ac267c90b187ef59 Mon Sep 17 00:00:00 2001 From: Markham Date: Sun, 21 Jul 2019 22:24:17 +0200 Subject: [PATCH] fix target davfs2; add patches --- ...vfs2-1.5.4-no-forced-stack-protector.patch | 13 ++ archive-patches/davfs2-main-code-fix.patch | 11 + archive-patches/davfs2-musl-compat.patch | 195 ++++++++++++++++++ make/extras.mk | 10 +- 4 files changed, 225 insertions(+), 4 deletions(-) create mode 100644 archive-patches/davfs2-1.5.4-no-forced-stack-protector.patch create mode 100644 archive-patches/davfs2-main-code-fix.patch create mode 100644 archive-patches/davfs2-musl-compat.patch diff --git a/archive-patches/davfs2-1.5.4-no-forced-stack-protector.patch b/archive-patches/davfs2-1.5.4-no-forced-stack-protector.patch new file mode 100644 index 0000000..e033163 --- /dev/null +++ b/archive-patches/davfs2-1.5.4-no-forced-stack-protector.patch @@ -0,0 +1,13 @@ +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -32,8 +32,7 @@ mount_davfs_SOURCES = cache.c dav_coda.c \ + kernel_interface.h mount_davfs.h webdav.h + umount_davfs_SOURCES = umount_davfs.c defaults.h + +-AM_CFLAGS = -Wall -Werror=format-security \ +- -fstack-protector-strong --param=ssp-buffer-size=4 ++AM_CFLAGS = -Wall -Werror=format-security + DEFS = -DPROGRAM_NAME=\"mount.davfs\" \ + -DDAV_SYS_CONF_DIR=\"$(pkgsysconfdir)\" \ + -DDAV_LOCALSTATE_DIR=\"$(dav_localstatedir)\" \ + diff --git a/archive-patches/davfs2-main-code-fix.patch b/archive-patches/davfs2-main-code-fix.patch new file mode 100644 index 0000000..99b588f --- /dev/null +++ b/archive-patches/davfs2-main-code-fix.patch @@ -0,0 +1,11 @@ +--- a/src/webdav.c ++++ b/src/webdav.c +@@ -2037,7 +2037,7 @@ ssl_verify(void *userdata, int failures, const ne_ssl_certificate *cert) + len = getline(&s, &n, stdin); + if (len < 0) + abort(); +- if (rpmatch(s) > 0) ++ if ((s[0]=='y' || s[0]=='Y') > 0) + ret = 0; + free(s); + } diff --git a/archive-patches/davfs2-musl-compat.patch b/archive-patches/davfs2-musl-compat.patch new file mode 100644 index 0000000..7927636 --- /dev/null +++ b/archive-patches/davfs2-musl-compat.patch @@ -0,0 +1,195 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -42,7 +42,7 @@ DAV_CHECK_NEON + # Checks for header files. + AC_HEADER_DIRENT + AC_HEADER_STDC +-AC_CHECK_HEADERS([fcntl.h libintl.h langinfo.h limits.h locale.h mntent.h stddef.h stdint.h stdlib.h string.h sys/file.h sys/mount.h sys/time.h syslog.h termios.h unistd.h utime.h]) ++AC_CHECK_HEADERS([error.h fcntl.h libintl.h langinfo.h limits.h locale.h mntent.h stddef.h stdint.h stdlib.h string.h sys/file.h sys/mount.h sys/time.h sys/select.h sys/types.h syslog.h termios.h unistd.h utime.h]) + + # Checks for typedefs, structures, and compiler characteristics. + AC_C_CONST +@@ -78,7 +78,7 @@ AC_FUNC_SELECT_ARGTYPES + AC_FUNC_STRFTIME + AC_FUNC_STAT + AC_FUNC_UTIME_NULL +-AC_CHECK_FUNCS([endpwent ftruncate getmntent memset mkdir nl_langinfo rpmatch select setlocale strcasecmp strchr strdup strerror strpbrk strrchr strstr strtol strtoull utime]) ++AC_CHECK_FUNCS([endpwent ftruncate getmntent memset mkdir nl_langinfo rpmatch select setlocale strcasecmp strchr strdup strerror strpbrk strrchr strstr strtol strtoull utime canonicalize_file_name fopencookie]) + + # Misc. + DAV_DEFAULTS +--- a/src/cache.c ++++ b/src/cache.c +@@ -19,12 +19,12 @@ + + + #include "config.h" ++#include "compat.h" + + #ifdef HAVE_DIRENT_H + #include + #endif + #include +-#include + #ifdef HAVE_FCNTL_H + #include + #endif +--- /dev/null ++++ b/src/compat.h +@@ -0,0 +1,64 @@ ++#ifndef _COMPAT_H ++#define _COMPAT_H ++ ++#ifndef _PATH_MOUNTED ++# define _PATH_MOUNTED "/proc/mounts" ++#endif ++ ++#ifndef _PATH_MNTTAB ++# define _PATH_MNTTAB "/etc/fstab" ++#endif ++ ++#ifdef HAVE_ERROR_H ++# include ++#else ++# include ++# include ++# include ++# include ++static void error_at_line(int status, int errnum, const char *filename, ++ unsigned int linenum, const char *format, ...) ++{ ++ va_list ap; ++ ++ fflush(stdout); ++ ++ if (filename != NULL) ++ fprintf(stderr, "%s:%u: ", filename, linenum); ++ ++ va_start(ap, format); ++ vfprintf(stderr, format, ap); ++ va_end(ap); ++ ++ if (errnum != 0) ++ fprintf(stderr, ": %s", strerror(errnum)); ++ ++ fprintf(stderr, "\n"); ++ ++ if (status != 0) ++ exit(status); ++} ++ ++#define error(status, errnum, format...) \ ++ error_at_line(status, errnum, NULL, 0, format) ++ ++#endif /* HAVE_ERROR_H */ ++ ++#ifndef HAVE_CANONICALIZE_FILE_NAME ++#include ++#include ++#include ++static char * canonicalize_file_name(const char *path) ++{ ++ char buf[PATH_MAX] = { }; ++ ++ snprintf(buf, sizeof(buf) - 1, "%s", path); ++ ++ if (!realpath(path, buf)) ++ return NULL; ++ ++ return strdup(buf); ++} ++#endif ++ ++#endif /* _COMPAT_H */ +--- a/src/dav_fuse.c ++++ b/src/dav_fuse.c +@@ -47,6 +47,9 @@ + #ifdef HAVE_SYS_STAT_H + #include + #endif ++#ifdef HAVE_SYS_SELECT_H ++#include ++#endif + + #include "defaults.h" + #include "mount_davfs.h" +--- a/src/kernel_interface.c ++++ b/src/kernel_interface.c +@@ -19,8 +19,8 @@ + + + #include "config.h" ++#include "compat.h" + +-#include + #ifdef HAVE_FCNTL_H + #include + #endif +@@ -51,6 +51,9 @@ + #ifdef HAVE_SYS_STAT_H + #include + #endif ++#ifdef HAVE_SYS_TYPES_H ++#include ++#endif + #include + + #include "defaults.h" +--- a/src/mount_davfs.c ++++ b/src/mount_davfs.c +@@ -19,10 +19,10 @@ + + + #include "config.h" ++#include "compat.h" + + #include + #include +-#include + #ifdef HAVE_FCNTL_H + #include + #endif +--- a/src/umount_davfs.c ++++ b/src/umount_davfs.c +@@ -19,8 +19,8 @@ + + + #include "config.h" ++#include "compat.h" + +-#include + #include + #include + #ifdef HAVE_LIBINTL_H +--- a/src/webdav.c ++++ b/src/webdav.c +@@ -19,9 +19,9 @@ + + + #include "config.h" ++#include "compat.h" + + #include +-#include + #ifdef HAVE_FCNTL_H + #include + #endif +@@ -368,6 +368,7 @@ dav_init_webdav(const dav_args *args) + error(EXIT_FAILURE, errno, _("socket library initialization failed")); + + if (args->neon_debug & ~NE_DBG_HTTPPLAIN) { ++#ifdef HAVE_FOPENCOOKIE + char *buf = malloc(log_bufsize); + cookie_io_functions_t *log_func = malloc(sizeof(cookie_io_functions_t)); + if (!log_func) abort(); +@@ -380,6 +381,9 @@ dav_init_webdav(const dav_args *args) + error(EXIT_FAILURE, errno, + _("can't open stream to log neon-messages")); + ne_debug_init(log_stream, args->neon_debug); ++#else ++ error(EXIT_FAILURE, 0, "neon debugging unsupported"); ++#endif + } + + session = ne_session_create(args->scheme, args->host, args->port); + diff --git a/make/extras.mk b/make/extras.mk index 9d33713..4d1970f 100644 --- a/make/extras.mk +++ b/make/extras.mk @@ -87,7 +87,7 @@ $(D)/libneon: $(D)/expat $(D)/openssl $(ARCHIVE)/neon-$(NEON_VER).tar.gz sed -i "s,^prefix=.*,prefix='$(TARGETPREFIX)'," $(TARGETPREFIX)/bin/neon-config $(REWRITE_LIBTOOL)/libneon.la $(REWRITE_PKGCONF) $(PKG_CONFIG_PATH)/neon.pc -# $(REMOVE)/neon-$(NEON_VER) + $(REMOVE)/neon-$(NEON_VER) # $(TOUCH) $(D)/davfs2: $(ARCHIVE)/davfs2-$(DAVFS2_VER).tar.gz @@ -96,9 +96,11 @@ $(D)/davfs2: $(ARCHIVE)/davfs2-$(DAVFS2_VER).tar.gz $(START_BUILD) $(UNTAR)/davfs2-$(DAVFS2_VER).tar.gz pushd $(BUILD_TMP)/davfs2-$(DAVFS2_VER); \ + $(PATCH)/davfs2-main-code-fix.patch; \ + $(PATCH)/davfs2-musl-compat.patch; \ + $(PATCH)/davfs2-1.5.4-no-forced-stack-protector.patch; \ $(PATCH)/davfs2-replace-have-iconv-h-with-have-iconv.patch; \ - ac_cv_func_malloc_0_nonnull=yes \ - LIBS="-liconv" \ + export ac_cv_func_malloc_0_nonnull=yes; \ ./configure \ --prefix= \ --build=$(BUILD) \ @@ -109,5 +111,5 @@ $(D)/davfs2: $(ARCHIVE)/davfs2-$(DAVFS2_VER).tar.gz --with-neon=$(TARGETPREFIX) && \ $(MAKE) && \ $(MAKE) install DESTDIR=$(BUILD_TMP)/extras_webdav -# $(REMOVE)/neon-$(DAVFS2_VER) + $(REMOVE)/neon-$(DAVFS2_VER) # $(TOUCH) -- 2.39.5