From f8bc2da0426f6a103ba5f0b57910fa90c855aa7d Mon Sep 17 00:00:00 2001 From: Radim Kolar Date: Sat, 6 Jun 2020 10:38:20 +0200 Subject: [PATCH] Correct test for native largefiles. We need big unsigned long as well --- ChangeLog | 3 +++ SConstruct | 5 +++-- TODO | 1 - site_scons/largefiles.py | 12 +++++++----- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 81c9f2a..5a29787 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,9 @@ Version NEXT inetd to work correctly using fspd socket activation. fspd exits with err 8 if can't write pidfile after forking add error exit 9 if fspd can't send back reply to client + correct check for native largefiles. Because we are using unsigned + long internaly as pointer to offset for portability, we have to + be sure that usingned long is 8 or more bytes long Version 2.8.1b29 - 24 Aug 2019 added scons command line argument without-fspscan=yes for building diff --git a/SConstruct b/SConstruct index 3b9e221..a918151 100644 --- a/SConstruct +++ b/SConstruct @@ -84,7 +84,8 @@ conf = Configure(env,{'checkForCCOption':checkForCCOption, 'checkForBuildingServer':checkForBuildingServer, 'checkForBuildingFspscan':checkForBuildingFspscan, 'checkDSSSLProcessor':checkDSSSLProcessor, - 'findDocbookStylesheets':findDocbookStylesheets + 'findDocbookStylesheets':findDocbookStylesheets, + 'checkForLargeFiles':enableLargeFiles }) if not conf.CheckCC(): Exit(1) # check for CC options @@ -143,7 +144,7 @@ if conf.CheckCHeader('utmpx.h'): conf.env.Append(CPPFLAGS = '-DHAVE_UTMPX_H') if not conf.CheckType("union semun", "#include \n#include \n#include ",'c'): conf.env.Append(CPPFLAGS = "-D_SEM_SEMUN_UNDEFINED=1") -enableLargeFiles(conf) +conf.checkForLargeFiles(conf) conf.checkForLockingType(conf) if conf.checkReliableSignals(): conf.env.Append(CPPFLAGS = '-DRELIABLE_SIGNALS') diff --git a/TODO b/TODO index daeec0d..98eb7e7 100644 --- a/TODO +++ b/TODO @@ -12,7 +12,6 @@ TESTSUITE NEEDED: Write a simple FSP protocol test suite using one of its client libraries (Java, C, Python, Perl) automatic test for remote buffer overflows -Test if >2GB files but <4GB works correctly with and without --disable-largefile POSSIBLE SECURITY BUG: symlink to FILE can escape from FSP root directory. OLD known problem. diff --git a/site_scons/largefiles.py b/site_scons/largefiles.py index 9b24ed4..9bd3064 100644 --- a/site_scons/largefiles.py +++ b/site_scons/largefiles.py @@ -1,16 +1,17 @@ # # SCons Largefile enablement # -# Version 1.2 -# 16-Aug-2019 +# Version 1.3 +# 06-Jun-2020 # -def enableLargeFiles(conf): +def enableLargeFiles(check,conf): """Tries to enable 64-bit off_t on linux platform""" fseeko=conf.CheckFunc('fseeko') if fseeko: conf.env.Append(CPPFLAGS = '-DHAVE_FSEEKO') offt=conf.CheckTypeSize('off_t','#include \n#include ') + ulong=conf.CheckTypeSize('unsigned long') if offt<8 and offt>0: flags=conf.env.Dictionary()['CPPFLAGS'] conf.env.Append(CPPFLAGS='-D_FILE_OFFSET_BITS=64') @@ -22,9 +23,10 @@ def enableLargeFiles(conf): #set default value to 4 offt=4 conf.env.Append(CPPFLAGS = '-DSIZEOF_OFF_T='+str(offt)) - if fseeko and int(offt)>=8: + check.Message("Checking if we have native large files ...") + if fseeko and int(offt)>=8 and int(ulong)>=8: conf.env.Append(CPPFLAGS = '-DNATIVE_LARGEFILES') rc=True else: rc=False - return rc + check.Result(rc)