diff options
author | 2017-11-27 13:15:56 +0000 | |
---|---|---|
committer | 2017-11-27 13:15:56 +0000 | |
commit | ed6e40b2c86c6c6a27750053b612d9e2bea5878c (patch) | |
tree | 6bf70f2632b3f802254f0a8121d1f17d82dd2e39 | |
parent | Simplify lease_as_string() logic to use a single time_t variable (diff) | |
download | wireguard-openbsd-ed6e40b2c86c6c6a27750053b612d9e2bea5878c.tar.xz wireguard-openbsd-ed6e40b2c86c6c6a27750053b612d9e2bea5878c.zip |
Check access before creating a file or directory.
input and ok mpi@
-rw-r--r-- | sys/miscfs/fuse/fuse_lookup.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/miscfs/fuse/fuse_lookup.c b/sys/miscfs/fuse/fuse_lookup.c index c83c99b97b6..5ccc9fe8121 100644 --- a/sys/miscfs/fuse/fuse_lookup.c +++ b/sys/miscfs/fuse/fuse_lookup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse_lookup.c,v 1.16 2016/09/07 17:53:35 natano Exp $ */ +/* $OpenBSD: fuse_lookup.c,v 1.17 2017/11/27 13:15:56 helg Exp $ */ /* * Copyright (c) 2012-2013 Sylvestre Gallon <ccna.syl@gmail.com> * @@ -90,8 +90,13 @@ fusefs_lookup(void *v) if ((nameiop == CREATE || nameiop == RENAME) && (flags & ISLASTCN)) { - if (vdp->v_mount->mnt_flag & MNT_RDONLY) - return (EROFS); + /* + * Access for write is interpreted as allowing + * creation of files in the directory. + */ + if ((error = VOP_ACCESS(vdp, VWRITE, cred, + cnp->cn_proc)) != 0) + return (error); cnp->cn_flags |= SAVENAME; |