diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-10-24 12:53:13 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:02:26 -0500 |
commit | 2a16fd5453a47bc456ae831c0eab58a102d96bd8 (patch) | |
tree | 4faac10389f35a6bb0ee132dffc95cede76298f3 | |
parent | d5817271384ff74b3d0577d675476c28ccc0074b (diff) | |
download | samba-2a16fd5453a47bc456ae831c0eab58a102d96bd8.tar.gz samba-2a16fd5453a47bc456ae831c0eab58a102d96bd8.tar.bz2 samba-2a16fd5453a47bc456ae831c0eab58a102d96bd8.zip |
r3154: pvfs now passes all of BASE-DELETE
(This used to be commit abbfca1401818edd896493ab9c875224e3b7e0e7)
-rw-r--r-- | source4/ntvfs/posix/pvfs_open.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c index 7c1e164575..95990f6332 100644 --- a/source4/ntvfs/posix/pvfs_open.c +++ b/source4/ntvfs/posix/pvfs_open.c @@ -266,6 +266,12 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs, uint32_t create_options = io->generic.in.create_options; uint32_t share_access = io->generic.in.share_access; uint32_t access_mask = io->generic.in.access_mask; + mode_t mode; + + if ((io->ntcreatex.in.file_attr & FILE_ATTRIBUTE_READONLY) && + (create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE)) { + return NT_STATUS_CANNOT_DELETE; + } flags = O_RDWR; @@ -279,8 +285,14 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs, return NT_STATUS_TOO_MANY_OPENED_FILES; } + if (io->ntcreatex.in.file_attr & FILE_ATTRIBUTE_READONLY) { + mode = 0444; + } else { + mode = 0644; + } + /* create the file */ - fd = open(name->full_name, flags | O_CREAT | O_EXCL, 0644); + fd = open(name->full_name, flags | O_CREAT | O_EXCL, mode); if (fd == -1) { idr_remove(pvfs->idtree_fnum, fnum); return pvfs_map_errno(pvfs, errno); @@ -407,7 +419,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs, /* certain create options are not allowed */ if ((create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE) && - !(share_access & NTCREATEX_SHARE_ACCESS_DELETE)) { + !(access_mask & STD_RIGHT_DELETE_ACCESS)) { return NT_STATUS_INVALID_PARAMETER; } @@ -475,6 +487,11 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs, /* fall through to a normal open */ } + if ((name->dos.attrib & FILE_ATTRIBUTE_READONLY) && + (create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE)) { + return NT_STATUS_CANNOT_DELETE; + } + f = talloc_p(req, struct pvfs_file); if (f == NULL) { return NT_STATUS_NO_MEMORY; @@ -655,6 +672,11 @@ NTSTATUS pvfs_change_create_options(struct pvfs_state *pvfs, return NT_STATUS_OK; } + if ((f->name->dos.attrib & FILE_ATTRIBUTE_READONLY) && + (create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE)) { + return NT_STATUS_CANNOT_DELETE; + } + lck = odb_lock(req, pvfs->odb_context, &f->locking_key); if (lck == NULL) { return NT_STATUS_INTERNAL_DB_CORRUPTION; |