mirror of
https://github.com/samba-team/samba.git
synced 2025-02-28 01:58:17 +03:00
Ok so with this bugfix 64 bit file access actually seems to work :-).
Problems were just dumb bugs like (defining sys_lseek to return 'int' DOH !). Jeremy. (This used to be commit 54dd51176fbab18af0b21bdee71b53f8f86573a8)
This commit is contained in:
parent
27d0bef143
commit
9b20e5bac2
@ -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));
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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 & 0xFFFFFFFF);
|
||||
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);
|
||||
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 & 0xFFFFFFFF);
|
||||
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);
|
||||
SIVAL(p,4, (file_len >> 32));
|
||||
#else /* LARGE_SMB_OFF_T */
|
||||
SIVAL(p,0,file_len);
|
||||
|
@ -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.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user