From 7337f3c6cd1f769ba2cbcc219cdb3d50a846c0e2 Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Thu, 4 Aug 2016 11:25:35 -0700 Subject: [PATCH] sys,dll: symbolic link (reparse point) support: WIP --- build/VStudio/winfsp_dll.vcxproj.filters | 4 +++- inc/winfsp/fsctl.h | 4 ++-- inc/winfsp/winfsp.h | 1 + src/dll/fs.c | 2 ++ src/dll/fsop.c | 4 ++-- src/dll/fuse/fuse.c | 2 +- src/sys/fsctl.c | 2 +- 7 files changed, 12 insertions(+), 7 deletions(-) diff --git a/build/VStudio/winfsp_dll.vcxproj.filters b/build/VStudio/winfsp_dll.vcxproj.filters index 221e6c92..ff6b31b3 100644 --- a/build/VStudio/winfsp_dll.vcxproj.filters +++ b/build/VStudio/winfsp_dll.vcxproj.filters @@ -118,6 +118,8 @@ - + + Source\fuse + \ No newline at end of file diff --git a/inc/winfsp/fsctl.h b/inc/winfsp/fsctl.h index 4260a409..efc1dcec 100644 --- a/inc/winfsp/fsctl.h +++ b/inc/winfsp/fsctl.h @@ -125,8 +125,8 @@ typedef struct UINT32 UnicodeOnDisk:1; /* file system supports Unicode in file names */ UINT32 PersistentAcls:1; /* file system preserves and enforces access control lists */ UINT32 ReparsePoints:1; /* file system supports reparse points */ - UINT32 ReparsePointPrivilegeCheck:1;/* file system perform reparse point privilege checks */ - UINT32 SymbolicLinksOnly:1; /* file system supports only symbolic link reparse points */ + UINT32 ReparsePointsPrivilegeCheck:1; /* file system performs reparse point privilege checks */ + UINT32 ReparsePointsSymbolicLinks:1; /* file system supports only symbolic link reparse points */ UINT32 NamedStreams:1; /* file system supports named streams (!!!: unimplemented) */ UINT32 HardLinks:1; /* unimplemented; set to 0 */ UINT32 ExtendedAttributes:1; /* unimplemented; set to 0 */ diff --git a/inc/winfsp/winfsp.h b/inc/winfsp/winfsp.h index 4050b2cd..27a4c15b 100644 --- a/inc/winfsp/winfsp.h +++ b/inc/winfsp/winfsp.h @@ -752,6 +752,7 @@ typedef struct _FSP_FILE_SYSTEM UINT32 DebugLog; FSP_FILE_SYSTEM_OPERATION_GUARD_STRATEGY OpGuardStrategy; SRWLOCK OpGuardLock; + UINT32 ReparsePointsSymbolicLinks:1; } FSP_FILE_SYSTEM; /** * Create a file system object. diff --git a/src/dll/fs.c b/src/dll/fs.c index 74f9c47e..fdf92194 100644 --- a/src/dll/fs.c +++ b/src/dll/fs.c @@ -106,6 +106,8 @@ FSP_API NTSTATUS FspFileSystemCreate(PWSTR DevicePath, FileSystem->EnterOperation = FspFileSystemOpEnter; FileSystem->LeaveOperation = FspFileSystemOpLeave; + FileSystem->ReparsePointsSymbolicLinks = VolumeParams->ReparsePointsSymbolicLinks; + *PFileSystem = FileSystem; return STATUS_SUCCESS; diff --git a/src/dll/fsop.c b/src/dll/fsop.c index 4901b0ca..820421bf 100644 --- a/src/dll/fsop.c +++ b/src/dll/fsop.c @@ -906,7 +906,7 @@ FSP_API NTSTATUS FspFileSystemOpFileSystemControl(FSP_FILE_SYSTEM *FileSystem, SymlinkReparseData = (PREPARSE_DATA_BUFFER)Response->Buffer; memset(SymlinkReparseData, 0, sizeof *SymlinkReparseData); - if (1/*!!!: SymbolicLinksOnly*/) + if (FileSystem->ReparsePointsSymbolicLinks) { Size = FSP_FSCTL_TRANSACT_RSP_SIZEMAX - FIELD_OFFSET(FSP_FSCTL_TRANSACT_RSP, Buffer) - sizeof(*SymlinkReparseData); @@ -968,7 +968,7 @@ FSP_API NTSTATUS FspFileSystemOpFileSystemControl(FSP_FILE_SYSTEM *FileSystem, SymlinkReparseData = (PREPARSE_DATA_BUFFER) (Request->Buffer + Request->Req.FileSystemControl.Buffer.Offset); - if (1/*!!!: SymbolicLinksOnly*/) + if (FileSystem->ReparsePointsSymbolicLinks) { Result = FileSystem->Interface->SetReparsePoint(FileSystem, Request, (PVOID)Request->Req.FileSystemControl.UserContext, diff --git a/src/dll/fuse/fuse.c b/src/dll/fuse/fuse.c index a120a949..715bf59a 100644 --- a/src/dll/fuse/fuse.c +++ b/src/dll/fuse/fuse.c @@ -449,7 +449,7 @@ static int fsp_fuse_core_opt_proc(void *opt_data0, const char *arg, int key, " -o VolumeSerialNumber=N 32-bit wide\n" " -o FileInfoTimeout=N FileInfo/Security/VolumeInfo timeout (millisec)\n" " -o CaseInsensitiveSearch file system supports case-insensitive file names\n" - //" -o ReparsePoints file system supports reparse points\n" + " -o ReparsePoints file system supports reparse points\n" //" -o NamedStreams file system supports named streams\n" //" -o ReadOnlyVolume file system is read only\n" " --UNC=U --VolumePrefix=U UNC prefix (\\Server\\Share)\n"); diff --git a/src/sys/fsctl.c b/src/sys/fsctl.c index 0b356650..0152c2fe 100644 --- a/src/sys/fsctl.c +++ b/src/sys/fsctl.c @@ -126,7 +126,7 @@ static NTSTATUS FspFsvolFileSystemControlReparsePoint( ReparseTag = ((PREPARSE_DATA_BUFFER)InputBuffer)->ReparseTag; /* NTFS severely limits symbolic links; we will not do that unless our file system asks */ - if (FsvolDeviceExtension->VolumeParams.ReparsePointPrivilegeCheck) + if (FsvolDeviceExtension->VolumeParams.ReparsePointsPrivilegeCheck) { if (IO_REPARSE_TAG_SYMLINK == ReparseTag && KernelMode != Irp->RequestorMode &&