From ebfd3e6f8e3dcbb3dd72fe83cd6fcd71e065a14c Mon Sep 17 00:00:00 2001 From: wbaumann Date: Mon, 12 Aug 2013 16:49:16 +0000 Subject: [PATCH] Remove file_umask and dir_umask (bug #34563) --- ChangeLog | 23 +++++++++++++++++++++++ src/cache.c | 12 ------------ src/mount_davfs.c | 18 +----------------- src/mount_davfs.h | 2 -- 4 files changed, 24 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index e1d5892..c65453d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,29 @@ ChangeLog for davfs2 -------------------- +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). + +2013-08-12 Werner Baumann (werner.baumann@onlinehome.de) + * defaults.h, mount_davfs.c, mount_davfs.h: + Beautify defaults. + +2013-08-10 Werner Baumann (werner.baumann@onlinehome.de) + * kernel_interface.c: + Assign buf_size before using it. + +2013-08-09 Werner Baumann (werner.baumann@onlinehome.de) + * cache.c, cache.h, kernel_interface.c, kernel_interface.h + webdav.c, webdav.h: + Remove support for extended attributes. + +2013-08-09 Werner Baumann (werner.baumann@onlinehome.de) + * src/Makefile.am, cache.c, cache.h, coda.c, dav_coda.h, + dav_fuse.ckernel_interface.c, kernel_interface.h, + mount_davfs.c, mount_davfs.h, po/, man/: + Remove support for Coda + 2012-11-01 Werner Baumann (werner.baumann@onlinehome.de) * man/Makefile.am, man/de/Makefile.am, man/es/Makefile.am: Honour configure parameter --manfile (sr #108173) diff --git a/src/cache.c b/src/cache.c index 9f8e041..498cd7f 100644 --- a/src/cache.c +++ b/src/cache.c @@ -192,8 +192,6 @@ static uid_t default_uid; static gid_t default_gid; static mode_t default_file_mode; static mode_t default_dir_mode; -static mode_t file_umask; -static mode_t dir_umask; /* Directory for cached files and directories. */ static char *cache_dir; @@ -591,8 +589,6 @@ dav_init_cache(const dav_args *args, const char *mpoint) default_file_mode = args->file_mode; default_dir_mode = args->dir_mode; - file_umask = args->file_umask; - dir_umask = args->dir_umask; table_size = args->table_size; table = xcalloc(table_size, sizeof(*table)); @@ -1373,10 +1369,6 @@ dav_setattr(dav_node *node, uid_t uid, int sm, mode_t mode, int so, return EINVAL; if (uid != node->uid && uid != 0) return EPERM; - if (is_dir(node) && (mode & dir_umask)) - return EINVAL; - if (is_reg(node) && (mode & file_umask)) - return EINVAL; } if (sat || smt) { @@ -1564,7 +1556,6 @@ add_node(dav_node *parent, dav_props *props) } else if (props->is_exec == 0) { node->mode &= ~(S_IXUSR | S_IXGRP | S_IXOTH); } - node->mode &= ~file_umask; } parent->mtime = node->mtime; @@ -1965,10 +1956,8 @@ new_node(dav_node *parent, mode_t mode) node->lock_expire = 0; if (S_ISDIR(mode)) { - node->mode = mode & ~dir_umask; node->nref = 2; } else { - node->mode = mode & ~file_umask; node->nref = 1; } node->remote_exists = 0; @@ -2261,7 +2250,6 @@ update_node(dav_node *node, dav_props *props) node->mode |= (node->mode & S_IWUSR) ? S_IXUSR : 0; node->mode |= (node->mode & S_IWGRP) ? S_IXGRP : 0; node->mode |= (node->mode & S_IWOTH) ? S_IXOTH : 0; - node->mode &= ~file_umask; } else if (props->is_exec == 0 && (node->mode & (S_IXUSR | S_IXGRP | S_IXOTH))) { node->mode &= ~(S_IXUSR | S_IXGRP | S_IXOTH); diff --git a/src/mount_davfs.c b/src/mount_davfs.c index d430be2..a375196 100644 --- a/src/mount_davfs.c +++ b/src/mount_davfs.c @@ -1376,20 +1376,10 @@ 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 - Provides: dir_umask, file_umask, dir_mode, file_mode. */ + Requires: mopts, dir_mode, file_mode. */ static void eval_modes(dav_args *args) { - if (args->mopts & MS_NOSUID) - args->dir_umask = S_ISUID | S_ISGID; - if (args->mopts & MS_RDONLY) - args->dir_umask |= S_IWUSR | S_IWGRP | S_IWOTH; - - args->file_umask = args->dir_umask; - if (args->mopts & MS_NOEXEC) - args->file_umask |= S_IXUSR | S_IXGRP | S_IXOTH; - mode_t default_mode = umask(0); umask(default_mode); default_mode = ~default_mode; @@ -1401,12 +1391,10 @@ eval_modes(dav_args *args) 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 &= ~args->dir_umask; args->dir_mode |= S_IFDIR; if (!args->file_mode) args->file_mode = default_mode; - args->file_mode &= ~args->file_umask; args->file_mode |= S_IFREG; } @@ -1695,10 +1683,6 @@ log_dbg_config(dav_args *args) " fsuid: %i", args->fsuid); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " fsgid: %i", args->fsgid); - syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), - " dir_umask: %#o", args->dir_umask); - syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), - " file_umask: %#o", args->file_umask); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " dir_mode: %#o", args->dir_mode); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), diff --git a/src/mount_davfs.h b/src/mount_davfs.h index 57dc592..e314349 100644 --- a/src/mount_davfs.h +++ b/src/mount_davfs.h @@ -56,8 +56,6 @@ typedef struct { /* File mode */ uid_t fsuid; /* Command line */ gid_t fsgid; /* Command line */ - mode_t dir_umask; - mode_t file_umask; mode_t dir_mode; /* Command line */ mode_t file_mode; /* Command line */ /* WebDAV */