summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-12-15 16:49:04 -0800
committerJeremy Allison <jra@samba.org>2010-12-16 02:37:57 +0100
commita06519a579f04c4728af01a169ba79c7149994db (patch)
treee40f11106b0d1e0d316053d396121a83bb4e6b2a
parentecf48af135e4c1ebc5aafe4b3dad785162f5949a (diff)
downloadsamba-a06519a579f04c4728af01a169ba79c7149994db.tar.gz
samba-a06519a579f04c4728af01a169ba79c7149994db.tar.bz2
samba-a06519a579f04c4728af01a169ba79c7149994db.zip
Fix old bug in openX code, exposed when "strict allocate" is set to true.
We need to return the file size here, not the allocation size, but we were not updating the stat struct after the vfs_set_filesize() call. Ensure we always use fresh data in openX replies. Jeremy. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Thu Dec 16 02:37:58 CET 2010 on sn-devel-104
-rw-r--r--source3/smbd/reply.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 26badc4ebf..e5067cca7e 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -1985,12 +1985,16 @@ void reply_open_and_X(struct smb_request *req)
reply_nterror(req, NT_STATUS_DISK_FULL);
goto out;
}
- smb_fname->st.st_ex_size =
- SMB_VFS_GET_ALLOC_SIZE(conn, fsp, &smb_fname->st);
+ status = vfs_stat_fsp(fsp);
+ if (!NT_STATUS_IS_OK(status)) {
+ close_file(req, fsp, ERROR_CLOSE);
+ reply_nterror(req, status);
+ goto out;
+ }
}
- fattr = dos_mode(conn, smb_fname);
- mtime = convert_timespec_to_time_t(smb_fname->st.st_ex_mtime);
+ fattr = dos_mode(conn, fsp->fsp_name);
+ mtime = convert_timespec_to_time_t(fsp->fsp_name->st.st_ex_mtime);
if (fattr & aDIR) {
close_file(req, fsp, ERROR_CLOSE);
reply_nterror(req, NT_STATUS_ACCESS_DENIED);
@@ -2038,7 +2042,7 @@ void reply_open_and_X(struct smb_request *req)
} else {
srv_put_dos_date3((char *)req->outbuf,smb_vwv4,mtime);
}
- SIVAL(req->outbuf,smb_vwv6,(uint32)smb_fname->st.st_ex_size);
+ SIVAL(req->outbuf,smb_vwv6,(uint32)fsp->fsp_name->st.st_ex_size);
SSVAL(req->outbuf,smb_vwv8,GET_OPENX_MODE(deny_mode));
SSVAL(req->outbuf,smb_vwv11,smb_action);