Windows: Only mask Delete permission for SMB reqs

For SMB requests the Delete permission is masked if the
readonly attribute is set on the file.  Do not apply this
heuristic to non-SMB requests.

Change-Id: I6617e935cb32796e4a95b4eac0bec9519bd3e937
Reviewed-on: http://gerrit.openafs.org/5342
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
This commit is contained in:
Jeffrey Altman 2011-07-18 16:16:42 -04:00 committed by Jeffrey Altman
parent 7dcc476637
commit 6aeab6595e
3 changed files with 5 additions and 4 deletions

View File

@ -33,7 +33,8 @@ int cm_accessPerFileCheck = 0;
* can't be locked. Thus, this must always be called in a while loop to stabilize
* things, since we can always lose the race condition getting to the parent vnode.
*/
int cm_HaveAccessRights(struct cm_scache *scp, struct cm_user *userp, afs_uint32 rights,
int cm_HaveAccessRights(struct cm_scache *scp, struct cm_user *userp, cm_req_t *reqp,
afs_uint32 rights,
afs_uint32 *outRightsp)
{
cm_scache_t *aclScp;
@ -106,7 +107,7 @@ int cm_HaveAccessRights(struct cm_scache *scp, struct cm_user *userp, afs_uint32
scp, scp->unixModeBits);
*outRightsp &= ~PRSFS_WRITE;
}
if ((scp->unixModeBits & 0200) == 0 && !cm_deleteReadOnly) {
if ((scp->unixModeBits & 0200) == 0 && !cm_deleteReadOnly && (reqp->flags & CM_REQ_SOURCE_SMB)) {
osi_Log2(afsd_logp,"cm_HaveAccessRights UnixMode removing DELETE scp 0x%p unix 0%o",
scp, scp->unixModeBits);
*outRightsp &= ~PRSFS_DELETE;

View File

@ -13,7 +13,7 @@
#include "cm_user.h"
extern int cm_HaveAccessRights(struct cm_scache *scp, struct cm_user *up,
afs_uint32 rights, afs_uint32 *outRights);
struct cm_req *reqp, afs_uint32 rights, afs_uint32 *outRights);
extern long cm_GetAccessRights(struct cm_scache *scp, struct cm_user *up,
struct cm_req *reqp);

View File

@ -1293,7 +1293,7 @@ long cm_SyncOp(cm_scache_t *scp, cm_buf_t *bufp, cm_user_t *userp, cm_req_t *req
if ((rights & (PRSFS_WRITE|PRSFS_DELETE)) && (scp->flags & CM_SCACHEFLAG_RO))
return CM_ERROR_READONLY;
if (cm_HaveAccessRights(scp, userp, rights, &outRights)) {
if (cm_HaveAccessRights(scp, userp, reqp, rights, &outRights)) {
if (~outRights & rights)
return CM_ERROR_NOACCESS;
}