diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/client/client.c | 2 | ||||
-rw-r--r-- | source3/client/clitar.c | 2 | ||||
-rw-r--r-- | source3/include/proto.h | 2 | ||||
-rw-r--r-- | source3/lib/system.c | 2 | ||||
-rw-r--r-- | source3/smbd/fileio.c | 8 | ||||
-rw-r--r-- | source3/smbd/nttrans.c | 22 | ||||
-rw-r--r-- | source3/smbd/reply.c | 6 |
7 files changed, 31 insertions, 13 deletions
diff --git a/source3/client/client.c b/source3/client/client.c index e08beeb685..b48e520d96 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -1123,7 +1123,7 @@ static void do_get(char *rname,char *lname,file_info *finfo1) SSVAL(outbuf,smb_vwv1,smb_offset(p,outbuf)); bzero(p,200); p -= smb_wct; - SSVAL(p,smb_wct,10); + SCVAL(p,smb_wct,10); SSVAL(p,smb_vwv0,0xFF); SSVAL(p,smb_vwv5,MIN(max_xmit-500,finfo.size)); SSVAL(p,smb_vwv9,MIN(BUFFER_SIZE,finfo.size)); diff --git a/source3/client/clitar.c b/source3/client/clitar.c index 376d3aeac6..1ca8c1a4dc 100644 --- a/source3/client/clitar.c +++ b/source3/client/clitar.c @@ -1071,7 +1071,7 @@ static void do_atar(char *rname,char *lname,file_info *finfo1) SSVAL(outbuf,smb_vwv1,PTR_DIFF(p,outbuf) - 4); memset(p,0,200); p -= smb_wct; - SSVAL(p,smb_wct,10); + SCVAL(p,smb_wct,10); SSVAL(p,smb_vwv0,0xFF); SSVAL(p,smb_vwv5,MIN(max_xmit-500,finfo.size)); SSVAL(p,smb_vwv9,MIN(0xFFFF,finfo.size)); diff --git a/source3/include/proto.h b/source3/include/proto.h index 4c966b2faa..a864cd7033 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -159,7 +159,7 @@ int sys_stat(char *fname,SMB_STRUCT_STAT *sbuf); int sys_fstat(int fd,SMB_STRUCT_STAT *sbuf); int sys_lstat(char *fname,SMB_STRUCT_STAT *sbuf); int sys_ftruncate(int fd, SMB_OFF_T offset); -int sys_lseek(int fd, SMB_OFF_T offset, int whence); +SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence); int dos_unlink(char *fname); int dos_open(char *fname,int flags,int mode); DIR *dos_opendir(char *dname); diff --git a/source3/lib/system.c b/source3/lib/system.c index b6a59e8648..215bfd0c1d 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -195,7 +195,7 @@ int sys_ftruncate(int fd, SMB_OFF_T offset) An lseek() wrapper that will deal with 64 bit filesizes. ********************************************************************/ -int sys_lseek(int fd, SMB_OFF_T offset, int whence) +SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence) { #if defined(HAVE_OFF64_T) && defined(HAVE_LSEEK64) return lseek64(fd, offset, whence); diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c index f0bb5e45ac..d40c159798 100644 --- a/source3/smbd/fileio.c +++ b/source3/smbd/fileio.c @@ -36,6 +36,10 @@ SMB_OFF_T seek_file(files_struct *fsp,SMB_OFF_T pos) offset = 3; fsp->pos = (sys_lseek(fsp->fd_ptr->fd,pos+offset,SEEK_SET) - offset); + + DEBUG(10,("seek_file: requested pos = %.0f, new pos = %.0f\n", + (double)(pos+offset), (double)fsp->pos )); + return(fsp->pos); } @@ -62,7 +66,7 @@ ssize_t read_file(files_struct *fsp,char *data,SMB_OFF_T pos,size_t n) SMB_OFF_T num = (fsp->mmap_size > pos) ? (fsp->mmap_size - pos) : -1; num = MIN(n,num); #ifdef LARGE_SMB_OFF_T - if ((num > 0) && (num < (1<<(sizeof(size_t)*8))) { + if ((num > 0) && (num < (1LL<<(sizeof(size_t)*8)))) { #else /* LARGE_SMB_OFF_T */ if (num > 0) { #endif /* LARGE_SMB_OFF_T */ @@ -76,7 +80,7 @@ ssize_t read_file(files_struct *fsp,char *data,SMB_OFF_T pos,size_t n) #endif if (seek_file(fsp,pos) != pos) { - DEBUG(3,("Failed to seek to %.0f\n",(double)pos)); + DEBUG(3,("read_file: Failed to seek to %.0f\n",(double)pos)); return(ret); } diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index 81b3ff26d5..5052e6d52a 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -661,9 +661,16 @@ int reply_ntcreate_and_X(connection_struct *conn, put_long_date(p,sbuf.st_mtime); /* change time */ p += 8; SIVAL(p,0,fmode); /* File Attributes. */ - p += 12; + p += 4; +#ifdef LARGE_SMB_OFF_T + SIVAL(p,0, file_len); + SIVAL(p,4, file_len >> 32); +#else /* LARGE_SMB_OFF_T */ + SIVAL(p,0,file_len); +#endif /* LARGE_SMB_OFF_T */ + p += 8; #ifdef LARGE_SMB_OFF_T - SIVAL(p,0, file_len & 0xFFFFFFFF); + SIVAL(p,0, file_len); SIVAL(p,4, file_len >> 32); #else /* LARGE_SMB_OFF_T */ SIVAL(p,0,file_len); @@ -889,9 +896,16 @@ static int call_nt_transact_create(connection_struct *conn, put_long_date(p,sbuf.st_mtime); /* change time */ p += 8; SIVAL(p,0,fmode); /* File Attributes. */ - p += 12; + p += 4; +#ifdef LARGE_SMB_OFF_T + SIVAL(p,0, file_len); + SIVAL(p,4, (file_len >> 32)); +#else /* LARGE_SMB_OFF_T */ + SIVAL(p,0,file_len); +#endif /* LARGE_SMB_OFF_T */ + p += 8; #ifdef LARGE_SMB_OFF_T - SIVAL(p,0, file_len & 0xFFFFFFFF); + SIVAL(p,0, file_len); SIVAL(p,4, (file_len >> 32)); #else /* LARGE_SMB_OFF_T */ SIVAL(p,0,file_len); diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index e956ab6cd9..38c39efad6 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -1792,7 +1792,7 @@ int reply_readbraw(connection_struct *conn, char *inbuf, char *outbuf, int dum_s startpos = IVAL(inbuf,smb_vwv1); #ifdef LARGE_SMB_OFF_T - if(SVAL(inbuf,smb_wct) == 10) { + if(CVAL(inbuf,smb_wct) == 10) { /* * This is a large offset (64 bit) read. */ @@ -2007,7 +2007,7 @@ int reply_read_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt data = smb_buf(outbuf); #ifdef LARGE_SMB_OFF_T - if(SVAL(inbuf,smb_wct) == 12) { + if(CVAL(inbuf,smb_wct) == 12) { /* * This is a large offset (64 bit) read. */ @@ -2265,7 +2265,7 @@ int reply_write_and_X(connection_struct *conn, char *inbuf,char *outbuf,int leng data = smb_base(inbuf) + smb_doff; #ifdef LLARGE_SMB_OFF_T - if(SVAL(inbuf,smb_wct) == 14) { + if(CVAL(inbuf,smb_wct) == 14) { /* * This is a large offset (64 bit) write. */ |