Remove file_umask and dir_umask (bug #34563)

This commit is contained in:
wbaumann 2013-08-12 16:49:16 +00:00
parent c92d1520a3
commit ebfd3e6f8e
4 changed files with 24 additions and 31 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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),

View File

@ -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 */