Second part of fix for bug #6494 - Incorrect FileStatus returned in NT_CREATE_ANDX.
authorJeremy Allison <jra@samba.org>
Tue, 30 Mar 2010 23:54:43 +0000 (16:54 -0700)
committerJeremy Allison <jra@samba.org>
Tue, 30 Mar 2010 23:54:43 +0000 (16:54 -0700)
Ensure we do this in nttrans create too.

Jeremy.

source3/smbd/nttrans.c

index 93621dde618f028b7c525247507e0c55d3abcf11..b79bb0b8f2b65a8b89530c82b0aba3aada64028b 100644 (file)
@@ -1220,7 +1220,25 @@ static void call_nt_transact_create(connection_struct *conn,
        SOFF_T(p,0,file_len);
        p += 8;
        if (flags & EXTENDED_RESPONSE_REQUIRED) {
        SOFF_T(p,0,file_len);
        p += 8;
        if (flags & EXTENDED_RESPONSE_REQUIRED) {
-               SSVAL(p,2,0x7);
+               uint16_t file_status = (NO_EAS|NO_SUBSTREAMS|NO_REPARSETAG);
+               size_t num_names = 0;
+               unsigned int num_streams;
+               struct stream_struct *streams = NULL;
+
+               /* Do we have any EA's ? */
+               status = get_ea_names_from_file(ctx, conn, fsp,
+                               smb_fname->base_name, NULL, &num_names);
+               if (NT_STATUS_IS_OK(status) && num_names) {
+                       file_status &= ~NO_EAS;
+               }
+               status = SMB_VFS_STREAMINFO(conn, NULL, smb_fname->base_name, ctx,
+                       &num_streams, &streams);
+               /* There is always one stream, ::$DATA. */
+               if (NT_STATUS_IS_OK(status) && num_streams > 1) {
+                       file_status &= ~NO_SUBSTREAMS;
+               }
+               TALLOC_FREE(streams);
+               SSVAL(p,2,file_status);
        }
        p += 4;
        SCVAL(p,0,fsp->is_directory ? 1 : 0);
        }
        p += 4;
        SCVAL(p,0,fsp->is_directory ? 1 : 0);