summaryrefslogtreecommitdiff
path: root/source4/ntvfs/posix/pvfs_open.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-12-30 05:50:23 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:07:44 -0500
commite913a48ded85e7baf91a355fff46fe270afed936 (patch)
tree9133ded6ec35d1855798cc2bb13a6c78e0e07633 /source4/ntvfs/posix/pvfs_open.c
parent447a346f0dea0b6099f047b406b55b7304bf2d46 (diff)
downloadsamba-e913a48ded85e7baf91a355fff46fe270afed936.tar.gz
samba-e913a48ded85e7baf91a355fff46fe270afed936.tar.bz2
samba-e913a48ded85e7baf91a355fff46fe270afed936.zip
r4408: added the remaining access check hooks into pvfs. All calls should now have acl checking,
and obey the various inheritance rules. (This used to be commit 5fe51807d6b97e68b65f152c0f405e5c5a025d21)
Diffstat (limited to 'source4/ntvfs/posix/pvfs_open.c')
-rw-r--r--source4/ntvfs/posix/pvfs_open.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c
index 1695d8e1d9..3941414cd8 100644
--- a/source4/ntvfs/posix/pvfs_open.c
+++ b/source4/ntvfs/posix/pvfs_open.c
@@ -198,10 +198,12 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs,
if (name->exists) {
/* check the security descriptor */
status = pvfs_access_check(pvfs, req, name, &access_mask);
- if (!NT_STATUS_IS_OK(status)) {
- idr_remove(pvfs->idtree_fnum, fnum);
- return status;
- }
+ } else {
+ status = pvfs_access_check_create(pvfs, req, name);
+ }
+ if (!NT_STATUS_IS_OK(status)) {
+ idr_remove(pvfs->idtree_fnum, fnum);
+ return status;
}
f->fnum = fnum;
@@ -450,6 +452,11 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
mode_t mode;
uint32_t attrib;
+ status = pvfs_access_check_create(pvfs, req, name);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
if ((io->ntcreatex.in.file_attr & FILE_ATTRIBUTE_READONLY) &&
(create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE)) {
return NT_STATUS_CANNOT_DELETE;
@@ -1065,6 +1072,9 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
/* if this was a stream create then create the stream as well */
if (!name->stream_exists) {
+ if (!(access_mask & SEC_FILE_WRITE_ATTRIBUTE)) {
+ return NT_STATUS_ACCESS_DENIED;
+ }
status = pvfs_stream_create(pvfs, f->handle->name, fd);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(lck);