fixes for EAs and filename in gentest_smb2 results
authorAndrew Tridgell <tridge@samba.org>
Thu, 22 May 2008 13:00:08 +0000 (23:00 +1000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 22 May 2008 13:00:08 +0000 (23:00 +1000)
- SMB2 returns 0 for a null EA
- return the share qualified name for the filename in SMB2 ALL_INFO
  level
(This used to be commit f9708184a2037f83ebb97c847414326a42436154)

source4/ntvfs/posix/pvfs_qfileinfo.c

index 6bc21e5e3e90a507b101cc9deb3cdc68e9121564..102660a0bfba388ef95f9d6cac552c9651e77d62 100644 (file)
@@ -298,10 +298,21 @@ static NTSTATUS pvfs_map_fileinfo(struct pvfs_state *pvfs,
                        (name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY)? 1 : 0;
                info->all_info2.out.file_id        = name->dos.file_id;
                info->all_info2.out.ea_size        = name->dos.ea_size;
+               if (info->all_info2.out.ea_size == 4) {
+                       /* SMB2 uses zero for a empty EA set */
+                       info->all_info2.out.ea_size = 0;
+               }
                info->all_info2.out.access_mask    = 0; /* only set by qfileinfo */
                info->all_info2.out.position       = 0; /* only set by qfileinfo */
                info->all_info2.out.mode           = 0; /* only set by qfileinfo */
-               info->all_info2.out.fname.s        = name->original_name;
+               /* windows wants the full path on disk for this
+                  result, but I really don't want to expose that on
+                  the wire, so I'll give the path with a share
+                  prefix, which is a good approximation */
+               info->all_info2.out.fname.s = talloc_asprintf(req, "\\%s\\%s",
+                                                             pvfs->share_name, 
+                                                             name->original_name);
+               NT_STATUS_HAVE_NO_MEMORY(info->all_info2.out.fname.s);
                return NT_STATUS_OK;
        }