summaryrefslogtreecommitdiff
path: root/source4/ntvfs/posix
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2008-05-28 20:06:04 +1000
committerAndrew Tridgell <tridge@samba.org>2008-05-28 20:06:04 +1000
commitfa0bc441e35bf0451f3ea471c4c144206a80febd (patch)
tree62e1f1a6194af487333a4959e95a672b04f76073 /source4/ntvfs/posix
parent91069754f8f60e2ade0f907c4420e01125405919 (diff)
downloadsamba-fa0bc441e35bf0451f3ea471c4c144206a80febd.tar.gz
samba-fa0bc441e35bf0451f3ea471c4c144206a80febd.tar.bz2
samba-fa0bc441e35bf0451f3ea471c4c144206a80febd.zip
don't allow a file to be changed to a directory with setfileinfo
(This used to be commit ad7acbf8bf83c7250dfcbd57f0f4e19e57534a92)
Diffstat (limited to 'source4/ntvfs/posix')
-rw-r--r--source4/ntvfs/posix/pvfs_setfileinfo.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/source4/ntvfs/posix/pvfs_setfileinfo.c b/source4/ntvfs/posix/pvfs_setfileinfo.c
index 0beca75ead..1dd2c075d9 100644
--- a/source4/ntvfs/posix/pvfs_setfileinfo.c
+++ b/source4/ntvfs/posix/pvfs_setfileinfo.c
@@ -457,7 +457,12 @@ NTSTATUS pvfs_setfileinfo(struct ntvfs_module_context *ntvfs,
/* possibly change the attribute */
if (newstats.dos.attrib != h->name->dos.attrib) {
- mode_t mode = pvfs_fileperms(pvfs, newstats.dos.attrib);
+ mode_t mode;
+ if ((newstats.dos.attrib & FILE_ATTRIBUTE_DIRECTORY) &&
+ !(h->name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY)) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+ mode = pvfs_fileperms(pvfs, newstats.dos.attrib);
if (!(h->name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY)) {
if (fchmod(h->fd, mode) == -1) {
return pvfs_map_errno(pvfs, errno);