summaryrefslogtreecommitdiffstats
path: root/source/smbd/blocking.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-12-03 08:02:41 +0000
committerJeremy Allison <jra@samba.org>2002-12-03 08:02:41 +0000
commit2d14c442bc601a277458b69f05a763aa2a1ab3b7 (patch)
treec5139360601f55338134d540e54579ebe185f250 /source/smbd/blocking.c
parentddd70995951c072a02fc3bddd7a94ccbf301f62c (diff)
downloadsamba-2d14c442bc601a277458b69f05a763aa2a1ab3b7.tar.gz
samba-2d14c442bc601a277458b69f05a763aa2a1ab3b7.tar.xz
samba-2d14c442bc601a277458b69f05a763aa2a1ab3b7.zip
Fixed nasty bug where file writes with start offsets in the range
0x80000000 -> 0xFFFFFFFF would fail as they were being cast from IVAL (uint32) to SMB_OFF_T (off_t or off64_t, both *signed* types). The sign extension would cause the offset to be treated as negative. Thanks to Herb for helping me track this one down (IRIX is good for large file tests :-). Jeremy. PS. That horrid EXEXIST thing has broken configure.....
Diffstat (limited to 'source/smbd/blocking.c')
-rw-r--r--source/smbd/blocking.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/source/smbd/blocking.c b/source/smbd/blocking.c
index 9d411711cb9..14239272c29 100644
--- a/source/smbd/blocking.c
+++ b/source/smbd/blocking.c
@@ -267,20 +267,20 @@ static BOOL process_lockread(blocking_lock_record *blr)
ssize_t nread = -1;
char *data, *p;
int outsize = 0;
- SMB_OFF_T startpos;
+ SMB_BIG_UINT startpos;
size_t numtoread;
NTSTATUS status;
connection_struct *conn = conn_find(SVAL(inbuf,smb_tid));
files_struct *fsp = blr->fsp;
numtoread = SVAL(inbuf,smb_vwv1);
- startpos = IVAL(inbuf,smb_vwv2);
+ startpos = (SMB_BIG_UINT)IVAL(inbuf,smb_vwv2);
numtoread = MIN(BUFFER_SIZE-outsize,numtoread);
data = smb_buf(outbuf) + 3;
status = do_lock_spin( fsp, conn, SVAL(inbuf,smb_pid), (SMB_BIG_UINT)numtoread,
- (SMB_BIG_UINT)startpos, READ_LOCK);
+ startpos, READ_LOCK);
if (NT_STATUS_V(status)) {
if (!NT_STATUS_EQUAL(status,NT_STATUS_LOCK_NOT_GRANTED) &&
!NT_STATUS_EQUAL(status,NT_STATUS_FILE_LOCK_CONFLICT)) {
@@ -337,17 +337,17 @@ static BOOL process_lock(blocking_lock_record *blr)
char *outbuf = OutBuffer;
char *inbuf = blr->inbuf;
int outsize;
- SMB_OFF_T count = 0, offset = 0;
+ SMB_BIG_UINT count = (SMB_BIG_UINT)0, offset = (SMB_BIG_UINT)0;
NTSTATUS status;
connection_struct *conn = conn_find(SVAL(inbuf,smb_tid));
files_struct *fsp = blr->fsp;
- count = IVAL(inbuf,smb_vwv1);
- offset = IVAL(inbuf,smb_vwv3);
+ count = IVAL_TO_SMB_OFF_T(inbuf,smb_vwv1);
+ offset = IVAL_TO_SMB_OFF_T(inbuf,smb_vwv3);
errno = 0;
- status = do_lock_spin(fsp, conn, SVAL(inbuf,smb_pid), (SMB_BIG_UINT)count,
- (SMB_BIG_UINT)offset, WRITE_LOCK);
+ status = do_lock_spin(fsp, conn, SVAL(inbuf,smb_pid), count,
+ offset, WRITE_LOCK);
if (NT_STATUS_IS_ERR(status)) {
if (!NT_STATUS_EQUAL(status,NT_STATUS_LOCK_NOT_GRANTED) &&
!NT_STATUS_EQUAL(status,NT_STATUS_FILE_LOCK_CONFLICT)) {