diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-11-06 12:35:31 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:05:35 -0500 |
commit | f45846084249540f3dee24fe92cfaab2974461cc (patch) | |
tree | a30269de46649d5975524c45bce4a2aa759f24c9 /source4/ntvfs/posix/pvfs_open.c | |
parent | 481bba9e7f6ebfef11c7c7d778a1b465886abfa9 (diff) | |
download | samba-f45846084249540f3dee24fe92cfaab2974461cc.tar.gz samba-f45846084249540f3dee24fe92cfaab2974461cc.tar.bz2 samba-f45846084249540f3dee24fe92cfaab2974461cc.zip |
r3580: - on file overwrite in ntcreatex we need to replace the file permissions.
- pvfs now passes BASE-OPENATTR
- pvfs also passes the BASE-DEFER_OPEN test, but it is not a well
formed test for regular running so I am removing it from the list of
tests to run in test_posix.sh (the test is covered better by RAW-MUX
anyway)
(This used to be commit cb76bd218ed4194ea151264d495aa902ddf03b3c)
Diffstat (limited to 'source4/ntvfs/posix/pvfs_open.c')
-rw-r--r-- | source4/ntvfs/posix/pvfs_open.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c index f0c1478e66..f30d53d51a 100644 --- a/source4/ntvfs/posix/pvfs_open.c +++ b/source4/ntvfs/posix/pvfs_open.c @@ -787,6 +787,22 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs, return status; } + if (io->generic.in.open_disposition == NTCREATEX_DISP_OVERWRITE || + io->generic.in.open_disposition == NTCREATEX_DISP_OVERWRITE_IF) { + /* for overwrite we need to replace file permissions */ + uint32_t attrib = io->ntcreatex.in.file_attr | FILE_ATTRIBUTE_ARCHIVE; + mode_t mode = pvfs_fileperms(pvfs, attrib); + if (fchmod(fd, mode) == -1) { + return map_nt_error_from_unix(errno); + } + name->dos.attrib = attrib; + status = pvfs_dosattrib_save(pvfs, name, fd); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + } + + io->generic.out.oplock_level = NO_OPLOCK; io->generic.out.fnum = f->fnum; io->generic.out.create_action = NTCREATEX_ACTION_EXISTED; |