From 96108eed100e1962c4abd75a021d84467ae4d690 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 28 Mar 2012 10:21:22 +1100 Subject: [PATCH] build: #ifdef LARGE_SMB_OFF_T as off_t is now always 64 bits --- source3/include/includes.h | 12 --------- source3/include/smb.h | 4 --- source3/locking/posix.c | 17 ++---------- source3/smbd/reply.c | 53 -------------------------------------- source3/smbd/trans2.c | 29 --------------------- 5 files changed, 2 insertions(+), 113 deletions(-) diff --git a/source3/include/includes.h b/source3/include/includes.h index e321e4c9434..ee7bb1cb7c2 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -317,21 +317,9 @@ typedef uint64_t br_off; * NT SMB calls. */ -#ifndef LARGE_SMB_OFF_T -# if (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)) -# define LARGE_SMB_OFF_T 1 -# endif -#endif - -#ifdef LARGE_SMB_OFF_T #define SOFF_T(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32)) #define SOFF_T_R(p, ofs, v) (SIVAL(p,(ofs)+4,(v)&0xFFFFFFFF), SIVAL(p,ofs,(v)>>32)) #define IVAL_TO_SMB_OFF_T(buf,off) ((SMB_OFF_T)(( ((uint64_t)(IVAL((buf),(off)))) & ((uint64_t)0xFFFFFFFF) ))) -#else -#define SOFF_T(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0)) -#define SOFF_T_R(p, ofs, v) (SIVAL(p,(ofs)+4,v),SIVAL(p,ofs,0)) -#define IVAL_TO_SMB_OFF_T(buf,off) ((SMB_OFF_T)(( ((uint32)(IVAL((buf),(off)))) & 0xFFFFFFFF ))) -#endif #ifndef HAVE_BLKSIZE_T /* This is mainly for HP/UX which defines st_blksize as long */ diff --git a/source3/include/smb.h b/source3/include/smb.h index 01253f0c548..ddf3227336b 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -33,11 +33,7 @@ #define COPYRIGHT_STARTUP_MESSAGE "Copyright Andrew Tridgell and the Samba Team 1992-2012" -#if defined(LARGE_SMB_OFF_T) #define BUFFER_SIZE (128*1024) -#else /* no large readwrite possible */ -#define BUFFER_SIZE (0xFFFF) -#endif #define SAFETY_MARGIN 1024 #define LARGE_WRITEX_HDR_SIZE 65 diff --git a/source3/locking/posix.c b/source3/locking/posix.c index abedd5600db..02402f97747 100644 --- a/source3/locking/posix.c +++ b/source3/locking/posix.c @@ -97,9 +97,7 @@ static bool posix_lock_in_range(SMB_OFF_T *offset_out, SMB_OFF_T *count_out, #if defined(MAX_POSITIVE_LOCK_OFFSET) /* Some systems have arbitrary limits. */ SMB_OFF_T max_positive_lock_offset = (MAX_POSITIVE_LOCK_OFFSET); - -#elif defined(LARGE_SMB_OFF_T) && !defined(HAVE_BROKEN_FCNTL64_LOCKS) - +#else /* * In this case SMB_OFF_T is 64 bits, * and the underlying system can handle 64 bit signed locks. @@ -109,18 +107,7 @@ static bool posix_lock_in_range(SMB_OFF_T *offset_out, SMB_OFF_T *count_out, SMB_OFF_T mask = (mask2<<1); SMB_OFF_T max_positive_lock_offset = ~mask; -#else /* !LARGE_SMB_OFF_T || HAVE_BROKEN_FCNTL64_LOCKS */ - - /* - * In this case either SMB_OFF_T is 32 bits, - * or the underlying system cannot handle 64 bit signed locks. - * All offsets & counts must be 2^31 or less. - */ - - SMB_OFF_T max_positive_lock_offset = 0x7FFFFFFF; - -#endif /* !LARGE_SMB_OFF_T || HAVE_BROKEN_FCNTL64_LOCKS */ - +#endif /* * POSIX locks of length zero mean lock to end-of-file. * Win32 locks of length zero are point probes. Ignore diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 884731088a9..8cefba0dfcf 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -3207,28 +3207,9 @@ void reply_readbraw(struct smb_request *req) /* * This is a large offset (64 bit) read. */ -#ifdef LARGE_SMB_OFF_T startpos |= (((SMB_OFF_T)IVAL(req->vwv+8, 0)) << 32); -#else /* !LARGE_SMB_OFF_T */ - - /* - * Ensure we haven't been sent a >32 bit offset. - */ - - if(IVAL(req->vwv+8, 0) != 0) { - DEBUG(0,("reply_readbraw: large offset " - "(%x << 32) used and we don't support " - "64 bit offsets.\n", - (unsigned int)IVAL(req->vwv+8, 0) )); - reply_readbraw_error(sconn); - END_PROFILE(SMBreadbraw); - return; - } - -#endif /* LARGE_SMB_OFF_T */ - if(startpos < 0) { DEBUG(0,("reply_readbraw: negative 64 bit " "readraw offset (%.0f) !\n", @@ -3796,29 +3777,11 @@ void reply_read_and_X(struct smb_request *req) } if (req->wct == 12) { -#ifdef LARGE_SMB_OFF_T /* * This is a large offset (64 bit) read. */ startpos |= (((SMB_OFF_T)IVAL(req->vwv+10, 0)) << 32); -#else /* !LARGE_SMB_OFF_T */ - - /* - * Ensure we haven't been sent a >32 bit offset. - */ - - if(IVAL(req->vwv+10, 0) != 0) { - DEBUG(0,("reply_read_and_X - large offset (%x << 32) " - "used and we don't support 64 bit offsets.\n", - (unsigned int)IVAL(req->vwv+10, 0) )); - END_PROFILE(SMBreadX); - reply_nterror(req, NT_STATUS_ACCESS_DENIED); - return; - } - -#endif /* LARGE_SMB_OFF_T */ - } if (!big_readX) { @@ -4556,27 +4519,11 @@ void reply_write_and_X(struct smb_request *req) data = smb_base(req->inbuf) + smb_doff; if(req->wct == 14) { -#ifdef LARGE_SMB_OFF_T /* * This is a large offset (64 bit) write. */ startpos |= (((SMB_OFF_T)IVAL(req->vwv+12, 0)) << 32); -#else /* !LARGE_SMB_OFF_T */ - - /* - * Ensure we haven't been sent a >32 bit offset. - */ - - if(IVAL(req->vwv+12, 0) != 0) { - DEBUG(0,("reply_write_and_X - large offset (%x << 32) " - "used and we don't support 64 bit offsets.\n", - (unsigned int)IVAL(req->vwv+12, 0) )); - reply_nterror(req, NT_STATUS_ACCESS_DENIED); - goto out; - } - -#endif /* LARGE_SMB_OFF_T */ } /* X/Open SMB protocol says that, unlike SMBwrite diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index da552f5a51a..40a1a5dc80f 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -5913,14 +5913,7 @@ static NTSTATUS smb_file_position_information(connection_struct *conn, } position_information = (uint64_t)IVAL(pdata,0); -#ifdef LARGE_SMB_OFF_T position_information |= (((uint64_t)IVAL(pdata,4)) << 32); -#else /* LARGE_SMB_OFF_T */ - if (IVAL(pdata,4) != 0) { - /* more than 32 bits? */ - return NT_STATUS_INVALID_PARAMETER; - } -#endif /* LARGE_SMB_OFF_T */ DEBUG(10,("smb_file_position_information: Set file position " "information for file %s to %.0f\n", fsp_str_dbg(fsp), @@ -6671,15 +6664,7 @@ static NTSTATUS smb_set_file_allocation_info(connection_struct *conn, } allocation_size = (uint64_t)IVAL(pdata,0); -#ifdef LARGE_SMB_OFF_T allocation_size |= (((uint64_t)IVAL(pdata,4)) << 32); -#else /* LARGE_SMB_OFF_T */ - if (IVAL(pdata,4) != 0) { - /* more than 32 bits? */ - return NT_STATUS_INVALID_PARAMETER; - } -#endif /* LARGE_SMB_OFF_T */ - DEBUG(10,("smb_set_file_allocation_info: Set file allocation info for " "file %s to %.0f\n", smb_fname_str_dbg(smb_fname), (double)allocation_size)); @@ -6777,14 +6762,7 @@ static NTSTATUS smb_set_file_end_of_file_info(connection_struct *conn, } size = IVAL(pdata,0); -#ifdef LARGE_SMB_OFF_T size |= (((SMB_OFF_T)IVAL(pdata,4)) << 32); -#else /* LARGE_SMB_OFF_T */ - if (IVAL(pdata,4) != 0) { - /* more than 32 bits? */ - return NT_STATUS_INVALID_PARAMETER; - } -#endif /* LARGE_SMB_OFF_T */ DEBUG(10,("smb_set_file_end_of_file_info: Set end of file info for " "file %s to %.0f\n", smb_fname_str_dbg(smb_fname), (double)size)); @@ -6917,14 +6895,7 @@ static NTSTATUS smb_set_file_unix_basic(connection_struct *conn, if(IVAL(pdata, 0) != SMB_SIZE_NO_CHANGE_LO && IVAL(pdata, 4) != SMB_SIZE_NO_CHANGE_HI) { size=IVAL(pdata,0); /* first 8 Bytes are size */ -#ifdef LARGE_SMB_OFF_T size |= (((SMB_OFF_T)IVAL(pdata,4)) << 32); -#else /* LARGE_SMB_OFF_T */ - if (IVAL(pdata,4) != 0) { - /* more than 32 bits? */ - return NT_STATUS_INVALID_PARAMETER; - } -#endif /* LARGE_SMB_OFF_T */ } ft.atime = interpret_long_date(pdata+24); /* access_time */ -- 2.34.1