[-]
[+]
|
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)
- error(EXIT_FAILURE, 0, _("can't change effective user id"));
+ ERR(_("can't change effective user id"));
}
|
[-]
[+]
|
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);
if ((st.st_mode & S_IRWXG) != S_IRWXG) {
if (chmod(args->sys_cache, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH)
!= 0)
- error(EXIT_FAILURE, errno,
- _("can't change mode of directory %s"),
+ ERR(_("can't change mode of directory %s"),
args->sys_cache);
}
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(args->sys_cache, 0, grp->gr_gid) != 0)
- error(EXIT_FAILURE, errno,
- _("can't change group of directory %s"),
+ ERR(_("can't change group of directory %s"),
args->sys_cache);
}
if (seteuid(getuid()) != 0)
- error(EXIT_FAILURE, errno, _("can't change effective user id"));
+ ERR(_("can't change effective user id"));
} else {
struct passwd *pw = getpwuid(getuid());
if (!pw)
- error(EXIT_FAILURE, errno, _("can't read user data base"));
+ ERR(_("can't read user data base"));
if (!pw->pw_name)
- error(EXIT_FAILURE, 0, _("can't read user data base"));
+ ERR(_("can't read user data base"));
if (stat(args->cache_dir, &st) != 0) {
if (mkdir(args->cache_dir, 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->cache_dir);
}
if (stat(args->cache_dir, &st) != 0)
- error(EXIT_FAILURE, errno, _("can't access directory %s"),
+ ERR(_("can't access directory %s"),
args->cache_dir);
if ((st.st_uid != getuid() || (st.st_mode & S_IRWXU) != S_IRWXU)
&& (st.st_mode & S_IRWXO) != S_IRWXO) {
if ((st.st_mode & S_IRWXG) != S_IRWXG)
- error(EXIT_FAILURE, errno, _("can't access directory %s"),
+ ERR(_("can't access directory %s"),
args->cache_dir);
struct group *grp = getgrgid(st.st_gid);
if (!grp)
- error(EXIT_FAILURE, errno, _("can't read group data base"));
+ ERR(_("can't read group data base"));
char **members = grp->gr_mem;
while (*members && strcmp(*members, pw->pw_name) != 0)
members++;
if (!*members)
- error(EXIT_FAILURE, 0, _("can't access directory %s"),
+ ERR(_("can't access directory %s"),
args->cache_dir);
}
@@ -617,18 +626,10 @@
static char *
check_double_mounts(dav_args *args)
{
- FILE *mtab = setmntent(mounts, "r");
- if (!mtab)
- error(EXIT_FAILURE, errno, _("can't open file %s"), mounts);
- struct mntent *mt = getmntent(mtab);
- while (mt) {
- if (strcmp(mpoint, mt->mnt_dir) == 0
- && strcmp(url, mt->mnt_fsname) == 0)
- error(EXIT_FAILURE, 0, _("%s is already mounted on %s"), url,
- mpoint);
- mt = getmntent(mtab);
+ if (is_mounted()) {
+ ERR(_("%s is already mounted on %s"), url,
+ mpoint);
}
- endmntent(mtab);
char *m = mpoint;
while (*m == '/')
@@ -647,7 +648,7 @@
FILE *file = fopen(pidf, "r");
if (file)
- error(EXIT_FAILURE, 0, _("found PID file %s.\n"
+ ERR(_("found PID file %s.\n"
"Either %s is used by another process,\n"
"or another mount process ended irregular"), pidf, mpoint);
@@ -662,17 +663,30 @@
static void
check_fstab(const dav_args *args)
{
- dav_args *n_args = new_args();
- n_args->mopts = DAV_USER_MOPTS;
+ dav_args *n_args;
+ struct fstab *ft;
+
+#ifdef __FreeBSD__
+ int status;
+ int val;
+ size_t val_len = sizeof(int);
+
+ status = sysctlbyname (VFS_USERMOUNT, &val, &val_len, NULL, 0);
+
+ if (status != 0) {
+ WARN(_("sysctl on " VFS_USERMOUNT " failed"));
+ } else if (val == 1) {
+ /* User mount is set, allow user mouting */
+ return;
+ }
+#endif
+
+ if (setfsent() == 0)
+ ERR(_("can't open file %s"), _PATH_FSTAB);
- FILE *fstab = setmntent(_PATH_MNTTAB, "r");
- if (!fstab)
- error(EXIT_FAILURE, errno, _("can't open file %s"), _PATH_MNTTAB);
-
- struct mntent *ft = getmntent(fstab);
- while (ft) {
- if (ft->mnt_dir) {
- char *mp = canonicalize_file_name(ft->mnt_dir);
+ while ((ft = getfsent()) != NULL) {
+ if (ft->fs_file) {
+ char *mp = mcanonicalize_file_name(ft->fs_file);
if (mp) {
if (strcmp(mp, mpoint) == 0) {
free(mp);
@@ -681,52 +695,53 @@
free(mp);
}
}
- ft = getmntent(fstab);
}
+ (void) endfsent();
+
if (!ft)
- error(EXIT_FAILURE, 0, _("no entry for %s found in %s"), mpoint,
- _PATH_MNTTAB);
+ ERR(_("no entry for %s found in %s"), mpoint,
+ _PATH_FSTAB);
- if (strcmp(url, ft->mnt_fsname) != 0) {
- error(EXIT_FAILURE, 0, _("different URL in %s"), _PATH_MNTTAB);
+ if (strcmp(url, ft->fs_spec) != 0) {
+ ERR(_("different URL in %s"), _PATH_FSTAB);
}
- if (!ft->mnt_type || strcmp(DAV_FS_TYPE, ft->mnt_type) != 0)
- error(EXIT_FAILURE, 0, _("different file system type in %s"),
- _PATH_MNTTAB);
+ if (!ft->fs_vfstype || strcmp(DAV_FS_TYPE, ft->fs_vfstype) != 0)
+ ERR(_("different file system type in %s %s %s"), ft->fs_vfstype, DAV_FS_TYPE,
+ _PATH_FSTAB);
- if (ft->mnt_opts)
- get_options(n_args, ft->mnt_opts);
+ n_args = new_args();
+ n_args->mopts = DAV_USER_MOPTS;
- endmntent(fstab);
+ if (ft->fs_mntops)
+ get_options(n_args, ft->fs_mntops);
if (args->conf || n_args->conf) {
if (!args->conf || !n_args->conf
|| strcmp(args->conf, n_args->conf) != 0)
- error(EXIT_FAILURE, 0, _("different config file in %s"),
- _PATH_MNTTAB);
+ ERR(_("different config file in %s"),
+ _PATH_FSTAB);
}
if (args->cl_username || n_args->cl_username) {
if (!args->cl_username || !n_args->cl_username
|| strcmp(args->cl_username, n_args->cl_username) != 0)
- error(EXIT_FAILURE, 0, _("different username in %s"), _PATH_MNTTAB);
+ ERR(_("different username in %s"), _PATH_FSTAB);
}
if (!n_args->user && !n_args->users)
- error(EXIT_FAILURE, 0,
- _("neither option `user' nor option `users' set in %s"),
- _PATH_MNTTAB);
+ ERR(_("neither option `user' nor option `users' set in %s"),
+ _PATH_FSTAB);
if (args->mopts != n_args->mopts || args->grpid != n_args->grpid)
- error(EXIT_FAILURE, 0, _("different mount options in %s"),
- _PATH_MNTTAB);
+ ERR(_("different mount options in %s"),
+ _PATH_FSTAB);
if (args->uid != n_args->uid)
- error(EXIT_FAILURE, 0, _("different uid in %s"), _PATH_MNTTAB);
+ ERR(_("different uid in %s"), _PATH_FSTAB);
if (args->gid != n_args->gid)
- error(EXIT_FAILURE, 0, _("different gid in %s"), _PATH_MNTTAB);
+ ERR(_("different gid in %s"), _PATH_FSTAB);
if (args->dir_mode != n_args->dir_mode)
- error(EXIT_FAILURE, 0, _("different dir_mode in %s"), _PATH_MNTTAB);
+ ERR(_("different dir_mode in %s"), _PATH_FSTAB);
if (args->file_mode != n_args->file_mode)
- error(EXIT_FAILURE, 0, _("different file_mode in %s"), _PATH_MNTTAB);
+ ERR(_("different file_mode in %s"), _PATH_FSTAB);
delete_args(n_args);
}
@@ -745,26 +760,24 @@
return;
if (args->uid != getuid())
- error(EXIT_FAILURE, 0,
- _("you can't set file owner different from your uid"));
+ ERR(_("you can't set file owner different from your uid"));
if (args->debug & DAV_DBG_CONFIG)
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "uid ok");
if (getgid() != args->gid) {
struct passwd *pw = getpwuid(getuid());
if (!pw)
- error(EXIT_FAILURE, errno, _("can't read user data base"));
+ ERR(_("can't read user data base"));
if (!pw->pw_name)
- error(EXIT_FAILURE, 0, _("can't read user data base"));
+ ERR(_("can't read user data base"));
struct group *grp = getgrgid(args->gid);
if (!grp)
- error(EXIT_FAILURE, 0, _("can't read group data base"));
+ ERR(_("can't read group data base"));
char **members = grp->gr_mem;
while (*members && strcmp(*members, pw->pw_name) != 0)
members++;
if (!*members)
- error(EXIT_FAILURE, 0,
- _("you must be member of the group of the file system"));
+ ERR(_("you must be member of the group of the file system"));
}
if (args->debug & DAV_DBG_CONFIG)
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "gid ok");
@@ -772,12 +785,12 @@
struct passwd *pw;
pw = getpwuid(getuid());
if (!pw)
- error(EXIT_FAILURE, errno, _("can't read user data base"));
+ ERR(_("can't read user data base"));
if (!pw->pw_name)
- error(EXIT_FAILURE, 0, _("can't read user data base"));
+ ERR(_("can't read user data base"));
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 (pw->pw_gid != grp->gr_gid) {
int ngroups = getgroups(0, NULL);
@@ -786,9 +799,9 @@
groups = (gid_t *) malloc(ngroups * sizeof(gid_t));
if (!groups) abort();
if (getgroups(ngroups, groups) < 0)
- error(EXIT_FAILURE, 0, _("can't read group data base"));
+ ERR(_("can't read group data base"));
} else {
- error(EXIT_FAILURE, 0, _("can't read group data base"));
+ ERR(_("can't read group data base"));
}
int i;
for (i = 0; i < ngroups; i++) {
@@ -797,7 +810,7 @@
}
free(groups);
if (i == ngroups)
- error(EXIT_FAILURE, 0, _("user %s must be member of group %s"),
+ ERR(_("user %s must be member of group %s"),
pw->pw_name, grp->gr_name);
}
if (args->debug & DAV_DBG_CONFIG)
@@ -811,8 +824,38 @@
url (must be device in the mtab entry) and mpoint (mount point).
return value : 0 - no matching entry in the mtab-file (not mounted)
1 - matching entry in the mtab-file (mounted) */
-static int
-is_mounted(void)
+#ifdef __FreeBSD__
+static int is_mounted_freebsd(void)
+{
+ static struct statfs *sfsbuf;
+ size_t sfsbufsize;
+ int mntsize;
+ int i;
+ int found = 0;
+
+ mntsize = getfsstat(NULL, 0, MNT_NOWAIT);
+ if (mntsize > 0) {
+ sfsbufsize = (mntsize + 1) * sizeof(struct statfs);
+ if ((sfsbuf = malloc(sfsbufsize)) == NULL)
+ ERR("malloc");
+ mntsize = getfsstat(sfsbuf, (long)sfsbufsize, MNT_NOWAIT);
+ for (i = 0; i < mntsize; i++) {
+ struct statfs *sfs;
+ sfs = &sfsbuf[i];
+ if (strcmp(mpoint, sfs->f_mntonname) == 0
+ && strcmp(url, sfs->f_mntfromname) == 0) {
+ found = 1;
+ break;
+ }
+ }
+ }
+ free(sfsbuf);
+ return found;
+}
+#endif
+
+#ifdef __linux__
+static int is_mounted_linux(void)
{
int found = 0;
FILE *mtab = setmntent(mounts, "r");
@@ -828,6 +871,19 @@
endmntent(mtab);
return found;
}
+#endif
+
+static int
+is_mounted(void)
+{
+#ifdef __linux__
+ return is_mounted_linux();
+#elif __FreeBSD__
+ return is_mounted_freebsd();
+#else
+ return 0;
+#endif
+}
/* Parses commandline arguments and options and stores them in args and the
private global variables url and mpoint.
@@ -892,7 +948,7 @@
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);
}
@@ -901,7 +957,7 @@
switch (argc - i) {
case 0:
case 1:
- error(0, 0, _("missing argument"));
+ WARN(_("missing argument"));
usage();
exit(EXIT_FAILURE);
case 2:
@@ -911,13 +967,12 @@
url = ne_strdup(argv[i]);
}
i++;
- mpoint = canonicalize_file_name(argv[i]);
+ mpoint = mcanonicalize_file_name(argv[i]);
if (!mpoint)
- error(EXIT_FAILURE, 0,
- _("can't evaluate path of mount point %s"), mpoint);
+ ERR(_("can't evaluate path of mount point %s"), mpoint);
break;
default:
- error(0, 0, _("too many arguments"));
+ WARN(_("too many arguments"));
usage();
exit(EXIT_FAILURE);
}
@@ -925,22 +980,21 @@
if (getuid() != 0 && *argv[i] != '/') {
struct passwd *pw = getpwuid(getuid());
if (!pw || !pw->pw_dir)
- error(EXIT_FAILURE, 0,
- _("can't get home directory for uid %i"), getuid());
+ ERR(_("can't get home directory for uid %i"), getuid());
if (strstr(mpoint, pw->pw_dir) != mpoint)
- error(EXIT_FAILURE, 0, _("A relative mount point must lie "
+ ERR(_("A relative mount point must lie "
"within your home directory"));
}
if (!url)
- error(EXIT_FAILURE, 0, _("no WebDAV-server specified"));
+ ERR(_("no WebDAV-server specified"));
if (split_uri(&args->scheme, &args->host, &args->port, &args->path,
url) != 0)
- error(EXIT_FAILURE, 0, _("invalid URL"));
+ ERR(_("invalid URL"));
if (!args->port)
args->port = ne_uri_defaultport(args->scheme);
- return args;
+ return args;
}
@@ -955,7 +1009,7 @@
struct passwd *pw = getpwuid(getuid());
if (!pw || !pw->pw_dir)
- error(EXIT_FAILURE, 0, _("can't determine home directory"));
+ ERR(_("can't determine home directory"));
if (args->conf) {
if (*args->conf == '~') {
@@ -1060,22 +1114,20 @@
if (args->clicert) {
struct stat st;
if (seteuid(0) != 0)
- error(EXIT_FAILURE, errno, _("can't change effective user id"));
+ ERR(_("can't change effective user id"));
if (stat(args->clicert, &st) < 0)
- error(EXIT_FAILURE, 0, _("can't read client certificate %s"),
+ ERR(_("can't read client certificate %s"),
args->clicert);
if (seteuid(getuid()) != 0)
- error(EXIT_FAILURE, errno, _("can't change effective user id"));
+ ERR(_("can't change effective user id"));
if (st.st_uid != getuid() && st.st_uid != 0)
- error(EXIT_FAILURE, 0,
- _("client certificate file %s has wrong owner"),
- args->clicert);
+ ERR(_("client certificate file %s has wrong owner"),
+ args->clicert);
if ((st.st_mode &
(S_IXUSR | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID | S_ISVTX))
!= 0)
- error(EXIT_FAILURE, 0,
- _("client certificate file %s has wrong permissions"),
- args->clicert);
+ ERR(_("client certificate file %s has wrong permissions"),
+ args->clicert);
}
if (getuid() == 0 && !args->p_host) {
@@ -1109,10 +1161,10 @@
parse_secrets(dav_args *args)
{
if (seteuid(0) != 0)
- error(EXIT_FAILURE, errno, _("can't change effective user id"));
+ ERR(_("can't change effective user id"));
read_secrets(args, DAV_SYS_CONF_DIR "/" DAV_SECRETS);
if (seteuid(getuid()) != 0)
- error(EXIT_FAILURE, errno, _("can't change effective user id"));
+ ERR(_("can't change effective user id"));
if (args->secrets) {
read_secrets(args, args->secrets);
@@ -1226,6 +1278,7 @@
static void
write_mtab_entry(const dav_args *args)
{
+#ifdef __linux__
struct mntent mntent;
mntent.mnt_opts = NULL;
char *utab_line = NULL;
@@ -1234,8 +1287,8 @@
int privileged = (getuid() == 0);
struct passwd *pw = getpwuid(getuid());
if (!pw && !privileged) {
- error(0, errno, _("Warning: can't read user data base. Mounting "
- "anyway, but there is no entry in mtab."));
+ WARN(_("Warning: can't read user data base. Mounting "
+ "anyway, but there is no entry in mtab."));
return;
}
char *uid_name = pw->pw_name;
@@ -1286,16 +1339,16 @@
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"));
int ld = open(lock_file, O_RDONLY | O_CREAT,
S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH);
if (!ld)
- error(EXIT_FAILURE, errno, _("can't create file %s"), lock_file);
+ ERR(_("can't create file %s"), lock_file);
while (flock(ld, LOCK_EX) != 0) {
if (errno == EAGAIN || errno == EINTR)
continue;
- error(EXIT_FAILURE, errno, _("can't lock file %s"), lock_file);
+ ERR(_("can't lock file %s"), lock_file);
}
FILE *tab = NULL;
@@ -1317,13 +1370,13 @@
}
}
if (!tab || err)
- error(0, 0, _("Warning: can't write entry into %s, but will mount "
- "the file system anyway"), tab_file);
+ WARN(_("Warning: can't write entry into %s, but will mount "
+ "the file system anyway"), tab_file);
close(ld);
remove(lock_file);
if (seteuid(orig) != 0)
- error(EXIT_FAILURE, errno, _("can't change effective user id"));
+ ERR(_("can't change effective user id"));
sigprocmask(SIG_SETMASK, &oldset, NULL);
if (lock_file)
@@ -1334,6 +1387,7 @@
free(utab_line);
if (mntent.mnt_opts)
free(mntent.mnt_opts);
+#endif
}
@@ -1355,14 +1409,14 @@
int n = strtol(arg, &tail, base);
if (n < 0 || !tail) {
if (base == 10) {
- error(EXIT_FAILURE, 0, _("option %s has invalid argument;"
- "it must be a decimal number"), opt);
+ ERR(_("option %s has invalid argument;"
+ "it must be a decimal number"), opt);
} else if (base == 8) {
- error(EXIT_FAILURE, 0, _("option %s has invalid argument;"
- "it must be an octal number"), opt);
+ ERR(_("option %s has invalid argument;"
+ "it must be an octal number"), opt);
} else {
- error(EXIT_FAILURE, 0, _("option %s has invalid argument;"
- "it must be a number"), opt);
+ ERR(_("option %s has invalid argument;"
+ "it must be a number"), opt);
}
}
@@ -1376,18 +1430,18 @@
{
FILE *in = fopen(src, "r");
if (!in)
- error(EXIT_FAILURE, errno, _("can't open file %s"), src);
+ ERR(_("can't open file %s"), src);
FILE *out = fopen(dest, "w");
if (!out)
- error(EXIT_FAILURE, errno, _("can't open file %s"), dest);
+ ERR(_("can't open file %s"), dest);
size_t n = 0;
char *line = NULL;
int length = getline(&line, &n, in);
while (length > 0) {
- if (fputs(line, out) == EOF)
- error(EXIT_FAILURE, errno, _("error writing to file %s"), dest);
+ if (fputs(line, out) == EOF)
+ ERR(_("error writing to file %s"), dest);
length = getline(&line, &n, in);
}
@@ -1519,6 +1573,9 @@
static void
get_options(dav_args *args, char *option)
{
+#ifdef NODEV
+#undef NODEV
+#endif
enum {
CONF = 0,
USERNAME,
@@ -1576,8 +1633,7 @@
while (*option != 0) {
so = getsubopt(&option, suboptions, &argument);
if ((!argument) && (so < USER))
- error(EXIT_FAILURE, 0,
- _("option %s requires argument"), suboptions[so]);
+ ERR(_("option %s requires argument"), suboptions[so]);
switch (so) {
case CONF:
if (args->conf)
@@ -1672,9 +1728,9 @@
if (getuid() != 0) {
struct passwd *pw = getpwuid(getuid());
if (!pw)
- error(EXIT_FAILURE, errno, _("can't read user data base"));
+ ERR(_("can't read user data base"));
if (!pw->pw_dir)
- error(EXIT_FAILURE, 0, _("can't read user data base"));
+ ERR(_("can't read user data base"));
user_dir = ne_concat(pw->pw_dir, "/.", PACKAGE, NULL);
}
@@ -2106,10 +2162,9 @@
if (count == 1) {
if (*parmv[0] != '[' || *(parmv[0] + strlen(parmv[0]) - 1) != ']')
- error_at_line(EXIT_FAILURE, 0, filename, lineno,
- _("malformed line"));
+ ERR_AT_LINE(filename, lineno, _("malformed line"));
*(parmv[0] + strlen(parmv[0]) - 1) = '\0';
- char *mp = canonicalize_file_name(parmv[0] + 1);
+ char *mp = mcanonicalize_file_name(parmv[0] + 1);
if (mp) {
applies = (strcmp(mp, mpoint) == 0);
free(mp);
@@ -2120,11 +2175,11 @@
if (system && strcmp(parmv[0], "dav_user") == 0) {
if (args->dav_user)
free(args->dav_user);
- args->dav_user = ne_strdup(parmv[1]);
+ args->dav_user = ne_strdup(parmv[1]);
} else if (system && strcmp(parmv[0], "dav_group") == 0) {
if (args->dav_group)
free(args->dav_group);
- args->dav_group = ne_strdup(parmv[1]);
+ args->dav_group = ne_strdup(parmv[1]);
} else if (strcmp(parmv[0], "buf_size") == 0) {
args->buf_size = arg_to_int(parmv[1], 10, parmv[0]);
} else if (strcmp(parmv[0], "trust_ca_cert") == 0
@@ -2139,7 +2194,7 @@
} else if (!system && strcmp(parmv[0], "secrets") == 0) {
if (args->secrets)
free(args->secrets);
- args->secrets = ne_strdup(parmv[1]);
+ args->secrets = ne_strdup(parmv[1]);
} else if (strcmp(parmv[0], "clientcert") == 0) {
if (args->clicert)
free(args->clicert);
@@ -2147,8 +2202,7 @@
} else if (system && strcmp(parmv[0], "proxy") == 0) {
if (split_uri(NULL, &args->p_host, &args->p_port, NULL,
parmv[1]) != 0)
- error_at_line(EXIT_FAILURE, 0, filename, lineno,
- _("malformed line"));
+ ERR_AT_LINE(filename, lineno, _("malformed line"));
} else if (system && strcmp(parmv[0], "use_proxy") == 0) {
args->useproxy = arg_to_int(parmv[1], 10, parmv[0]);
} else if (strcmp(parmv[0], "ask_auth") == 0) {
@@ -2185,7 +2239,7 @@
#if NE_VERSION_MAJOR > 0 || NE_VERSION_MINOR > 30
args->sharepoint_href_bug = arg_to_int(parmv[1], 10, parmv[0]);
#else
- error(EXIT_FAILURE, 0, _("Option sharepoint_href_bug requires "
+ ERR(_("Option sharepoint_href_bug requires "
"Neon version 0.31 or newer"));
#endif
} else if (strcmp(parmv[0], "connect_timeout") == 0) {
@@ -2193,7 +2247,7 @@
} else if (strcmp(parmv[0], "read_timeout") == 0) {
args->read_timeout = arg_to_int(parmv[1], 10, parmv[0]);
} else if (strcmp(parmv[0], "retry") == 0) {
- args->retry = arg_to_int(parmv[1], 10, parmv[0]);
+ args->retry = arg_to_int(parmv[1], 10, parmv[0]);
} else if (strcmp(parmv[0], "max_retry") == 0) {
args->max_retry = arg_to_int(parmv[1], 10, parmv[0]);
} else if (strcmp(parmv[0], "max_upload_attempts") == 0) {
@@ -2205,35 +2259,34 @@
} else if (system && strcmp(parmv[0], "cache_dir") == 0) {
if (args->sys_cache)
free(args->sys_cache);
- args->sys_cache = ne_strdup(parmv[1]);
+ args->sys_cache = ne_strdup(parmv[1]);
} else if (!system && strcmp(parmv[0], "cache_dir") == 0) {
if (args->cache_dir != NULL)
free(args->cache_dir);
- args->cache_dir = ne_strdup(parmv[1]);
+ args->cache_dir = ne_strdup(parmv[1]);
} else if (strcmp(parmv[0], "backup_dir") == 0) {
if (args->backup_dir)
free(args->backup_dir);
- args->backup_dir = ne_strdup(parmv[1]);
+ args->backup_dir = ne_strdup(parmv[1]);
} else if (strcmp(parmv[0], "cache_size") == 0) {
- args->cache_size = arg_to_int(parmv[1], 10, parmv[0]);
+ args->cache_size = arg_to_int(parmv[1], 10, parmv[0]);
} else if (strcmp(parmv[0], "table_size") == 0) {
- args->table_size = arg_to_int(parmv[1], 10, parmv[0]);
+ args->table_size = arg_to_int(parmv[1], 10, parmv[0]);
} else if (strcmp(parmv[0], "dir_refresh") == 0) {
- args->dir_refresh = arg_to_int(parmv[1], 10, parmv[0]);
+ args->dir_refresh = arg_to_int(parmv[1], 10, parmv[0]);
} else if (strcmp(parmv[0], "file_refresh") == 0) {
- args->file_refresh = arg_to_int(parmv[1], 10, parmv[0]);
+ args->file_refresh = arg_to_int(parmv[1], 10, parmv[0]);
} else if (strcmp(parmv[0], "delay_upload") == 0) {
- args->delay_upload = arg_to_int(parmv[1], 10, parmv[0]);
+ args->delay_upload = arg_to_int(parmv[1], 10, parmv[0]);
} else if (strcmp(parmv[0], "gui_optimize") == 0) {
- args->gui_optimize = arg_to_int(parmv[1], 10, parmv[0]);
+ args->gui_optimize = arg_to_int(parmv[1], 10, parmv[0]);
} else if (strcmp(parmv[0], "minimize_mem") == 0) {
- args->minimize_mem = arg_to_int(parmv[1], 10, parmv[0]);
+ args->minimize_mem = arg_to_int(parmv[1], 10, parmv[0]);
} else if (strcmp(parmv[0], "debug") == 0) {
args->debug |= debug_opts(parmv[1]);
args->neon_debug |= debug_opts_neon(parmv[1]);
} else {
- error_at_line(EXIT_FAILURE, 0, filename, lineno,
- _("unknown option"));
+ ERR_AT_LINE(filename, lineno, _("unknown option"));
}
} else if (applies && count == 3) {
@@ -2245,14 +2298,12 @@
if (tmp)
free(tmp);
} else {
- error_at_line(EXIT_FAILURE, 0, filename, lineno,
- _("unknown option"));
+ ERR_AT_LINE(filename, lineno, _("unknown option"));
}
} else if (count < 0 || count > 3) {
- error_at_line(EXIT_FAILURE, 0, filename, lineno,
- _("malformed line"));
+ ERR_AT_LINE(filename, lineno, _("malformed line"));
}
length = getline(&line, &n, file);
@@ -2265,7 +2316,7 @@
}
/* Reads environment variable no_proxy. no_proxy must be a comma separated
- list of domain names. If no_proxy is "*" or args->p_host matches any of
+ list of domain names. If no_proxy is "*" or args->p_host matches any of
the entries in the no_proxy-list, args->p_host is removed. */
static void
read_no_proxy_list(dav_args *args)
@@ -2305,7 +2356,7 @@
if (strcasecmp(host, np) == 0) {
free(args->p_host);
args->p_host = NULL;
- }
+ }
}
free(host);
@@ -2327,10 +2378,10 @@
return;
}
if (st.st_uid != geteuid())
- error(EXIT_FAILURE, 0, _("file %s has wrong owner"), filename);
+ ERR(_("file %s has wrong owner"), filename);
if ((st.st_mode &
(S_IXUSR | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID | S_ISVTX)) != 0)
- error(EXIT_FAILURE, 0, _("file %s has wrong permissions"), filename);
+ ERR(_("file %s has wrong permissions"), filename);
FILE *file = fopen(filename, "r");
if (!file) {
@@ -2350,8 +2401,7 @@
int count;
count = parse_line(line, parmc, parmv);
if (count != 0 && count != 3 && count != 2)
- error_at_line(EXIT_FAILURE, 0, filename, lineno,
- _("malformed line"));
+ ERR_AT_LINE(filename, lineno, _("malformed line"));
if (count == 2 || count == 3) {
@@ -2364,7 +2414,7 @@
if (scheme && !port)
port = ne_uri_defaultport(scheme);
- char *mp = canonicalize_file_name(parmv[0]);
+ char *mp = mcanonicalize_file_name(parmv[0]);
char *ccert = NULL;
if (args->clicert) {
@@ -2417,8 +2467,7 @@
|| strcmp(parmv[0], ccert) == 0)) {
if (count != 2)
- error_at_line(EXIT_FAILURE, 0, filename, lineno,
- _("malformed line"));
+ ERR_AT_LINE(filename, lineno, _("malformed line"));
if (args->clicert_pw) {
memset(args->clicert_pw, '\0', strlen(args->clicert_pw));
free(args->clicert_pw);
|
[-]
[+]
|
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"));
if (failures & ~NE_SSL_FAILMASK)
- error(0, 0, _("unknown certificate error"));
+ WARN(_("unknown certificate error"));
printf(_(" issuer: %s"), issuer);
printf("\n");
printf(_(" subject: %s"), subject);
@@ -2048,7 +2044,7 @@
if (rpmatch(s) > 0)
ret = 0;
free(s);
- }
+ }
if (failures & NE_SSL_NOTYETVALID)
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR),
|
[-]
[+]
|
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/*'
|