r3142: fill in all the ntcreatex response fields explicitly, rather than
authorAndrew Tridgell <tridge@samba.org>
Sat, 23 Oct 2004 06:22:57 +0000 (06:22 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:02:25 +0000 (13:02 -0500)
zeroing. This makes it clearer what bits are not yet implemented (and
is more valgrind friendly)
(This used to be commit 18b471327b596f3ea8f6a7b39ba0a83b2584ed0b)

source4/ntvfs/posix/pvfs_open.c

index a16fbbe89116c115e9071255c1df316092000001..482f71b9a3d753e765b264e843503118449de574 100644 (file)
@@ -70,6 +70,7 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs,
        struct pvfs_file *f;
        int fnum;
        NTSTATUS status;
+       uint32_t create_action;
 
        /* if the client says it must be a directory, and it isn't,
           then fail */
@@ -133,6 +134,9 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs,
                if (!NT_STATUS_IS_OK(status)) {
                        return status;
                }
+               create_action = NTCREATEX_ACTION_CREATED;
+       } else {
+               create_action = NTCREATEX_ACTION_EXISTED;
        }
 
        if (!name->exists) {
@@ -144,17 +148,19 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs,
        /* the open succeeded, keep this handle permanently */
        talloc_steal(pvfs, f);
 
-       ZERO_STRUCT(io->generic.out);
-       
-       io->generic.out.create_time  = name->dos.create_time;
-       io->generic.out.access_time  = name->dos.access_time;
-       io->generic.out.write_time   = name->dos.write_time;
-       io->generic.out.change_time  = name->dos.change_time;
-       io->generic.out.fnum         = f->fnum;
-       io->generic.out.alloc_size   = 0;
-       io->generic.out.size         = 0;
-       io->generic.out.attrib       = name->dos.attrib;
-       io->generic.out.is_directory = 1;
+       io->generic.out.oplock_level  = NO_OPLOCK;
+       io->generic.out.fnum          = f->fnum;
+       io->generic.out.create_action = create_action;
+       io->generic.out.create_time   = name->dos.create_time;
+       io->generic.out.access_time   = name->dos.access_time;
+       io->generic.out.write_time    = name->dos.write_time;
+       io->generic.out.change_time   = name->dos.change_time;
+       io->generic.out.attrib        = name->dos.attrib;
+       io->generic.out.alloc_size    = 0;
+       io->generic.out.size          = 0;
+       io->generic.out.file_type     = FILE_TYPE_DISK;
+       io->generic.out.ipc_state     = 0;
+       io->generic.out.is_directory  = 1;
 
        return NT_STATUS_OK;
 }
@@ -283,19 +289,19 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
           abnormal termination */
        talloc_set_destructor(f, pvfs_fd_destructor);
 
-       ZERO_STRUCT(io->generic.out);
-       
-       io->generic.out.create_time = name->dos.create_time;
-       io->generic.out.access_time = name->dos.access_time;
-       io->generic.out.write_time = name->dos.write_time;
-       io->generic.out.change_time = name->dos.change_time;
-       io->generic.out.fnum = f->fnum;
-       io->generic.out.alloc_size = name->dos.alloc_size;
-       io->generic.out.size = name->st.st_size;
-       io->generic.out.attrib = name->dos.attrib;
+       io->generic.out.oplock_level  = NO_OPLOCK;
+       io->generic.out.fnum          = f->fnum;
        io->generic.out.create_action = NTCREATEX_ACTION_CREATED;
-       io->generic.out.is_directory = 0;
-       io->generic.out.file_type = FILE_TYPE_DISK;
+       io->generic.out.create_time   = name->dos.create_time;
+       io->generic.out.access_time   = name->dos.access_time;
+       io->generic.out.write_time    = name->dos.write_time;
+       io->generic.out.change_time   = name->dos.change_time;
+       io->generic.out.attrib        = name->dos.attrib;
+       io->generic.out.alloc_size    = name->dos.alloc_size;
+       io->generic.out.size          = name->st.st_size;
+       io->generic.out.file_type     = FILE_TYPE_DISK;
+       io->generic.out.ipc_state     = 0;
+       io->generic.out.is_directory  = 0;
 
        /* success - keep the file handle */
        talloc_steal(pvfs, f);
@@ -464,19 +470,19 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
           abnormal termination */
        talloc_set_destructor(f, pvfs_fd_destructor);
 
-       ZERO_STRUCT(io->generic.out);
-       
-       io->generic.out.create_time = name->dos.create_time;
-       io->generic.out.access_time = name->dos.access_time;
-       io->generic.out.write_time = name->dos.write_time;
-       io->generic.out.change_time = name->dos.change_time;
-       io->generic.out.fnum = f->fnum;
-       io->generic.out.alloc_size = name->dos.alloc_size;
-       io->generic.out.size = name->st.st_size;
-       io->generic.out.attrib = name->dos.attrib;
+       io->generic.out.oplock_level  = NO_OPLOCK;
+       io->generic.out.fnum          = f->fnum;
        io->generic.out.create_action = NTCREATEX_ACTION_EXISTED;
-       io->generic.out.is_directory = 0;
-       io->generic.out.file_type = FILE_TYPE_DISK;
+       io->generic.out.create_time   = name->dos.create_time;
+       io->generic.out.access_time   = name->dos.access_time;
+       io->generic.out.write_time    = name->dos.write_time;
+       io->generic.out.change_time   = name->dos.change_time;
+       io->generic.out.attrib        = name->dos.attrib;
+       io->generic.out.alloc_size    = name->dos.alloc_size;
+       io->generic.out.size          = name->st.st_size;
+       io->generic.out.file_type     = FILE_TYPE_DISK;
+       io->generic.out.ipc_state     = 0;
+       io->generic.out.is_directory  = 0;
 
        /* success - keep the file handle */
        talloc_steal(pvfs, f);