Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libperfuse - Proper permission checks when doing directo...
details: https://anonhg.NetBSD.org/src/rev/0515770f6bb5
branches: trunk
changeset: 765075:0515770f6bb5
user: manu <manu%NetBSD.org@localhost>
date: Wed May 18 15:28:12 2011 +0000
description:
- Proper permission checks when doing directory traversal. e.g.: run
rm dir/file while dir was never looked up since the mount. In that
situation, we get lookup with pcn_nameiop NAMEI_DELETE for dir before
we get it for file. But for dir we are just looking for PUFFS_VEXEC.
This is solved by honouring NAMEI_ISLASTCN, which is set for the last
element only
- do not send O_EXCL to FUSE as documentation forbids it.
- fix warning
diffstat:
lib/libperfuse/ops.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diffs (48 lines):
diff -r a1c8d30c7d1e -r 0515770f6bb5 lib/libperfuse/ops.c
--- a/lib/libperfuse/ops.c Wed May 18 15:25:19 2011 +0000
+++ b/lib/libperfuse/ops.c Wed May 18 15:28:12 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ops.c,v 1.26 2011/05/11 14:52:48 jakllsch Exp $ */
+/* $NetBSD: ops.c,v 1.27 2011/05/18 15:28:12 manu Exp $ */
/*-
* Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -262,7 +262,7 @@
vap->va_nlink = fa->nlink;
vap->va_uid = fa->uid;
vap->va_gid = fa->gid;
- vap->va_fsid = ps->ps_fsid;
+ vap->va_fsid = (long)ps->ps_fsid;
vap->va_fileid = fa->ino;
vap->va_size = fa->size;
vap->va_blocksize = fa->blksize;
@@ -996,7 +996,10 @@
case NAMEI_DELETE: /* FALLTHROUGH */
case NAMEI_RENAME: /* FALLTHROUGH */
case NAMEI_CREATE:
- mode = PUFFS_VEXEC|PUFFS_VWRITE;
+ if (pcn->pcn_flags & NAMEI_ISLASTCN)
+ mode = PUFFS_VEXEC|PUFFS_VWRITE;
+ else
+ mode = PUFFS_VEXEC;
break;
case NAMEI_LOOKUP: /* FALLTHROUGH */
default:
@@ -1271,7 +1274,7 @@
/*
* libfuse docs says
- * - O_CREAT should never be set.
+ * - O_CREAT and O_EXCL should never be set.
* - O_TRUNC may be used if mount option atomic_o_trunc is used XXX
*
* O_APPEND makes no sense since FUSE always sends
@@ -1279,7 +1282,7 @@
* filesystem uses pwrite(), O_APPEND would cause
* the offset to be ignored and cause file corruption.
*/
- mode &= ~(O_CREAT|O_APPEND);
+ mode &= ~(O_CREAT|O_EXCL|O_APPEND);
/*
* Do not open twice, and do not reopen for reading
Home |
Main Index |
Thread Index |
Old Index