[-]
[+]
|
Changed |
_service:tar_git:davfs2.spec
|
|
[-]
[+]
|
Changed |
_service:tar_git:Makefile.am.patch
^
|
@@ -1,16 +1,13 @@
diff --git a/Makefile.am b/Makefile.am
-index 66d757b..cd07035 100644
+index 335b3c5..7924dd2 100644
--- a/Makefile.am
+++ b/Makefile.am
-@@ -20,9 +20,8 @@
- ## Process this file with automake to produce Makefile.in
+@@ -21,7 +21,7 @@
EXTRA_DIST = bootstrap BUGS FAQ README.translators \
-- config/COPYING.davfs2 config/INSTALL.davfs2 \
-- config/gnulib-cache.m4
--SUBDIRS = gl glpo po etc man src
-+ config/COPYING.davfs2 config/INSTALL.davfs2
-+SUBDIRS = po etc src
+ config/COPYING.davfs2 config/INSTALL.davfs2
+-SUBDIRS = po etc man src
++SUBDIRS = etc src
ACLOCAL_AMFLAGS = -I config
doc_DATA = AUTHORS BUGS ChangeLog COPYING FAQ INSTALL NEWS README \
README.translators THANKS TODO
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,7 +2,7 @@
<service name="tar_git">
<param name="url">https://github.com/sailfishos-chum/davfs2</param>
<param name="branch"></param>
- <param name="revision">1.6.1+git1</param>
+ <param name="revision">1.7.0+git3</param>
<param name="token"/>
<param name="debian">N</param>
<param name="dumb">N</param>
|
[-]
[+]
|
Deleted |
_service:tar_git:davfs2-1.6.1+git1.tar.gz/upstream/config/gnulib-cache.m4
^
|
@@ -1,39 +0,0 @@
-# Copyright (C) 2002-2010 Free Software Foundation, Inc.
-#
-# This file is free software, distributed under the terms of the GNU
-# General Public License. As a special exception to the GNU General
-# Public License, this file may be distributed as part of a program
-# that contains a configuration script generated by Autoconf, under
-# the same distribution terms as the rest of that program.
-#
-# Generated by gnulib-tool.
-#
-# This file represents the specification of how gnulib-tool is used.
-# It acts as a cache: It is written and read by gnulib-tool.
-# In projects using CVS, this file is meant to be stored in CVS,
-# like the configure.ac and various Makefile.am files.
-
-
-# Specification in the form of a command-line invocation:
-# gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=config --po-base=glpo --doc-base=doc --tests-base=tests --aux-dir=config --no-libtool --macro-prefix=gl --po-domain=davfs2 canonicalize iconv_open rpmatch xalloc xstrndup xvasprintf
-
-# Specification in the form of a few gnulib-tool.m4 macro invocations:
-gl_LOCAL_DIR([])
-gl_MODULES([
- canonicalize
- iconv_open
- rpmatch
- xalloc
- xstrndup
- xvasprintf
-])
-gl_AVOID([])
-gl_SOURCE_BASE([gl])
-gl_M4_BASE([config])
-gl_PO_BASE([glpo])
-gl_DOC_BASE([doc])
-gl_TESTS_BASE([tests])
-gl_LIB([libgnu])
-gl_MAKEFILE_NAME([])
-gl_MACRO_PREFIX([gl])
-gl_PO_DOMAIN([davfs2])
|
[-]
[+]
|
Changed |
_service:tar_git:davfs2-1.7.0+git3.tar.gz/upstream/AUTHORS
^
|
@@ -12,8 +12,10 @@
Copyright:
==========
-Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2020
- Werner Baumann <werner.baumann@onlinehome.de>
+Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2020,
+ 2021, 2022
+ Ali Abdallah <ali.abdallah@suse.com>
+ Werner Baumann <werner.baumann@onlinehome.de>
davfs2 is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
|
[-]
[+]
|
Changed |
_service:tar_git:davfs2-1.7.0+git3.tar.gz/upstream/ChangeLog
^
|
@@ -1,5 +1,9 @@
ChangeLog for davfs2
--------------------
+2022-10-02 Ali Abdallah (ali.abdallah@suse.com)
+ * Release version 1.7.0
+ Port to FreeBSD.
+ Fix cached file not up to date attributes.
2021-10-31 Werner Baumann (werner.baumann@onlinehome.de)
* Release version 1.6.1
|
[-]
[+]
|
Changed |
_service:tar_git:davfs2-1.7.0+git3.tar.gz/upstream/Makefile.am
^
|
@@ -20,9 +20,8 @@
## Process this file with automake to produce Makefile.in
EXTRA_DIST = bootstrap BUGS FAQ README.translators \
- config/COPYING.davfs2 config/INSTALL.davfs2 \
- config/gnulib-cache.m4
-SUBDIRS = gl glpo po etc man src
+ config/COPYING.davfs2 config/INSTALL.davfs2
+SUBDIRS = po etc man src
ACLOCAL_AMFLAGS = -I config
doc_DATA = AUTHORS BUGS ChangeLog COPYING FAQ INSTALL NEWS README \
README.translators THANKS TODO
|
[-]
[+]
|
Changed |
_service:tar_git:davfs2-1.7.0+git3.tar.gz/upstream/bootstrap
^
|
@@ -8,7 +8,7 @@
set -ex
autopoint --force
-gnulib-tool --update
+#gnulib-tool --update
cd man; po4a po4a.conf; cd ..
aclocal -I config
autoheader
|
[-]
[+]
|
Changed |
_service:tar_git:davfs2-1.7.0+git3.tar.gz/upstream/config/davfs2.m4
^
|
@@ -78,10 +78,6 @@
[the group, the mount.davfs daemon belongs to [davfs2]])
if test -z "$dav_group"; then dav_group="davfs2"; fi
- AC_ARG_VAR([ssbindir],
- [where mount will search for mount-helpers [/sbin]])
- if test -z "$ssbindir"; then ssbindir="/sbin"; fi
-
AC_ARG_VAR([dav_localstatedir],
[directory to store pid-files in [/var/run]])
if test -z "$dav_localstatedir"; then dav_localstatedir="/var/run"; fi
@@ -181,6 +177,6 @@
Neon Library: ${neon_library_message}
${ne_SSL_message}
Native Language Support: ${dav_nls}
-
+ Host ${host_os}
EOF
])
|
[-]
[+]
|
Changed |
_service:tar_git:davfs2-1.7.0+git3.tar.gz/upstream/configure.ac
^
|
@@ -21,7 +21,7 @@
AC_PREREQ(2.69)
-AC_INIT(davfs2, 1.6.1, http://savannah.nongnu.org/projects/davfs2)
+AC_INIT(davfs2, 1.7.0, http://savannah.nongnu.org/projects/davfs2)
AC_CONFIG_SRCDIR([src/cache.c])
AC_CONFIG_AUX_DIR([config])
AM_INIT_AUTOMAKE
@@ -86,6 +86,20 @@
DAV_LINGUAS([de])
AC_DEFINE([_GNU_SOURCE], 1, [Define to enable GNU extensions])
+AC_CANONICAL_HOST
+ AS_CASE([$host],
+ [*-linux*], [host_type=linux],
+ [*-*freebsd*], [host_type=freebsd],
+ [host_type=unsupported])
+
+if test "$host_type" = "unsupported"; then
+AC_MSG_ERROR([Unsupported host operating system => $host])
+fi
+
+# export to Makefile.am
+AM_CONDITIONAL(HOST_TYPE_LINUX, [test x$host_type = xlinux])
+AM_CONDITIONAL(HOST_TYPE_FREEBSD, [test x$host_type = xfreebsd])
+
AC_CONFIG_FILES([Makefile
po/Makefile.in
etc/Makefile
|
[-]
[+]
|
Changed |
_service:tar_git:davfs2-1.7.0+git3.tar.gz/upstream/src/Makefile.am
^
|
@@ -23,12 +23,11 @@
pkgsysconfdir = $(sysconfdir)/@PACKAGE@
pkglocalstatedir = $(dav_localstatedir)/mount.davfs
pkgsyscachedir = $(dav_syscachedir)/@PACKAGE@
-ssbindir = @ssbindir@
sbin_PROGRAMS = mount.davfs umount.davfs
mount_davfs_SOURCES = cache.c \
dav_fuse.c kernel_interface.c mount_davfs.c webdav.c \
- cache.h defaults.h fuse_kernel.h \
+ cache.h defaults.h fuse_kernel.h util.h \
kernel_interface.h mount_davfs.h webdav.h
umount_davfs_SOURCES = umount_davfs.c defaults.h
@@ -50,16 +49,9 @@
-D_FORTIFY_SOURCE=2 @DEFS@
LIBS = $(NEON_LIBS) @LIBS@
-install-exec-hook:
- chmod u+s $(DESTDIR)$(sbindir)/mount.davfs; \
- if test "$(sbindir)" != "$(ssbindir)"; then \
- $(mkinstalldirs) $(DESTDIR)$(ssbindir); \
- $(LN_S) -f $(sbindir)/mount.davfs $(DESTDIR)$(ssbindir)/mount.davfs; \
- $(LN_S) -f $(sbindir)/umount.davfs $(DESTDIR)$(ssbindir)/umount.davfs; \
- fi
+if HOST_TYPE_FREEBSD
+LIBS += @LIBICONV@
+endif
-uninstall-hook:
- if test "$(sbindir)" != "$(ssbindir)"; then \
- rm -f $(DESTDIR)$(ssbindir)/mount.davfs; \
- rm -f $(DESTDIR)$(ssbindir)/umount.davfs; \
- fi
+install-exec-hook:
+ chmod u+s $(DESTDIR)$(sbindir)/mount.davfs;
|
[-]
[+]
|
Changed |
_service:tar_git:davfs2-1.7.0+git3.tar.gz/upstream/src/cache.c
^
|
@@ -24,7 +24,6 @@
#include <dirent.h>
#endif
#include <errno.h>
-#include <error.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
@@ -58,7 +57,6 @@
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#include <sys/xattr.h>
#include <ne_alloc.h>
#include <ne_string.h>
@@ -68,6 +66,7 @@
#include "mount_davfs.h"
#include "webdav.h"
#include "cache.h"
+#include "util.h"
#ifdef ENABLE_NLS
#define _(String) gettext(String)
@@ -649,19 +648,18 @@
ret = update_directory(root, 0);
}
if (ret == EAGAIN) {
- error(0, 0, _("connection timed out two times;\n"
- "trying one last time"));
+ WARN(_("connection timed out two times;\n"
+ "trying one last time"));
root->utime = 0;
ret = update_directory(root, 0);
if (!ret)
printf(_("Last try succeeded.\n"));
}
if (ret == EAGAIN) {
- error(0, 0, _("server temporarily unreachable;\n"
- "mounting anyway"));
+ WARN(_("server temporarily unreachable;\n"
+ "mounting anyway"));
} else if (ret) {
- error(EXIT_FAILURE, 0, _("Mounting failed.\n%s"),
- dav_get_webdav_error());
+ ERR(_("Mounting failed.\n%s"), dav_get_webdav_error());
} else {
dav_statfs();
}
@@ -1020,8 +1018,24 @@
if (is_dir(*nodep)) {
if (!(*nodep)->utime)
update_directory(*nodep, retry);
- } else if (is_open(*nodep)) {
- attr_from_cache_file(*nodep);
+ } else {
+
+ if (is_open(*nodep))
+ attr_from_cache_file(*nodep);
+ else if (!is_dirty(*nodep)) {
+ int ret;
+
+ dav_props *props = NULL;
+ ret = dav_get_collection((*nodep)->path, &props);
+
+ if (ret == 0) {
+ if ((*nodep)->size != props->size) {
+ (*nodep)->size = props->size;
+ delete_cache_file(*nodep);
+ }
+ dav_delete_props(props);
+ }
+ }
}
return 0;
@@ -2286,7 +2300,7 @@
}
if (is_cached(node)) {
- if ((!node->etag && props->mtime > node->smtime)
+ if ((!props->etag && props->mtime > node->smtime)
|| (node->etag && props->etag
&& strcmp(node->etag, props->etag) != 0)) {
if (is_open(node)) {
@@ -2745,7 +2759,7 @@
{
struct passwd *pw = getpwuid(default_uid);
if (!pw || !pw->pw_name)
- error(EXIT_FAILURE, 0, _("can't read user data base"));
+ ERR(_("can't read user data base"));
char *dir_name = ne_concat(host, path, mpoint + 1, "+", pw->pw_name, NULL);
*(dir_name + strlen(host) + strlen(path) - 1) = '+';
char *pos = strchr(dir_name, '/');
@@ -2756,7 +2770,7 @@
DIR *tl_dir = opendir(dir);
if (!tl_dir)
- error(EXIT_FAILURE, 0, _("can't open cache directory %s"), dir);
+ ERR(_("can't open cache directory %s"), dir);
struct dirent *de = readdir(tl_dir);
while (de && !cache_dir) {
@@ -2771,21 +2785,18 @@
if (!cache_dir) {
cache_dir = ne_concat(dir, "/", dir_name, NULL);
if (mkdir(cache_dir, S_IRWXU) != 0)
- error(EXIT_FAILURE, 0, _("can't create cache directory %s"),
+ ERR(_("can't create cache directory %s"),
cache_dir);
}
free(dir_name);
struct stat st;
if (stat(cache_dir, &st) != 0)
- error(EXIT_FAILURE, 0, _("can't access cache directory %s"),
- cache_dir);
+ ERR(_("can't access cache directory %s"), cache_dir);
if (st.st_uid != geteuid())
- error(EXIT_FAILURE, 0, _("wrong owner of cache directory %s"),
- cache_dir);
+ ERR(_("wrong owner of cache directory %s"), cache_dir);
if ((DAV_A_MASK & st.st_mode) != S_IRWXU)
- error(EXIT_FAILURE, 0,
- _("wrong permissions set for cache directory %s"), cache_dir);
+ ERR(_("wrong permissions set for cache directory %s"), cache_dir);
}
|
[-]
[+]
|
Changed |
_service:tar_git:davfs2-1.7.0+git3.tar.gz/upstream/src/dav_fuse.c
^
|
@@ -1,5 +1,6 @@
/* dav_fuse.c: interface to the fuse kernel module FUSE_KERNEL_VERSION 7.
Copyright (C) 2006, 2007, 2008. 2009, 2014, 2020 Werner Baumann
+ Copyright (C) 2022 Ali Abdallah <ali.abdallah@suse.com>
This file is part of davfs2.
@@ -187,7 +188,11 @@
unmounting = 1;
pid_t pid = fork();
if (pid == 0) {
+#if defined(__linux__)
execl("/bin/umount", "umount", "-il", mountpoint, NULL);
+#elif defined(__FreeBSD__)
+ execl("/sbin/umount", "umount", "-v", mountpoint, NULL);
+#endif
_exit(EXIT_FAILURE);
}
}
@@ -920,7 +925,7 @@
out->st.files = st->files;
out->st.ffree = st->ffree;
out->st.namelen = st->namelen;
- out->st.frsize = 0;
+ out->st.frsize = st->bsize;
out->st.padding = 0;
int i;
for (i = 0; i < 6; i++)
|
[-]
[+]
|
Changed |
_service:tar_git:davfs2-1.7.0+git3.tar.gz/upstream/src/defaults.h
^
|
@@ -25,6 +25,14 @@
/* Misc. */
/*=======*/
+#ifdef __FreeBSD__
+#define MS_NOSUID MNT_NOSUID
+#define MS_NOEXEC MNT_NOEXEC
+#define MS_RDONLY MNT_RDONLY
+#define MS_MGC_VAL 0
+#define MS_NODEV 0
+#endif
+
/* File system type to be used with 'mount -t' and fstab. */
#define DAV_FS_TYPE "davfs"
|
[-]
[+]
|
Changed |
_service:tar_git:davfs2-1.7.0+git3.tar.gz/upstream/src/kernel_interface.c
^
|
@@ -1,5 +1,6 @@
/* kernel_interface.c.
Copyright (C) 2006, 2007, 2008, 2009, 2014, 2020 Werner Baumann
+ Copyright (C) 2022 Ali Abdallah <ali.abdallah@suse.com>
This file is part of davfs2.
@@ -20,8 +21,6 @@
#include "config.h"
-#include <errno.h>
-#include <error.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
@@ -48,12 +47,14 @@
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
+#include <sys/uio.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#include <sys/wait.h>
+#include "util.h"
#include "defaults.h"
#include "mount_davfs.h"
#include "cache.h"
@@ -73,6 +74,59 @@
/* Name of the device to communicate with the kernel file system. */
#define FUSE_DEV_NAME "fuse"
+#ifdef __FreeBSD__
+enum { DAV_IOV_FSTYPE, DAV_IOV_ALLOW_OTHER, DAV_IOV_FSPATH, DAV_IOV_FSNAME,
+ DAV_IOV_FD, DAV_IOV_MAX_READ, DAV_IOV_ERR, DAV_IOV_MAX};
+
+/* max pairs of iovec mount options */
+#define DAV_MAX_IOVEC_LEN (DAV_IOV_MAX + 1) * 2
+
+/* Code taken from FreeBSD sbin/mount */
+static void
+add_iovec_opt(struct iovec **iov, int *iovlen, const char *name, void *val,
+ size_t len)
+{
+ int i;
+
+ if (*iovlen < 0)
+ return;
+
+ i = *iovlen;
+
+ if (i + 2 > (DAV_MAX_IOVEC_LEN))
+ {
+ ERR("DAV_MAX_IOVEC_LEN reached\n");
+ }
+
+ (*iov)[i].iov_base = strdup(name);
+ (*iov)[i].iov_len = strlen(name) + 1;
+
+ i++;
+
+ (*iov)[i].iov_base = val;
+
+ if (len == (size_t)-1) {
+ if (val != NULL)
+ len = strlen(val) + 1;
+ else
+ len = 0;
+ }
+ (*iov)[i].iov_len = (int)len;
+ *iovlen = ++i;
+}
+
+static void free_iovec (struct iovec *iov, int iovlen)
+{
+ int i = 0;
+ for (i = 0; i <= iovlen; i+=2)
+ {
+ if (iov[i].iov_base)
+ free(iov[i].iov_base);
+ }
+
+ free(iov);
+}
+#endif
/* Public functions */
/*==================*/
@@ -81,9 +135,21 @@
dav_init_kernel_interface(int *dev, size_t *buf_size, const char *url,
const char *mpoint, const dav_args *args)
{
+#ifdef __FreeBSD__
+ struct iovec *iov;
+ int iovlen;
+ char errmsg[255];
+ char fdstr[15];
+ char bufstr[15];
+
+ iovlen = 0;
+ iov = NULL;
+ memset(errmsg, 0, sizeof(errmsg));
+#endif
+
uid_t orig = geteuid();
if (seteuid(0) != 0)
- error(EXIT_FAILURE, 0, _("can't change effective user id"));
+ ERR(_("can't change effective user id"));
char *path;
if (asprintf(&path, "%s/%s", DAV_DEV_DIR, FUSE_DEV_NAME) < 0)
@@ -92,11 +158,15 @@
*dev = open(path, O_RDWR | O_NONBLOCK);
if (*dev <= 0) {
- error(0, 0, _("loading kernel module fuse"));
+ ERR(_("loading kernel module fuse"));
int ret;
pid_t pid = fork();
if (pid == 0) {
+#if defined(__FreeBSD__)
+ execl("/sbin/kldload", "kldload", "fusefs", NULL);
+#elif defined(__linux__)
execl("/sbin/modprobe", "modprobe", "fuse", NULL);
+#endif
_exit(EXIT_FAILURE);
} else if (pid < 0) {
exit(EXIT_FAILURE);
@@ -106,13 +176,13 @@
}
if (ret) {
- error(0, 0, _("loading kernel module fuse failed"));
+ WARN(_("loading kernel module fuse failed"));
} else {
*dev = open(path, O_RDWR | O_NONBLOCK);
}
if (*dev <= 0) {
- error(0, 0, _("waiting for /dev/fuse to be created"));
+ WARN(_("waiting for /dev/fuse to be created"));
sleep(2);
*dev = open(path, O_RDWR | O_NONBLOCK);
}
@@ -120,23 +190,52 @@
free(path);
if (*dev <= 0) {
- error(EXIT_FAILURE, 0, _("can't open fuse device"));
+ ERR(_("can't open fuse device"));
}
if (*buf_size < (FUSE_MIN_READ_BUFFER + 4096)) {
*buf_size = FUSE_MIN_READ_BUFFER + 4096;
}
+#if defined(__FreeBSD__)
+ sprintf(fdstr, "%d", *dev);
+ sprintf(bufstr, "%lu", (unsigned long int) (*buf_size - 4096));
+
+ int allow_other = 1;
+
+ iov = malloc (sizeof (struct iovec) * (DAV_MAX_IOVEC_LEN));
+
+ add_iovec_opt(&iov, &iovlen, "fstype", __DECONST(void *, "fusefs"), (size_t)-1);
+ add_iovec_opt(&iov, &iovlen, "allow_other", __DECONST(void *, &allow_other), (size_t)-1);
+ add_iovec_opt(&iov, &iovlen, "fspath", __DECONST(void *, mpoint), (size_t)-1);
+ add_iovec_opt(&iov, &iovlen, "from", __DECONST(void *, "/dev/fuse"), (size_t)-1);
+
+ add_iovec_opt(&iov, &iovlen, "fsname=", __DECONST(void *, url), strlen(url)+1);
+ add_iovec_opt(&iov, &iovlen, "fd", fdstr, (size_t)-1);
+ add_iovec_opt(&iov, &iovlen, "max_read=", bufstr, (ssize_t)-1);
+ add_iovec_opt(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg));
+
+ if (nmount(iov, iovlen, args->mopts) == -1) {
+ if (*errmsg != '\0')
+ err(EXIT_FAILURE, _("mounting failed %s : %s"), url, errmsg);
+ else
+ err(EXIT_FAILURE, _("mounting failed %s"), url);
+ }
+
+ free_iovec(iov, iovlen);
+
+#elif defined(__linux__)
char *mdata;
if (asprintf(&mdata, "fd=%i,rootmode=%o,user_id=%i,group_id=%i,"
"allow_other,max_read=%lu", *dev, args->dir_mode, args->uid,
args->gid, (unsigned long int) (*buf_size - 4096)) < 0)
abort();
if (mount(url, mpoint, "fuse", args->mopts, mdata) != 0) {
- error(EXIT_FAILURE, errno, _("mounting failed"));
+ ERR(_("mounting failed"));
}
free(mdata);
+#endif
if (seteuid(orig) != 0)
|
[-]
[+]
|
Changed |
_service:tar_git:davfs2-1.7.0+git3.tar.gz/upstream/src/mount_davfs.c
^
|
@@ -21,8 +21,6 @@
#include "config.h"
#include <ctype.h>
-#include <errno.h>
-#include <error.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
@@ -73,10 +71,17 @@
#include <sys/types.h>
#endif
+#ifndef __linux__
+#include <sys/sysctl.h>
+#endif
+
+#include <fstab.h>
+
#include <ne_string.h>
#include <ne_uri.h>
#include <ne_utils.h>
+#include "util.h"
#include "defaults.h"
#include "mount_davfs.h"
#include "kernel_interface.h"
@@ -92,6 +97,10 @@
#endif
+#ifdef __FreeBSD__
+#define VFS_USERMOUNT "vfs.usermount"
+#endif
+
/* Private global variables */
/*==========================*/
@@ -101,9 +110,11 @@
/* The canonicalized mointpoint. */
static char *mpoint;
+#ifdef __linux__
/* The file that holds information about mounted filesystems
(/proc/mounts or /etc/mtab) */
static char *mounts;
+#endif
/* The PID file */
static char *pidfile;
@@ -224,9 +235,9 @@
dav_args *args = parse_commandline(argc, argv);
if (geteuid() != 0)
- error(EXIT_FAILURE, errno, _("program is not setuid root"));
+ ERR(_("program is not setuid root"));
if (seteuid(getuid()) != 0)
- error(EXIT_FAILURE, errno, _("can't change effective user id"));
+ ERR(_("can't change effective user id"));
if (getuid() != 0)
check_fstab(args);
@@ -272,7 +283,7 @@
} else if (childpid < 0) {
delete_args(args);
- error(EXIT_FAILURE, errno, _("can't start daemon process"));
+ ERR(_("can't start daemon process"));
}
if (args->debug & DAV_DBG_CONFIG)
@@ -292,7 +303,7 @@
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "Releasing root privileges");
uid_t daemon_id = geteuid();
if (seteuid(0) != 0)
- error(EXIT_FAILURE, errno, _("can't change effective user id"));
+ ERR(_("can't change effective user id"));
ret = setuid(daemon_id);
if (ret) {
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR),
@@ -393,24 +404,23 @@
{
struct group *grp = getgrnam(args->dav_group);
if (!grp)
- error(EXIT_FAILURE, errno, _("group %s does not exist"),
+ ERR(_("group %s does not exist"),
args->dav_group);
if (seteuid(0) != 0)
- error(EXIT_FAILURE, errno, _("can't change effective user id"));
+ ERR(_("can't change effective user id"));
if (setgid(grp->gr_gid) != 0)
- error(EXIT_FAILURE, errno, _("can't change group id"));
+ ERR(_("can't change group id"));
if (getuid() == 0) {
struct passwd *pw = getpwnam(args->dav_user);
if (!pw)
- error(EXIT_FAILURE, errno, _("user %s does not exist"),
+ ERR(_("user %s does not exist"),
args->dav_user);
if (seteuid(pw->pw_uid) != 0)
- error(EXIT_FAILURE, errno, _("can't change effective user id"));
-
+ ERR(_("can't change effective user id"));
} else {
if (seteuid(getuid()) != 0)
- error(EXIT_FAILURE, errno, _("can't change effective user id"));
+ ERR(_("can't change effective user id"));
}
if (args->debug & DAV_DBG_CONFIG)
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG),
@@ -431,8 +441,10 @@
{
struct stat st;
+#ifdef __linux__
+
if (lstat(_PATH_MOUNTED, &st) != 0)
- error(EXIT_FAILURE, errno, _("can't access file %s"), _PATH_MOUNTED);
+ ERR(_("can't access file %s"), _PATH_MOUNTED);
int mtab_is_link = S_ISLNK(st.st_mode);
if (stat(DAV_MOUNTS, &st) == 0) {
@@ -450,48 +462,47 @@
abort();
if (stat(utab_dir, &st) != 0) {
if (seteuid(0) != 0)
- error(EXIT_FAILURE, errno, _("can't change effective user id"));
+ ERR(_("can't change effective user id"));
if (mkdir(utab_dir, S_IRWXU | S_IRGRP | S_IXGRP
| S_IROTH | S_IXOTH) == 0) {
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " and %s/%s",
utab_dir, DAV_UTAB);
} else {
- error(0, errno, _("can't create directory %s"), utab_dir);
+ WARN(_("can't create directory %s"), utab_dir);
}
if (seteuid(getuid()) != 0)
- error(EXIT_FAILURE, errno, _("can't change effective user id"));
+ ERR(_("can't change effective user id"));
}
free(utab_dir);
}
+#endif
if (seteuid(0) != 0)
- error(EXIT_FAILURE, errno, _("can't change effective user id"));
+ ERR(_("can't change effective user id"));
if (stat(DAV_SYS_RUN, &st) != 0) {
if (mkdir(DAV_SYS_RUN, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH | S_ISVTX)
!= 0 && errno != EEXIST)
- error(EXIT_FAILURE, errno, _("can't create directory %s"),
+ ERR(_("can't create directory %s"),
DAV_SYS_RUN);
}
if (stat(DAV_SYS_RUN, &st) != 0)
- error(EXIT_FAILURE, errno, _("can't access directory %s"),
+ ERR(_("can't access directory %s"),
DAV_SYS_RUN);
if ((st.st_mode & (S_IRWXG | S_ISVTX)) != (S_IRWXG | S_ISVTX)) {
if (chmod(DAV_SYS_RUN, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH | S_ISVTX)
!= 0)
- error(EXIT_FAILURE, errno,
- _("can't change mode of directory %s"), DAV_SYS_RUN);
+ ERR(_("can't change mode of directory %s"), DAV_SYS_RUN);
}
struct group *grp = getgrnam(args->dav_group);
if (!grp)
- error(EXIT_FAILURE, errno, _("group %s does not exist"),
+ ERR(_("group %s does not exist"),
args->dav_group);
if (st.st_gid != grp->gr_gid) {
if (chown(DAV_SYS_RUN, 0, grp->gr_gid) != 0)
- error(EXIT_FAILURE, errno,
- _("can't change group of directory %s"), DAV_SYS_RUN);
+ ERR(_("can't change group of directory %s"), DAV_SYS_RUN);
}
if (seteuid(getuid()) != 0)
- error(EXIT_FAILURE, errno, _("can't change effective user id"));
+ ERR(_("can't change effective user id"));
if (getuid() != 0) {
@@ -543,65 +554,63 @@
if (strcmp(args->cache_dir, args->sys_cache) == 0) {
if (seteuid(0) != 0)
- error(EXIT_FAILURE, errno, _("can't change effective user id"));
+ ERR(_("can't change effective user id"));
if (stat(args->sys_cache, &st) != 0) {
if (mkdir(args->sys_cache, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH)
!= 0)
- error(EXIT_FAILURE, errno, _("can't create directory %s"),
+ ERR(_("can't create directory %s"),
args->sys_cache);
}
if (stat(args->sys_cache, &st) != 0)
- error(EXIT_FAILURE, errno, _("can't access directory %s"),
+ ERR(_("can't access directory %s"),
args->sys_cache);
|
[-]
[+]
|
Changed |
_service:tar_git:davfs2-1.7.0+git3.tar.gz/upstream/src/umount_davfs.c
^
|
@@ -20,8 +20,6 @@
#include "config.h"
-#include <error.h>
-#include <errno.h>
#include <getopt.h>
#ifdef HAVE_LIBINTL_H
#include <libintl.h>
@@ -40,6 +38,7 @@
#include <ne_string.h>
+#include "util.h"
#include "defaults.h"
#ifdef ENABLE_NLS
@@ -50,6 +49,12 @@
#define bindtextdomain(Domainname, Dirname)
#endif
+#if defined(__linux__)
+#define UMOUNT_CMD "umount -i"
+#elif defined(__FreeBSD__)
+#define UMOUNT_CMD "umount"
+#endif
+
/* This is lazy programming. All the dirty work is left to the real umount
program, while we just sit and wait for mount.davfs to terminate.
@@ -108,28 +113,27 @@
case '?':
break;
default:
- error(EXIT_FAILURE, 0, _("unknown error parsing arguments"));
+ ERR(_("unknown error parsing arguments"));
}
o = getopt_long(argc, argv, short_options, options, NULL);
}
if (optind > (argc - 1))
- error(EXIT_FAILURE, 0, _("missing argument"));
+ ERR(_("missing argument"));
if (optind < (argc - 1))
- error(EXIT_FAILURE, 0, _("too many arguments"));
+ ERR(_("too many arguments"));
- char *mpoint = canonicalize_file_name(argv[optind]);
+ char *mpoint = mcanonicalize_file_name(argv[optind]);
char *umount_command = NULL;
if (mpoint) {
- umount_command = ne_concat("umount -i '", mpoint, "'", NULL);
+ umount_command = ne_concat(UMOUNT_CMD " '", mpoint, "'", NULL);
} else {
- umount_command = ne_concat("umount -i '", argv[optind], "'", NULL);
- error(0, 0,
- _("\n"
- " can't evaluate PID file name;\n"
- " trying to unmount anyway;\n"
- " please wait for %s to terminate"), PROGRAM_NAME);
+ umount_command = ne_concat(UMOUNT_CMD " '", argv[optind], "'", NULL);
+ WARN(_("\n"
+ " can't evaluate PID file name;\n"
+ " trying to unmount anyway;\n"
+ " please wait for %s to terminate"), PROGRAM_NAME);
return system(umount_command);
}
@@ -145,14 +149,14 @@
char *pidfile = ne_concat(DAV_SYS_RUN, "/", mp, ".pid", NULL);
free(mp);
- char *pid = NULL;
+ char pid[32];
+ memset (pid, '\0', sizeof(pid));
FILE *file = fopen(pidfile, "r");
- if (!file || fscanf(file, "%m[0-9]", &pid) != 1 || !pid) {
- error(0, 0,
- _("\n"
- " can't read PID from file %s;\n"
- " trying to unmount anyway;\n"
- " please wait for %s to terminate"), pidfile, PROGRAM_NAME);
+ if (!file || fscanf(file, "%s[0-9]", pid) != 1 || pid[0] == '\0') {
+ WARN(_("\n"
+ " can't read PID from file %s;\n"
+ " trying to unmount anyway;\n"
+ " please wait for %s to terminate"), pidfile, PROGRAM_NAME);
return system(umount_command);
}
fclose(file);
@@ -160,11 +164,10 @@
char *ps_command = ne_concat("ps -p ", pid, NULL);
FILE *ps_in = popen(ps_command, "r");
if (!ps_in) {
- error(0, 0,
- _("\n"
- " can't read process list;\n"
- " trying to unmount anyway;\n"
- " please wait for %s to terminate"), PROGRAM_NAME);
+ WARN(_("\n"
+ " can't read process list;\n"
+ " trying to unmount anyway;\n"
+ " please wait for %s to terminate"), PROGRAM_NAME);
return system(umount_command);
}
@@ -176,11 +179,10 @@
pclose(ps_in);
if (!found) {
- error(0, 0,
- _("\n"
- " can't find %s-process with pid %s;\n"
- " trying to unmount anyway.\n"
- " you propably have to remove %s manually"),
+ WARN(_("\n"
+ " can't find %s-process with pid %s;\n"
+ " trying to unmount anyway.\n"
+ " you propably have to remove %s manually"),
PROGRAM_NAME, pid, pidfile);
return system(umount_command);
}
@@ -201,7 +203,7 @@
ps_in = popen(ps_command, "r");
if (!ps_in) {
printf("\n");
- error(EXIT_FAILURE, 0, _("an error occurred while waiting; "
+ ERR(_("an error occurred while waiting; "
"please wait for %s to terminate"), PROGRAM_NAME);
}
|
[-]
[+]
|
Added |
_service:tar_git:davfs2-1.7.0+git3.tar.gz/upstream/src/util.h
^
|
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2022 Ali Abdallah <ali.abdallah@suse.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __DAVFS_UTIL_H
+#define __DAVFS_UTIL_H
+
+#include "config.h"
+
+#include <string.h>
+#include <stdio.h>
+#include <locale.h>
+#include <stdarg.h>
+#include <errno.h>
+#include <err.h>
+
+#ifdef ERR
+#undef ERR
+#endif
+
+#define ERR(fmt, ...) { \
+ if (errno != 0) \
+ errx(EXIT_FAILURE, fmt, ## __VA_ARGS__); \
+ else { \
+ fprintf(stderr, fmt, ## __VA_ARGS__); \
+ fprintf(stderr, "\n"); \
+ exit(EXIT_FAILURE); \
+ } \
+}
+
+#ifdef WARN
+#undef WARN
+#endif
+
+#define WARN(fmt, ...) { \
+ if (errno != 0) \
+ warnx(fmt, ## __VA_ARGS__); \
+ else { \
+ fprintf(stdout, fmt, ## __VA_ARGS__); \
+ fprintf(stdout, "\n"); \
+ }\
+}
+
+#ifdef __FreeBSD__
+#define ERR_AT_LINE(filename, lineno, fmt, ...) {\
+ fprintf(stderr, "%s:%d :", filename, lineno); \
+ if (errno != 0) \
+ err(EXIT_FAILURE, fmt, ## __VA_ARGS__); \
+ else \
+ fprintf(stderr, fmt, ## __VA_ARGS__); \
+ fprintf(stderr, "\n"); \
+ exit(EXIT_FAILURE); \
+}
+#endif
+
+#ifdef __linux__
+#include <error.h>
+#define ERR_AT_LINE(filename, lineno, fmt, ...) \
+ error_at_line(EXIT_FAILURE, 0, filename, lineno, fmt, ## __VA_ARGS__);
+#endif
+
+#ifdef __FreeBSD__
+#define mcanonicalize_file_name(path) \
+ realpath(path, NULL)
+#endif
+
+#ifdef __linux__
+#define mcanonicalize_file_name canonicalize_file_name
+#endif
+
+#endif /* __DAVFS_UTIL_H */
|
[-]
[+]
|
Changed |
_service:tar_git:davfs2-1.7.0+git3.tar.gz/upstream/src/webdav.c
^
|
@@ -20,8 +20,6 @@
#include "config.h"
-#include <errno.h>
-#include <error.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
@@ -73,6 +71,7 @@
#include <ne_utils.h>
#include <ne_xml.h>
+#include "util.h"
#include "defaults.h"
#include "mount_davfs.h"
#include "webdav.h"
@@ -365,7 +364,7 @@
#endif /* HAVE_ICONV */
if (ne_sock_init() != 0)
- error(EXIT_FAILURE, errno, _("socket library initialization failed"));
+ ERR(_("socket library initialization failed"));
if (args->neon_debug & ~NE_DBG_HTTPPLAIN) {
char *buf = malloc(log_bufsize);
@@ -377,8 +376,7 @@
log_func->close = NULL;
log_stream = fopencookie(buf, "w", *log_func);
if (!log_stream)
- error(EXIT_FAILURE, errno,
- _("can't open stream to log neon-messages"));
+ ERR(_("can't open stream to log neon-messages"));
ne_debug_init(log_stream, args->neon_debug);
}
@@ -419,18 +417,18 @@
if (strcmp(args->scheme, "https") == 0) {
if (!ne_has_support(NE_FEATURE_SSL))
- error(EXIT_FAILURE, 0, _("neon library does not support TLS/SSL"));
+ ERR(_("neon library does not support TLS/SSL"));
ne_ssl_set_verify(session, ssl_verify, NULL);
if (args->trust_server_cert) {
server_cert = ne_ssl_cert_read(args->trust_server_cert);
if (!server_cert)
- error(EXIT_FAILURE, 0, _("can't read server certificate %s"),
+ ERR(_("can't read server certificate %s"),
args->trust_server_cert);
} else if (args->trust_ca_cert) {
ne_ssl_certificate *ca_cert = ne_ssl_cert_read(args->trust_ca_cert);
if (!ca_cert)
- error(EXIT_FAILURE, 0, _("can't read server certificate %s"),
+ ERR(_("can't read server certificate %s"),
args->trust_ca_cert);
ne_ssl_trust_cert(session, ca_cert);
} else {
@@ -443,13 +441,13 @@
if (!client_cert) {
uid_t orig = geteuid();
if (seteuid(0) != 0)
- error(EXIT_FAILURE, errno, _("can't change effective user id"));
+ ERR(_("can't change effective user id"));
client_cert = ne_ssl_clicert_read(args->clicert);
if (seteuid(orig) != 0)
- error(EXIT_FAILURE, errno, _("can't change effective user id"));
+ ERR(_("can't change effective user id"));
}
if (!client_cert)
- error(EXIT_FAILURE, 0, _("can't read client certificate %s"),
+ ERR(_("can't read client certificate %s"),
args->clicert);
if (client_cert && ne_ssl_clicert_encrypted(client_cert)) {
char *pw = NULL;
@@ -467,8 +465,7 @@
free(pw);
}
if (ret)
- error(EXIT_FAILURE, 0,
- _("can't decrypt client certificate %s"),
+ ERR(_("can't decrypt client certificate %s"),
args->clicert);
}
ne_ssl_set_clicert(session, client_cert);
@@ -533,8 +530,7 @@
initialized = 1;
if (!caps.dav_class1 && !ignore_dav_header) {
if (have_terminal) {
- error(EXIT_FAILURE, 0,
- _("mounting failed; the server does not support WebDAV"));
+ ERR(_("mounting failed; the server does not support WebDAV"));
} else {
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR),
_("mounting failed; the server does not support WebDAV"));
@@ -545,7 +541,7 @@
ne_lockstore_register(locks, session);
} else if (locks) {
if (have_terminal)
- error(0, 0, _("warning: the server does not support locks"));
+ WARN(_("warning: the server does not support locks"));
ne_lockstore_destroy(locks);
locks = NULL;
}
@@ -694,7 +690,7 @@
free(props->path);
if (props->name)
free(props->name);
- if (props->etag)
+ if (props->etag)
free(props->etag);
free(props);
}
@@ -725,7 +721,7 @@
dav_props *tofree = ctx.results;
ctx.results = ctx.results->next;
dav_delete_props(tofree);
- }
+ }
}
*props = ctx.results;
@@ -820,7 +816,7 @@
const ne_status *status = ne_get_status(req);
if (!ret && status->code == 200) {
-
+
if (modified)
*modified = 1;
@@ -1010,7 +1006,7 @@
char *spath = ne_path_escape(src);
char *dst_path = ne_path_escape(dst);
- ret = ne_move(session, 1, spath, dst_path);
+ ret = ne_move(session, 1, spath, dst_path);
ret = get_error(ret, "MOVE", session);
if (!ret && locks) {
@@ -1328,7 +1324,7 @@
port = ne_uri_defaultport(uri->scheme);
ne_session *rd_sess = ne_session_create(uri->scheme, uri->host, port);
-
+
ne_set_read_timeout(rd_sess, read_timeout);
ne_set_connect_timeout(rd_sess, connect_timeout);
@@ -1343,7 +1339,7 @@
if (proxy->host) {
ne_session_proxy(rd_sess, proxy->host, proxy->port);
ne_add_proxy_auth(rd_sess, NE_AUTH_ALL, auth, "proxy");
- }
+ }
if (strcmp(uri->scheme, "https") == 0) {
ne_ssl_set_verify(rd_sess, ssl_verify, NULL);
@@ -1702,7 +1698,7 @@
userdata must be a get_context structure that holds at least the name of
the local file. If it does not contain a file descriptor, the file is
opened for writing and the file descriptor is stored in the get_context
- structure. In case of an error a error flag is set.
+ structure. In case of an error a error flag is set.
userdata : A get_context structure, containing the name of the local file,
the file descriptor (if the file is open), and an error flag.
block : Buffer containing the data.
@@ -1995,7 +1991,7 @@
if (ne_ssl_cert_cmp(cert, server_cert) == 0)
return 0;
if (have_terminal)
- error(0, 0, _("the server certificate is not trusted"));
+ WARN(_("the server certificate is not trusted"));
return -1;
}
@@ -2004,7 +2000,7 @@
char *digest = ne_calloc(NE_SSL_DIGESTLEN);
if (!issuer || !subject || ne_ssl_cert_digest(cert, digest) != 0) {
if (have_terminal) {
- error(0, 0, _("error processing server certificate"));
+ WARN(_("error processing server certificate"));
} else {
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR),
_("error processing server certificate"));
@@ -2018,15 +2014,15 @@
int ret = -1;
if (have_terminal) {
if (failures & NE_SSL_NOTYETVALID)
- error(0, 0, _("the server certificate is not yet valid"));
+ WARN(_("the server certificate is not yet valid"));
if (failures & NE_SSL_EXPIRED)
- error(0, 0, _("the server certificate has expired"));
+ WARN(_("the server certificate has expired"));
if (failures & NE_SSL_IDMISMATCH)
- error(0, 0, _("the server certificate does not match the server name"));
+ WARN(_("the server certificate does not match the server name"));
if (failures & NE_SSL_UNTRUSTED)
- error(0, 0, _("the server certificate is not trusted"));
+ WARN(_("the server certificate is not trusted"));
|
[-]
[+]
|
Changed |
_service:tar_git:davfs2.yaml
^
|
@@ -1,6 +1,6 @@
Name: davfs2
Summary: Linux FUSE driver that allows you to mount a WebDAV resource
-Version: 1.6.1
+Version: 1.7.0
Release: 0
Group: System
License: GPLv3+
@@ -25,17 +25,24 @@
davfs2 supports SSL and proxy, HTTP authentication (basic and digest)
and client certificates.
- %if "%{?vendor}" == "chum"
- PackageName: davfs2
+
+ %if 0%{?_chum}
+ Title: davfs2
Type: console-application
+ DeveloperName: Ali Abdallah
+ PackagedBy: nephros
Categories:
- Network
- Filesystem
Custom:
+ Repo: https://git.savannah.nongnu.org/git/davfs2.git
PackagingRepo: https://github.com/sailfishos-chum/davfs2
- Url:
- Help: http://savannah.nongnu.org/userguide/
+ Links:
+ Homepage: %{url}
+ Help: https://forum.sailfishos.org/search?q=davfs%20order%3Alikes
+ Bugtracker: https://savannah.nongnu.org/bugs/?group=davfs2&func=browse&set=open
%endif
+
#Requires:
PkgBR:
- autoconf
@@ -63,7 +70,7 @@
- 'dav_group=%{dav_group}'
- 'dav_user=%{dav_user}'
- 'dav_syscachedir=%{dav_cachedir}'
-
+Builder: none
Files:
# is there a macro for /sbin?
- '/sbin/*'
|