Windows: Enforce Share Access
authorJeffrey Altman <jaltman@your-file-system.com>
Wed, 5 Oct 2011 07:36:48 +0000 (03:36 -0400)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Fri, 11 Nov 2011 18:00:41 +0000 (10:00 -0800)
commitb78b8f64a69481e59e957ebe09315fc5b8b60c17
tree20d87965fdef7c8a5d20dd838a47576b05c4bde7
parentc6a22d67ff9787ace2249d528eb9db99c5b19427
Windows: Enforce Share Access

Use file server locks to enforce file share access modes
via the afs redirector interface.  The approach taken
integrates share mode enforcement with the file server
lock tracking code in the service.  The share mode
enforcement mimics that of the SMB Server interface.

This patchset includes two functional changes to
the previous locking and share mode processing:

 1. The cm_scache_t fsLockCount field is used to
    determine if the desired lock can be granted
    by the file server.  If not, the RXAFS_SetLock()
    request is skipped and the request is failed
    locally.

 2. cm_CheckNTOpen() now accepts the desired and
    and share access modes.  The share access mode
    is used to determine if a test lock should be
    obtained at all.  If the share mode is FILE_SHARE_WRITE
    then no lock is requested.  This change permits
    Microsoft Office applications to offer the user
    the ability to open the file in read-only mode
    and notify the user when the document can be
    opened in read-write mode.

Developed with Peter Scott <pscott@kerneldrivers.com>

FIXES 130239

Change-Id: If9b4beb74586296d4feae52dd06c03f0b8b595cd
Reviewed-on: http://gerrit.openafs.org/5823
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
12 files changed:
src/WINNT/afsd/cm_scache.h
src/WINNT/afsd/cm_vnodeops.c
src/WINNT/afsd/cm_vnodeops.h
src/WINNT/afsd/smb3.c
src/WINNT/afsrdr/common/AFSUserDefines.h
src/WINNT/afsrdr/common/AFSUserStructs.h
src/WINNT/afsrdr/kernel/lib/AFSCleanup.cpp
src/WINNT/afsrdr/kernel/lib/AFSCreate.cpp
src/WINNT/afsrdr/kernel/lib/Include/AFSStructs.h
src/WINNT/afsrdr/user/RDRFunction.c
src/WINNT/afsrdr/user/RDRInit.cpp
src/WINNT/afsrdr/user/RDRPrototypes.h