Correct test for native largefiles. We need big unsigned long as well

This commit is contained in:
Radim Kolar 2020-06-06 10:38:20 +02:00
parent d21ae4b085
commit f8bc2da042
4 changed files with 13 additions and 8 deletions

View File

@ -12,6 +12,9 @@ Version NEXT
inetd to work correctly using fspd socket activation. inetd to work correctly using fspd socket activation.
fspd exits with err 8 if can't write pidfile after forking 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 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 Version 2.8.1b29 - 24 Aug 2019
added scons command line argument without-fspscan=yes for building added scons command line argument without-fspscan=yes for building

View File

@ -84,7 +84,8 @@ conf = Configure(env,{'checkForCCOption':checkForCCOption,
'checkForBuildingServer':checkForBuildingServer, 'checkForBuildingServer':checkForBuildingServer,
'checkForBuildingFspscan':checkForBuildingFspscan, 'checkForBuildingFspscan':checkForBuildingFspscan,
'checkDSSSLProcessor':checkDSSSLProcessor, 'checkDSSSLProcessor':checkDSSSLProcessor,
'findDocbookStylesheets':findDocbookStylesheets 'findDocbookStylesheets':findDocbookStylesheets,
'checkForLargeFiles':enableLargeFiles
}) })
if not conf.CheckCC(): Exit(1) if not conf.CheckCC(): Exit(1)
# check for CC options # check for CC options
@ -143,7 +144,7 @@ if conf.CheckCHeader('utmpx.h'):
conf.env.Append(CPPFLAGS = '-DHAVE_UTMPX_H') conf.env.Append(CPPFLAGS = '-DHAVE_UTMPX_H')
if not conf.CheckType("union semun", "#include <sys/types.h>\n#include <sys/ipc.h>\n#include <sys/sem.h>",'c'): if not conf.CheckType("union semun", "#include <sys/types.h>\n#include <sys/ipc.h>\n#include <sys/sem.h>",'c'):
conf.env.Append(CPPFLAGS = "-D_SEM_SEMUN_UNDEFINED=1") conf.env.Append(CPPFLAGS = "-D_SEM_SEMUN_UNDEFINED=1")
enableLargeFiles(conf) conf.checkForLargeFiles(conf)
conf.checkForLockingType(conf) conf.checkForLockingType(conf)
if conf.checkReliableSignals(): if conf.checkReliableSignals():
conf.env.Append(CPPFLAGS = '-DRELIABLE_SIGNALS') conf.env.Append(CPPFLAGS = '-DRELIABLE_SIGNALS')

1
TODO
View File

@ -12,7 +12,6 @@ TESTSUITE NEEDED:
Write a simple FSP protocol test suite using one Write a simple FSP protocol test suite using one
of its client libraries (Java, C, Python, Perl) of its client libraries (Java, C, Python, Perl)
automatic test for remote buffer overflows automatic test for remote buffer overflows
Test if >2GB files but <4GB works correctly with and without --disable-largefile
POSSIBLE SECURITY BUG: POSSIBLE SECURITY BUG:
symlink to FILE can escape from FSP root directory. OLD known problem. symlink to FILE can escape from FSP root directory. OLD known problem.

View File

@ -1,16 +1,17 @@
# #
# SCons Largefile enablement # SCons Largefile enablement
# #
# Version 1.2 # Version 1.3
# 16-Aug-2019 # 06-Jun-2020
# #
def enableLargeFiles(conf): def enableLargeFiles(check,conf):
"""Tries to enable 64-bit off_t on linux platform""" """Tries to enable 64-bit off_t on linux platform"""
fseeko=conf.CheckFunc('fseeko') fseeko=conf.CheckFunc('fseeko')
if fseeko: if fseeko:
conf.env.Append(CPPFLAGS = '-DHAVE_FSEEKO') conf.env.Append(CPPFLAGS = '-DHAVE_FSEEKO')
offt=conf.CheckTypeSize('off_t','#include <stdio.h>\n#include <sys/types.h>') offt=conf.CheckTypeSize('off_t','#include <stdio.h>\n#include <sys/types.h>')
ulong=conf.CheckTypeSize('unsigned long')
if offt<8 and offt>0: if offt<8 and offt>0:
flags=conf.env.Dictionary()['CPPFLAGS'] flags=conf.env.Dictionary()['CPPFLAGS']
conf.env.Append(CPPFLAGS='-D_FILE_OFFSET_BITS=64') conf.env.Append(CPPFLAGS='-D_FILE_OFFSET_BITS=64')
@ -22,9 +23,10 @@ def enableLargeFiles(conf):
#set default value to 4 #set default value to 4
offt=4 offt=4
conf.env.Append(CPPFLAGS = '-DSIZEOF_OFF_T='+str(offt)) 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') conf.env.Append(CPPFLAGS = '-DNATIVE_LARGEFILES')
rc=True rc=True
else: else:
rc=False rc=False
return rc check.Result(rc)