From f7668a25779630c644ed29cd2aaf5800c0720518 Mon Sep 17 00:00:00 2001 From: jpandre Date: Wed, 7 Nov 2007 09:23:46 +0000 Subject: [PATCH] Deny truncate of files in protected directory --- src/ntfs-3g.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ntfs-3g.c b/src/ntfs-3g.c index b17868bf..e2685dea 100644 --- a/src/ntfs-3g.c +++ b/src/ntfs-3g.c @@ -780,9 +780,10 @@ static int ntfs_fuse_truncate(const char *org_path, off_t size) if (!na) goto exit; - /* JPA deny truncation if cannot write */ + /* JPA deny truncation if cannot write to file or parent directory */ if (ntfs_fuse_fill_security_context(&security) - && !ntfs_allowed_access(&security,org_path,ni,S_IWRITE)) { + && (!ntfs_allowed_dir_access(&security, path, S_IWRITE + S_IEXEC) + || !ntfs_allowed_access(&security, path, ni, S_IWRITE))) { errno = EACCES; ntfs_attr_close(na); goto exit;