summaryrefslogtreecommitdiff
path: root/source4/ntvfs
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-06-07 12:15:10 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:46 -0500
commit6a70164fe0c12ee8e914ddb934d7ef7e9ff232aa (patch)
treea0ef71292cf98bfc36df86445e670feb20c7e4cd /source4/ntvfs
parentd2f15d4b6c56eafb00d43c259cec5c4a21a74ba1 (diff)
downloadsamba-6a70164fe0c12ee8e914ddb934d7ef7e9ff232aa.tar.gz
samba-6a70164fe0c12ee8e914ddb934d7ef7e9ff232aa.tar.bz2
samba-6a70164fe0c12ee8e914ddb934d7ef7e9ff232aa.zip
r7361: fixed the 'file becomes a directory' bug that marc kapland found.
Thanks Marc! (This used to be commit d1c5eb3693b77b3eb7527dc2758a6ea75a100376)
Diffstat (limited to 'source4/ntvfs')
-rw-r--r--source4/ntvfs/posix/pvfs_util.c7
-rw-r--r--source4/ntvfs/posix/pvfs_xattr.c8
2 files changed, 11 insertions, 4 deletions
diff --git a/source4/ntvfs/posix/pvfs_util.c b/source4/ntvfs/posix/pvfs_util.c
index eb0f04728c..7eedc38cf9 100644
--- a/source4/ntvfs/posix/pvfs_util.c
+++ b/source4/ntvfs/posix/pvfs_util.c
@@ -68,11 +68,16 @@ NTSTATUS pvfs_match_attrib(struct pvfs_state *pvfs, struct pvfs_filename *name,
/*
normalise a file attribute
*/
-uint32_t pvfs_attrib_normalise(uint32_t attrib)
+uint32_t pvfs_attrib_normalise(uint32_t attrib, mode_t mode)
{
if (attrib != FILE_ATTRIBUTE_NORMAL) {
attrib &= ~FILE_ATTRIBUTE_NORMAL;
}
+ if (S_ISDIR(mode)) {
+ attrib |= FILE_ATTRIBUTE_DIRECTORY;
+ } else {
+ attrib &= ~FILE_ATTRIBUTE_DIRECTORY;
+ }
return attrib;
}
diff --git a/source4/ntvfs/posix/pvfs_xattr.c b/source4/ntvfs/posix/pvfs_xattr.c
index c2af2e10bd..7c4fa317d6 100644
--- a/source4/ntvfs/posix/pvfs_xattr.c
+++ b/source4/ntvfs/posix/pvfs_xattr.c
@@ -184,7 +184,8 @@ NTSTATUS pvfs_dosattrib_load(struct pvfs_state *pvfs, struct pvfs_filename *name
switch (attrib.version) {
case 1:
info1 = &attrib.info.info1;
- name->dos.attrib = pvfs_attrib_normalise(info1->attrib);
+ name->dos.attrib = pvfs_attrib_normalise(info1->attrib,
+ name->st.st_mode);
name->dos.ea_size = info1->ea_size;
if (name->st.st_size == info1->size) {
name->dos.alloc_size =
@@ -201,7 +202,8 @@ NTSTATUS pvfs_dosattrib_load(struct pvfs_state *pvfs, struct pvfs_filename *name
case 2:
info2 = &attrib.info.info2;
- name->dos.attrib = pvfs_attrib_normalise(info2->attrib);
+ name->dos.attrib = pvfs_attrib_normalise(info2->attrib,
+ name->st.st_mode);
name->dos.ea_size = info2->ea_size;
if (name->st.st_size == info2->size) {
name->dos.alloc_size =
@@ -248,7 +250,7 @@ NTSTATUS pvfs_dosattrib_save(struct pvfs_state *pvfs, struct pvfs_filename *name
attrib.version = 2;
info2 = &attrib.info.info2;
- name->dos.attrib = pvfs_attrib_normalise(name->dos.attrib);
+ name->dos.attrib = pvfs_attrib_normalise(name->dos.attrib, name->st.st_mode);
info2->attrib = name->dos.attrib;
info2->ea_size = name->dos.ea_size;