s3: smbd: SMB2 close. Call utility function setup_close_full_information()
authorJeremy Allison <jra@samba.org>
Fri, 20 Feb 2015 02:49:03 +0000 (18:49 -0800)
committerJeremy Allison <jra@samba.org>
Fri, 20 Feb 2015 17:25:06 +0000 (18:25 +0100)
Replaces existing inline code.

Bug 11104 - SMB2/SMB3 close response does not include attributes when requested.

https://bugzilla.samba.org/show_bug.cgi?id=11104

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Steve French <sfrench@samba.org>
source3/smbd/smb2_close.c

index 40c2d30d5709e8e70c52238ed0f9db97b5cf4b5a..755a4b69f34d236bd1eb79b42061d9f452db6974 100644 (file)
@@ -245,32 +245,17 @@ static NTSTATUS smbd_smb2_close(struct smbd_smb2_request *req,
        }
 
        if (in_flags & SMB2_CLOSE_FLAGS_FULL_INFORMATION) {
-               int ret;
-               if (posix_open) {
-                       ret = SMB_VFS_LSTAT(conn, smb_fname);
-               } else {
-                       ret = SMB_VFS_STAT(conn, smb_fname);
-               }
-               if (ret == 0) {
-                       flags = SMB2_CLOSE_FLAGS_FULL_INFORMATION;
-                       dos_attrs = dos_mode(conn, smb_fname);
-                       *out_last_write_ts = smb_fname->st.st_ex_mtime;
-                       *out_last_access_ts = smb_fname->st.st_ex_atime;
-                       *out_creation_ts = get_create_timespec(conn, NULL, smb_fname);
-                       *out_change_ts = get_change_timespec(conn, NULL, smb_fname);
-
-                       if (lp_dos_filetime_resolution(SNUM(conn))) {
-                               dos_filetime_timespec(out_creation_ts);
-                               dos_filetime_timespec(out_last_write_ts);
-                               dos_filetime_timespec(out_last_access_ts);
-                               dos_filetime_timespec(out_change_ts);
-                       }
-                       if (!(dos_attrs & FILE_ATTRIBUTE_DIRECTORY)) {
-                               file_size = get_file_size_stat(&smb_fname->st);
-                       }
-
-                       allocation_size = SMB_VFS_GET_ALLOC_SIZE(conn, NULL, &smb_fname->st);
-               }
+               setup_close_full_information(conn,
+                               smb_fname,
+                               posix_open,
+                               out_creation_ts,
+                               out_last_access_ts,
+                               out_last_write_ts,
+                               out_change_ts,
+                               &flags,
+                               &allocation_size,
+                               &file_size,
+                               &dos_attrs);
        }
 
        *out_flags = flags;