summaryrefslogtreecommitdiff
path: root/source4/ntvfs/posix/pvfs_setfileinfo.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-11-07 10:05:35 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:05:37 -0500
commit2db915e06564b42bf7ebfa526b1af2e42e591590 (patch)
treea6cb2c29dcdc0278f8afd5b2ed9bdff9dce73d00 /source4/ntvfs/posix/pvfs_setfileinfo.c
parent5f608f23d32003456ebeed0ef6afdfd3f40aea25 (diff)
downloadsamba-2db915e06564b42bf7ebfa526b1af2e42e591590.tar.gz
samba-2db915e06564b42bf7ebfa526b1af2e42e591590.tar.bz2
samba-2db915e06564b42bf7ebfa526b1af2e42e591590.zip
r3595: - fixed a talloc_free ordering problem on cleanup with pending requests
- added initial support for MODE_INFORMATION in setfileinfo (I have no idea what "mode information" on a file is - it takes a value of 0, 2, 4 or 6. What could it be?) (This used to be commit e53ec2f6b68e1d19149c36ea8fcd25a204db38fb)
Diffstat (limited to 'source4/ntvfs/posix/pvfs_setfileinfo.c')
-rw-r--r--source4/ntvfs/posix/pvfs_setfileinfo.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/source4/ntvfs/posix/pvfs_setfileinfo.c b/source4/ntvfs/posix/pvfs_setfileinfo.c
index 22997be94d..15b7f168f2 100644
--- a/source4/ntvfs/posix/pvfs_setfileinfo.c
+++ b/source4/ntvfs/posix/pvfs_setfileinfo.c
@@ -171,6 +171,9 @@ NTSTATUS pvfs_setfileinfo(struct ntvfs_module_context *ntvfs,
case RAW_SFILEINFO_ALLOCATION_INFO:
case RAW_SFILEINFO_ALLOCATION_INFORMATION:
newstats.dos.alloc_size = info->allocation_info.in.alloc_size;
+ if (newstats.dos.alloc_size < newstats.st.st_size) {
+ newstats.st.st_size = newstats.dos.alloc_size;
+ }
break;
case RAW_SFILEINFO_END_OF_FILE_INFO:
@@ -182,6 +185,17 @@ NTSTATUS pvfs_setfileinfo(struct ntvfs_module_context *ntvfs,
f->position = info->position_information.in.position;
break;
+ case RAW_SFILEINFO_MODE_INFORMATION:
+ /* this one is a puzzle */
+ if (info->mode_information.in.mode != 0 &&
+ info->mode_information.in.mode != 2 &&
+ info->mode_information.in.mode != 4 &&
+ info->mode_information.in.mode != 6) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+ f->mode = info->mode_information.in.mode;
+ break;
+
default:
return NT_STATUS_INVALID_LEVEL;
}
@@ -310,7 +324,15 @@ NTSTATUS pvfs_setpathinfo(struct ntvfs_module_context *ntvfs,
case RAW_SFILEINFO_ALLOCATION_INFO:
case RAW_SFILEINFO_ALLOCATION_INFORMATION:
+ if (info->allocation_info.in.alloc_size > newstats.dos.alloc_size) {
+ /* strange. Increasing the allocation size via setpathinfo
+ should be silently ignored */
+ break;
+ }
newstats.dos.alloc_size = info->allocation_info.in.alloc_size;
+ if (newstats.dos.alloc_size < newstats.st.st_size) {
+ newstats.st.st_size = newstats.dos.alloc_size;
+ }
break;
case RAW_SFILEINFO_END_OF_FILE_INFO:
@@ -318,6 +340,15 @@ NTSTATUS pvfs_setpathinfo(struct ntvfs_module_context *ntvfs,
newstats.st.st_size = info->end_of_file_info.in.size;
break;
+ case RAW_SFILEINFO_MODE_INFORMATION:
+ if (info->mode_information.in.mode != 0 &&
+ info->mode_information.in.mode != 2 &&
+ info->mode_information.in.mode != 4 &&
+ info->mode_information.in.mode != 6) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+ return NT_STATUS_OK;
+
case RAW_SFILEINFO_DISPOSITION_INFO:
case RAW_SFILEINFO_DISPOSITION_INFORMATION:
case RAW_SFILEINFO_POSITION_INFORMATION: