summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorhelg <helg@cvs.openbsd.org>2017-11-27 13:15:57 +0000
committerhelg <helg@cvs.openbsd.org>2017-11-27 13:15:57 +0000
commitf473546871fb44a64daa66a9e6d90123d77dad3d (patch)
treedb482f8ca16636896b4e5974936f79b88d4f6e4b /sys
parent5216d24d03aeb2ddc7aa3a3546446db33f6a98c3 (diff)
Check access before creating a file or directory.
input and ok mpi@
Diffstat (limited to 'sys')
-rw-r--r--sys/miscfs/fuse/fuse_lookup.c11
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;