From 0a42f0c625ff5177c1c2734e9a78e85edc02ef22 Mon Sep 17 00:00:00 2001 From: wbaumann Date: Mon, 12 Aug 2013 17:40:36 +0000 Subject: [PATCH] Make default access modes 755 and 644 --- ChangeLog | 4 ++++ src/cache.c | 4 ++-- src/mount_davfs.c | 34 ---------------------------------- 3 files changed, 6 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index c65453d..e08c0bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,10 @@ ChangeLog for davfs2 -------------------- +2013-08-12 Werner Baumann (werner.baumann@onlinehome.de) + * cache.c, mount_davfs.c; + Make default access modes 755 and 644. + 2013-08-12 Werner Baumann (werner.baumann@onlinehome.de) * cache.c, mount_davfs.c, mount_davfs.h: Remove file_umask and dir_umask (bug #34563). diff --git a/src/cache.c b/src/cache.c index 498cd7f..3c716f8 100644 --- a/src/cache.c +++ b/src/cache.c @@ -587,8 +587,8 @@ dav_init_cache(const dav_args *args, const char *mpoint) default_uid = args->fsuid; default_gid = args->fsgid; - default_file_mode = args->file_mode; - default_dir_mode = args->dir_mode; + default_file_mode = args->file_mode | S_IFREG; + default_dir_mode = args->dir_mode | S_IFDIR; table_size = args->table_size; table = xcalloc(table_size, sizeof(*table)); diff --git a/src/mount_davfs.c b/src/mount_davfs.c index a375196..cb907a1 100644 --- a/src/mount_davfs.c +++ b/src/mount_davfs.c @@ -182,9 +182,6 @@ debug_opts_neon(const char *s); static void delete_args(dav_args *args); -static void -eval_modes(dav_args *args); - static void expand_home(char **dir, const dav_args *args); @@ -939,8 +936,6 @@ parse_config(dav_args *args) args->dav_group); args->dav_gid = grp->gr_gid; - eval_modes(args); - if (args->trust_ca_cert) args->ca_cert = read_cert(&args->trust_ca_cert, args); @@ -1373,32 +1368,6 @@ delete_args(dav_args *args) } -/* Evaluates the umask and the default modes for directories and files from - args->mopts, umask(), args->dir_mode and args->file_mode and stores them - in args. - Requires: mopts, dir_mode, file_mode. */ -static void -eval_modes(dav_args *args) -{ - mode_t default_mode = umask(0); - umask(default_mode); - default_mode = ~default_mode; - default_mode &= S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; - - if (!args->dir_mode) { - args->dir_mode = default_mode; - args->dir_mode |= (args->dir_mode & S_IRUSR) ? S_IXUSR : 0; - args->dir_mode |= (args->dir_mode & S_IRGRP) ? S_IXGRP : 0; - args->dir_mode |= (args->dir_mode & S_IROTH) ? S_IXOTH : 0; - } - args->dir_mode |= S_IFDIR; - - if (!args->file_mode) - args->file_mode = default_mode; - args->file_mode |= S_IFREG; -} - - /* If *dir starts with '~/' or '~user/' it is turned into an absolute filename (starting with '/') in the user's home directory. user must be the name of the mounting user. @@ -1617,11 +1586,8 @@ new_args(void) args->mopts = DAV_MOPTS; args->buf_size = DAV_FUSE_BUF_SIZE; -/* TODO: activate after changing default mode and rmoving - umask. Remove eval_mode. args->dir_mode = DAV_DIR_MODE; args->file_mode = DAV_FILE_MODE; -*/ args->p_port = DAV_DEFAULT_PROXY_PORT; args->useproxy = DAV_USE_PROXY;