summaryrefslogtreecommitdiff
path: root/source3/wscript
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2012-04-06 14:20:12 -0700
committerJeremy Allison <jra@samba.org>2012-04-06 14:20:12 -0700
commita92c532573b293f5c0ed4a386c866bc9a3dbeef3 (patch)
tree75fbd0f91fc7cd5b577244eaad44bacdd6f12c2e /source3/wscript
parent189b3d9b24bf553ff7096397c389f20ba99e0dfa (diff)
downloadsamba-a92c532573b293f5c0ed4a386c866bc9a3dbeef3.tar.gz
samba-a92c532573b293f5c0ed4a386c866bc9a3dbeef3.tar.bz2
samba-a92c532573b293f5c0ed4a386c866bc9a3dbeef3.zip
Bug found by Herb. blkcnt_t st_ex_blksize is defined as a signed value. When it is
on a 32-bit system and defined as a long, then inside vfswrap_get_alloc_size() we cast to a uint64_t. This sign-extends when converting to unsigned, so if the high bit of st_ex_blksize is set we return insane values to clients.
Diffstat (limited to 'source3/wscript')
-rw-r--r--source3/wscript14
1 files changed, 14 insertions, 0 deletions
diff --git a/source3/wscript b/source3/wscript
index 9a9757a7b2..28ef0d932f 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -174,6 +174,20 @@ main() {
conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_flags', define='HAVE_STAT_ST_FLAGS',
headers='sys/types.h sys/stat.h unistd.h')
+ if "HAVE_BLKCNT_T" in conf.env:
+ conf.CHECK_CODE('''
+ return sizeof(blkcnt_t) == 4 ? 0 : 1''',
+ 'SIZEOF_BLKCNT_T_4', execute=True,
+ headers='sys/types.h sys/stat.h unistd.h',
+ msg="Checking whether blkcnt_t is 32 bit")
+
+ if "HAVE_BLKCNT_T" in conf.env:
+ conf.CHECK_CODE('''
+ return sizeof(blkcnt_t) == 8 ? 0 : 1''',
+ 'SIZEOF_BLKCNT_T_8', execute=True,
+ headers='sys/types.h sys/stat.h unistd.h',
+ msg="Checking whether blkcnt_t is 64 bit")
+
# Check for POSIX capability support
conf.CHECK_FUNCS_IN('cap_get_proc', 'cap', headers='sys/capability.h')