summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbp <bp@FreeBSD.org>2002-09-18 09:54:16 +0000
committerbp <bp@FreeBSD.org>2002-09-18 09:54:16 +0000
commitb1b1af8b9561abfe16c28282e74d1d49f368a822 (patch)
tree315f249a3c329e16eb7abee92a9189fbd863a8b5
parent8a4580c1d43dddb2cb8b64d62da93c3daf78711d (diff)
downloadFreeBSD-src-b1b1af8b9561abfe16c28282e74d1d49f368a822.zip
FreeBSD-src-b1b1af8b9561abfe16c28282e74d1d49f368a822.tar.gz
Always open file in the DENYNONE mode and let the server to decide what is
good for this file. This should allow read only access to file which is already opened on server.
-rw-r--r--sys/fs/smbfs/smbfs_vnops.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/sys/fs/smbfs/smbfs_vnops.c b/sys/fs/smbfs/smbfs_vnops.c
index 491b098..361215e 100644
--- a/sys/fs/smbfs/smbfs_vnops.c
+++ b/sys/fs/smbfs/smbfs_vnops.c
@@ -216,16 +216,24 @@ smbfs_open(ap)
np->n_opencount++;
return 0;
}
- accmode = SMB_AM_OPENREAD;
+ /*
+ * Use DENYNONE to give unixy semantics of permitting
+ * everything not forbidden by permissions. Ie denial
+ * is up to server with clients/openers needing to use
+ * advisory locks for further control.
+ */
+ accmode = SMB_SM_DENYNONE|SMB_AM_OPENREAD;
if ((vp->v_mount->mnt_flag & MNT_RDONLY) == 0)
- accmode = SMB_AM_OPENRW;
+ accmode = SMB_SM_DENYNONE|SMB_AM_OPENRW;
smb_makescred(&scred, ap->a_td, ap->a_cred);
error = smbfs_smb_open(np, accmode, &scred);
if (error) {
if (mode & FWRITE)
return EACCES;
- accmode = SMB_AM_OPENREAD;
- error = smbfs_smb_open(np, accmode, &scred);
+ else if ((vp->v_mount->mnt_flag & MNT_RDONLY) == 0) {
+ accmode = SMB_SM_DENYNONE|SMB_AM_OPENREAD;
+ error = smbfs_smb_open(np, accmode, &scred);
+ }
}
if (!error) {
np->n_opencount++;
@@ -390,7 +398,9 @@ smbfs_setattr(ap)
tsize = np->n_size;
np->n_size = vap->va_size;
if (np->n_opencount == 0) {
- error = smbfs_smb_open(np, SMB_AM_OPENRW, &scred);
+ error = smbfs_smb_open(np,
+ SMB_SM_DENYNONE|SMB_AM_OPENRW,
+ &scred);
if (error == 0)
doclose = 1;
}
OpenPOWER on IntegriCloud