From: Gustavo Zacarias Date: Thu, 15 Jan 2015 14:03:19 +0000 (-0300) Subject: samba4: security bump to version 4.1.16 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3ac6390abd6dd304987116bd35ee4f72361dbb12;p=buildroot.git samba4: security bump to version 4.1.16 Fixes CVE-2014-8143 - dsdb-samldb: Check for extended access rights before we allow changes to userAccountControl. Also rename patches to new naming convention. Signed-off-by: Gustavo Zacarias Signed-off-by: Thomas Petazzoni --- diff --git a/package/samba4/0001-build-find-FILE_OFFSET_BITS-via-array.patch b/package/samba4/0001-build-find-FILE_OFFSET_BITS-via-array.patch new file mode 100644 index 0000000000..8dae44ddbb --- /dev/null +++ b/package/samba4/0001-build-find-FILE_OFFSET_BITS-via-array.patch @@ -0,0 +1,56 @@ +From 16d88e7813a7739c070a7a1cf6388fd4f236fd99 Mon Sep 17 00:00:00 2001 +From: Gustavo Zacarias +Date: Fri, 31 Jan 2014 06:45:18 -0300 +Subject: [PATCHv2] build: find FILE_OFFSET_BITS via array + +This makes cross-compiling happy, use a trick similar to autoconf's +AC_CHECK_SIZEOF macro. +Basically we make an array: + +static int array[1 - 2 * !(((long int)(sizeof(off_t))) < 8)]; + +This gives -1 multiplied by the negation of the condition +(sizeof(off_t) < 8) cast to a long int. +So if the condition is true it gives array[(-1 * 0)] (remember the +condition is cast and negated) thus passing a build test with a 0-sized +array. +If it's false it gives array[(-1 * 1)] thus failing with a +negative-sized array. + +Status: Upstream. + +Signed-off-by: Gustavo Zacarias +--- + lib/ccan/wscript | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/lib/ccan/wscript b/lib/ccan/wscript +index 59b8205..81039d0 100644 +--- a/lib/ccan/wscript ++++ b/lib/ccan/wscript +@@ -127,15 +127,18 @@ def configure(conf): + # Only check for FILE_OFFSET_BITS=64 if off_t is normally small: + # use raw routines because wrappers include previous _GNU_SOURCE + # or _FILE_OFFSET_BITS defines. ++ # The math for these tests is: ++ # array[-1 * !((int)(condition)) ] (condition is true) = array[0] = builds ++ # array[-1 * !((int)(condition)) ] (condition is false) = array[-1] = fails + conf.check(fragment="""#include +- int main(void) { return !(sizeof(off_t) < 8); }""", +- execute=True, msg='Checking for small off_t', ++ int main(void) { static int test_array[1 - 2 * !(((long int)(sizeof(off_t))) < 8)]; }""", ++ msg='Checking for small off_t', + define_name='SMALL_OFF_T') + # Unreliable return value above, hence use define. + if conf.CONFIG_SET('SMALL_OFF_T'): + conf.check(fragment="""#include +- int main(void) { return !(sizeof(off_t) >= 8); }""", +- execute=True, msg='Checking for -D_FILE_OFFSET_BITS=64', ++ int main(void) { static int test_array[1 - 2 * !(((long int)(sizeof(off_t))) >= 8)]; }""", ++ msg='Checking for -D_FILE_OFFSET_BITS=64', + ccflags='-D_FILE_OFFSET_BITS=64', + define_name='HAVE_FILE_OFFSET_BITS') + +-- +1.8.3.2 + diff --git a/package/samba4/0002-build-allow-some-python-variable-overrides.patch b/package/samba4/0002-build-allow-some-python-variable-overrides.patch new file mode 100644 index 0000000000..91634b9005 --- /dev/null +++ b/package/samba4/0002-build-allow-some-python-variable-overrides.patch @@ -0,0 +1,47 @@ +From fdbdf04a9ab3f3a204e95106c4f8f6729d0bab1a Mon Sep 17 00:00:00 2001 +From: Gustavo Zacarias +Date: Tue, 4 Feb 2014 14:11:52 -0300 +Subject: [PATCH] build: allow some python variable overrides + +The python variables (settings) are fetched from a running python +interpreter which usually isn't the target one when cross compiling, +hence libraries and flags aren't the same and can pollute the target +build. +Allow some of these variables to be redefined via environment variables +in order to aid cross-compiling. +According to testing python_LDFLAGS and python_LIBDIR should be enough. + +Status: Upstream. + +Signed-off-by: Gustavo Zacarias +--- + buildtools/wafadmin/Tools/python.py | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/buildtools/wafadmin/Tools/python.py b/buildtools/wafadmin/Tools/python.py +index ab1e817..35c61c2 100644 +--- a/buildtools/wafadmin/Tools/python.py ++++ b/buildtools/wafadmin/Tools/python.py +@@ -193,6 +193,19 @@ MACOSX_DEPLOYMENT_TARGET = %r + """ % (python, python_prefix, python_SO, python_SYSLIBS, python_LDFLAGS, python_SHLIBS, + python_LIBDIR, python_LIBPL, INCLUDEPY, Py_ENABLE_SHARED, python_MACOSX_DEPLOYMENT_TARGET)) + ++ # Allow some python overrides from env vars for cross-compiling ++ os_env = dict(os.environ) ++ ++ override_python_LDFLAGS = os_env.get('python_LDFLAGS', None) ++ if override_python_LDFLAGS is not None: ++ conf.log.write("python_LDFLAGS override from environment = %r\n" % (override_python_LDFLAGS)) ++ python_LDFLAGS = override_python_LDFLAGS ++ ++ override_python_LIBDIR = os_env.get('python_LIBDIR', None) ++ if override_python_LIBDIR is not None: ++ conf.log.write("python_LIBDIR override from environment = %r\n" % (override_python_LIBDIR)) ++ python_LIBDIR = override_python_LIBDIR ++ + if python_MACOSX_DEPLOYMENT_TARGET: + conf.env['MACOSX_DEPLOYMENT_TARGET'] = python_MACOSX_DEPLOYMENT_TARGET + conf.environ['MACOSX_DEPLOYMENT_TARGET'] = python_MACOSX_DEPLOYMENT_TARGET +-- +1.8.3.2 + diff --git a/package/samba4/0003-build-find-blkcnt_t-size-via-array.patch b/package/samba4/0003-build-find-blkcnt_t-size-via-array.patch new file mode 100644 index 0000000000..f6e4d03668 --- /dev/null +++ b/package/samba4/0003-build-find-blkcnt_t-size-via-array.patch @@ -0,0 +1,54 @@ +From 934f8c8e9439de4f15b2e61016d5d29233d8d5fa Mon Sep 17 00:00:00 2001 +From: Gustavo Zacarias +Date: Wed, 16 Apr 2014 08:01:36 -0300 +Subject: [PATCH 5/5] build: find blkcnt_t size via array + +Using the same trick as commit 0d9bb86293c9d39298786df095c73a6251b08b7e +find blkcnt_t size via an array so that it can be determined via build +rather than running it. + +Status: Upstream. + +Signed-off-by: Gustavo Zacarias +--- + source3/wscript | 22 ++++++++++++---------- + 1 file changed, 12 insertions(+), 10 deletions(-) + +diff --git a/source3/wscript b/source3/wscript +index aade503..6a5728f 100644 +--- a/source3/wscript ++++ b/source3/wscript +@@ -277,18 +277,20 @@ int main(int argc, char **argv) + 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='replace.h sys/types.h sys/stat.h unistd.h', +- msg="Checking whether blkcnt_t is 32 bit") ++ conf.CHECK_CODE(''' ++ static int test_array[1 - 2 * !(((long int)(sizeof(blkcnt_t))) <= 4)];''', ++ 'SIZEOF_BLKCNT_T_4', ++ headers='replace.h sys/types.h sys/stat.h unistd.h', ++ msg="Checking whether blkcnt_t is 32 bit") + ++ # If sizeof is 4 it can't be 8 + if "HAVE_BLKCNT_T" in conf.env: +- conf.CHECK_CODE(''' +- return sizeof(blkcnt_t) == 8 ? 0 : 1''', +- 'SIZEOF_BLKCNT_T_8', execute=True, +- headers='replace.h sys/types.h sys/stat.h unistd.h', +- msg="Checking whether blkcnt_t is 64 bit") ++ if not conf.CONFIG_SET('SIZEOF_BLKCNT_T_4'): ++ conf.CHECK_CODE(''' ++ static int test_array[1 - 2 * !(((long int)(sizeof(blkcnt_t))) <= 8)];''', ++ 'SIZEOF_BLKCNT_T_8', ++ headers='replace.h 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') +-- +1.8.3.2 + diff --git a/package/samba4/0004-build-unify-and-fix-endian-tests.patch b/package/samba4/0004-build-unify-and-fix-endian-tests.patch new file mode 100644 index 0000000000..3fdfe6e742 --- /dev/null +++ b/package/samba4/0004-build-unify-and-fix-endian-tests.patch @@ -0,0 +1,165 @@ +From ee4e06b7223fb2925bc887c89216a66029d44862 Mon Sep 17 00:00:00 2001 +From: Gustavo Zacarias +Date: Tue, 1 Apr 2014 06:41:47 -0300 +Subject: [PATCH 2/5] build: unify and fix endian tests + +Unify the endian tests out of lib/ccan/wscript into wafsamba since +they're almost cross-compile friendly. +While at it fix them to be so by moving the preprocessor directives out +of main scope since that will fail. +And keep the WORDS_BIGENDIAN, HAVE_LITTLE_ENDIAN and HAVE_BIG_ENDIAN +defines separate because of different codebases. + +Status: Upstream. + +Signed-off-by: Gustavo Zacarias +--- + buildtools/wafsamba/wscript | 65 ++++++++++++++++++++++++++++++++++++++++++--- + lib/ccan/wscript | 55 -------------------------------------- + 2 files changed, 62 insertions(+), 58 deletions(-) + +diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript +index 7984227..1a2cfe6 100755 +--- a/buildtools/wafsamba/wscript ++++ b/buildtools/wafsamba/wscript +@@ -390,9 +390,68 @@ def configure(conf): + else: + conf.define('SHLIBEXT', "so", quote=True) + +- conf.CHECK_CODE('long one = 1; return ((char *)(&one))[0]', +- execute=True, +- define='WORDS_BIGENDIAN') ++ # First try a header check for cross-compile friendlyness ++ conf.CHECK_CODE(code = """#ifdef __BYTE_ORDER ++ #define B __BYTE_ORDER ++ #elif defined(BYTE_ORDER) ++ #define B BYTE_ORDER ++ #endif ++ ++ #ifdef __LITTLE_ENDIAN ++ #define LITTLE __LITTLE_ENDIAN ++ #elif defined(LITTLE_ENDIAN) ++ #define LITTLE LITTLE_ENDIAN ++ #endif ++ ++ #if !defined(LITTLE) || !defined(B) || LITTLE != B ++ #error Not little endian. ++ #endif ++ int main(void) { return 0; }""", ++ addmain=False, ++ headers="endian.h sys/endian.h", ++ define="HAVE_LITTLE_ENDIAN") ++ conf.CHECK_CODE(code = """#ifdef __BYTE_ORDER ++ #define B __BYTE_ORDER ++ #elif defined(BYTE_ORDER) ++ #define B BYTE_ORDER ++ #endif ++ ++ #ifdef __BIG_ENDIAN ++ #define BIG __BIG_ENDIAN ++ #elif defined(BIG_ENDIAN) ++ #define BIG BIG_ENDIAN ++ #endif ++ ++ #if !defined(BIG) || !defined(B) || BIG != B ++ #error Not big endian. ++ #endif ++ int main(void) { return 0; }""", ++ addmain=False, ++ headers="endian.h sys/endian.h", ++ define="HAVE_BIG_ENDIAN") ++ ++ if not conf.CONFIG_SET("HAVE_BIG_ENDIAN") and not conf.CONFIG_SET("HAVE_LITTLE_ENDIAN"): ++ # That didn't work! Do runtime test. ++ conf.CHECK_CODE("""union { int i; char c[sizeof(int)]; } u; ++ u.i = 0x01020304; ++ return u.c[0] == 0x04 && u.c[1] == 0x03 && u.c[2] == 0x02 && u.c[3] == 0x01 ? 0 : 1;""", ++ addmain=True, execute=True, ++ define='HAVE_LITTLE_ENDIAN', ++ msg="Checking for HAVE_LITTLE_ENDIAN - runtime") ++ conf.CHECK_CODE("""union { int i; char c[sizeof(int)]; } u; ++ u.i = 0x01020304; ++ return u.c[0] == 0x01 && u.c[1] == 0x02 && u.c[2] == 0x03 && u.c[3] == 0x04 ? 0 : 1;""", ++ addmain=True, execute=True, ++ define='HAVE_BIG_ENDIAN', ++ msg="Checking for HAVE_BIG_ENDIAN - runtime") ++ ++ # Extra sanity check. ++ if conf.CONFIG_SET("HAVE_BIG_ENDIAN") == conf.CONFIG_SET("HAVE_LITTLE_ENDIAN"): ++ Logs.error("Failed endian determination. The PDP-11 is back?") ++ sys.exit(1) ++ else: ++ if conf.CONFIG_SET("HAVE_BIG_ENDIAN"): ++ conf.DEFINE('WORDS_BIGENDIAN', 1) + + # check if signal() takes a void function + if conf.CHECK_CODE('return *(signal (0, 0)) (0) == 1', +diff --git a/lib/ccan/wscript b/lib/ccan/wscript +index 1c5f337..0e540db 100644 +--- a/lib/ccan/wscript ++++ b/lib/ccan/wscript +@@ -25,61 +25,6 @@ def configure(conf): + conf.CHECK_CODE('int __attribute__((used)) func(int x) { return x; }', + addmain=False, link=False, cflags=conf.env['WERROR_CFLAGS'], + define='HAVE_ATTRIBUTE_USED') +- # We try to use headers for a compile-time test. +- conf.CHECK_CODE(code = """#ifdef __BYTE_ORDER +- #define B __BYTE_ORDER +- #elif defined(BYTE_ORDER) +- #define B BYTE_ORDER +- #endif +- +- #ifdef __LITTLE_ENDIAN +- #define LITTLE __LITTLE_ENDIAN +- #elif defined(LITTLE_ENDIAN) +- #define LITTLE LITTLE_ENDIAN +- #endif +- +- #if !defined(LITTLE) || !defined(B) || LITTLE != B +- #error Not little endian. +- #endif""", +- headers="endian.h sys/endian.h", +- define="HAVE_LITTLE_ENDIAN") +- conf.CHECK_CODE(code = """#ifdef __BYTE_ORDER +- #define B __BYTE_ORDER +- #elif defined(BYTE_ORDER) +- #define B BYTE_ORDER +- #endif +- +- #ifdef __BIG_ENDIAN +- #define BIG __BIG_ENDIAN +- #elif defined(BIG_ENDIAN) +- #define BIG BIG_ENDIAN +- #endif +- +- #if !defined(BIG) || !defined(B) || BIG != B +- #error Not big endian. +- #endif""", +- headers="endian.h sys/endian.h", +- define="HAVE_BIG_ENDIAN") +- +- if not conf.CONFIG_SET("HAVE_BIG_ENDIAN") and not conf.CONFIG_SET("HAVE_LITTLE_ENDIAN"): +- # That didn't work! Do runtime test. +- conf.CHECK_CODE("""union { int i; char c[sizeof(int)]; } u; +- u.i = 0x01020304; +- return u.c[0] == 0x04 && u.c[1] == 0x03 && u.c[2] == 0x02 && u.c[3] == 0x01 ? 0 : 1;""", +- addmain=True, execute=True, +- define='HAVE_LITTLE_ENDIAN', +- msg="Checking for HAVE_LITTLE_ENDIAN - runtime") +- conf.CHECK_CODE("""union { int i; char c[sizeof(int)]; } u; +- u.i = 0x01020304; +- return u.c[0] == 0x01 && u.c[1] == 0x02 && u.c[2] == 0x03 && u.c[3] == 0x04 ? 0 : 1;""", +- addmain=True, execute=True, +- define='HAVE_BIG_ENDIAN', +- msg="Checking for HAVE_BIG_ENDIAN - runtime") +- +- # Extra sanity check. +- if conf.CONFIG_SET("HAVE_BIG_ENDIAN") == conf.CONFIG_SET("HAVE_LITTLE_ENDIAN"): +- Logs.error("Failed endian determination. The PDP-11 is back?") +- sys.exit(1) + + conf.CHECK_CODE('return __builtin_choose_expr(1, 0, "garbage");', + link=True, +-- +1.8.3.2 + diff --git a/package/samba4/0005-build-make-wafsamba-CHECK_SIZEOF-cross-compile-friendl.patch b/package/samba4/0005-build-make-wafsamba-CHECK_SIZEOF-cross-compile-friendl.patch new file mode 100644 index 0000000000..72176cbe16 --- /dev/null +++ b/package/samba4/0005-build-make-wafsamba-CHECK_SIZEOF-cross-compile-friendl.patch @@ -0,0 +1,68 @@ +From fd3eb1e9f712e4c96c0b55d4203745afb2bcc8c2 Mon Sep 17 00:00:00 2001 +From: Gustavo Zacarias +Date: Wed, 9 Apr 2014 10:21:59 -0300 +Subject: [PATCH 3/5] build: make wafsamba CHECK_SIZEOF cross-compile friendly + +Use the same trick as commit 0d9bb86293c9d39298786df095c73a6251b08b7e +We do the same array trick iteratively starting from 1 (byte) by powers +of 2 up to 32. + +The new 'critical' option is used to make the invocation die or not +according to each test. +The default is True since normally it's expected to find a proper +result and should error out if not. + +Status: Upstream. + +Signed-off-by: Gustavo Zacarias +--- + buildtools/wafsamba/samba_autoconf.py | 28 ++++++++++++++++------------ + 1 file changed, 16 insertions(+), 12 deletions(-) + +diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py +index 59d9e79..f60ce9d 100644 +--- a/buildtools/wafsamba/samba_autoconf.py ++++ b/buildtools/wafsamba/samba_autoconf.py +@@ -304,23 +304,27 @@ def CHECK_FUNCS(conf, list, link=True, lib=None, headers=None): + + + @conf +-def CHECK_SIZEOF(conf, vars, headers=None, define=None): ++def CHECK_SIZEOF(conf, vars, headers=None, define=None, critical=True): + '''check the size of a type''' +- ret = True + for v in TO_LIST(vars): + v_define = define ++ ret = False + if v_define is None: + v_define = 'SIZEOF_%s' % v.upper().replace(' ', '_') +- if not CHECK_CODE(conf, +- 'printf("%%u", (unsigned)sizeof(%s))' % v, +- define=v_define, +- execute=True, +- define_ret=True, +- quote=False, +- headers=headers, +- local_include=False, +- msg="Checking size of %s" % v): +- ret = False ++ for size in list((1, 2, 4, 8, 16, 32)): ++ if CHECK_CODE(conf, ++ 'static int test_array[1 - 2 * !(((long int)(sizeof(%s))) <= %d)];' % (v, size), ++ define=v_define, ++ quote=False, ++ headers=headers, ++ local_include=False, ++ msg="Checking if size of %s == %d" % (v, size)): ++ conf.DEFINE(v_define, size) ++ ret = True ++ break ++ if not ret and critical: ++ Logs.error("Couldn't determine size of '%s'" % v) ++ sys.exit(1) + return ret + + @conf +-- +1.8.3.2 + diff --git a/package/samba4/0006-build-tweak-SIZEOF-utmp-ut_line.patch b/package/samba4/0006-build-tweak-SIZEOF-utmp-ut_line.patch new file mode 100644 index 0000000000..28f5f10a67 --- /dev/null +++ b/package/samba4/0006-build-tweak-SIZEOF-utmp-ut_line.patch @@ -0,0 +1,33 @@ +From 1a7f4f5e3fbbe83e147fffdfe00d7f37181a8ec1 Mon Sep 17 00:00:00 2001 +From: Gustavo Zacarias +Date: Wed, 9 Apr 2014 10:39:06 -0300 +Subject: [PATCH 4/5] build: tweak SIZEOF utmp->ut_line + +Set the critical parameter of CHECK_SIZEOF utmp->ut_line to False since +it's used to find out if utmp support should be enabled. +This is necessary with the introduction of the cross-compile aware +CHECK_SIZEOF. + +Status: Upstream. + +Signed-off-by: Gustavo Zacarias +--- + source3/wscript | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/source3/wscript b/source3/wscript +index e81a47b..aade503 100644 +--- a/source3/wscript ++++ b/source3/wscript +@@ -812,7 +812,7 @@ msg.msg_acctrightslen = sizeof(fd); + 'PUTUTLINE_RETURNS_UTMP', headers='utmp.h', + msg="Checking whether pututline returns pointer") + conf.CHECK_SIZEOF(['((struct utmp *)NULL)->ut_line'], headers='utmp.h', +- define='SIZEOF_UTMP_UT_LINE') ++ define='SIZEOF_UTMP_UT_LINE', critical=False) + if not conf.CONFIG_SET('SIZEOF_UTMP_UT_LINE'): + conf.env.with_utmp = False + elif int(conf.env.SIZEOF_UTMP_UT_LINE) < 15: +-- +1.8.3.2 + diff --git a/package/samba4/0007-disable-libbsd.patch b/package/samba4/0007-disable-libbsd.patch new file mode 100644 index 0000000000..b29a812012 --- /dev/null +++ b/package/samba4/0007-disable-libbsd.patch @@ -0,0 +1,26 @@ +Disable libbsd support, samba4 uses a global config.h for its own +codebase and that of heimdal (when building with builtin). +This causes redefinition conflicts for link(2) when both standard unistd.h +and bsd/unistd.h get included. + +Signed-off-by: Gustavo Zacarias + +diff -Nura samba-4.1.7.orig/lib/replace/wscript samba-4.1.7/lib/replace/wscript +--- samba-4.1.7.orig/lib/replace/wscript 2014-04-17 04:59:14.000000000 -0300 ++++ samba-4.1.7/lib/replace/wscript 2014-05-19 09:17:25.561947774 -0300 +@@ -253,15 +253,6 @@ + conf.CHECK_FUNCS('strtouq strtoll __strtoll strtoq memalign posix_memalign') + conf.CHECK_FUNCS('prctl') + +- # libbsd on some platforms provides strlcpy and strlcat +- if not conf.CHECK_FUNCS('strlcpy strlcat'): +- conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h', +- checklibc=True) +- if not conf.CHECK_FUNCS('getpeereid'): +- conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h') +- if not conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h'): +- conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h') +- + conf.CHECK_CODE(''' + struct ucred cred; + socklen_t cred_len; diff --git a/package/samba4/samba4-0003-build-find-FILE_OFFSET_BITS-via-array.patch b/package/samba4/samba4-0003-build-find-FILE_OFFSET_BITS-via-array.patch deleted file mode 100644 index 8dae44ddbb..0000000000 --- a/package/samba4/samba4-0003-build-find-FILE_OFFSET_BITS-via-array.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 16d88e7813a7739c070a7a1cf6388fd4f236fd99 Mon Sep 17 00:00:00 2001 -From: Gustavo Zacarias -Date: Fri, 31 Jan 2014 06:45:18 -0300 -Subject: [PATCHv2] build: find FILE_OFFSET_BITS via array - -This makes cross-compiling happy, use a trick similar to autoconf's -AC_CHECK_SIZEOF macro. -Basically we make an array: - -static int array[1 - 2 * !(((long int)(sizeof(off_t))) < 8)]; - -This gives -1 multiplied by the negation of the condition -(sizeof(off_t) < 8) cast to a long int. -So if the condition is true it gives array[(-1 * 0)] (remember the -condition is cast and negated) thus passing a build test with a 0-sized -array. -If it's false it gives array[(-1 * 1)] thus failing with a -negative-sized array. - -Status: Upstream. - -Signed-off-by: Gustavo Zacarias ---- - lib/ccan/wscript | 11 +++++++---- - 1 file changed, 7 insertions(+), 4 deletions(-) - -diff --git a/lib/ccan/wscript b/lib/ccan/wscript -index 59b8205..81039d0 100644 ---- a/lib/ccan/wscript -+++ b/lib/ccan/wscript -@@ -127,15 +127,18 @@ def configure(conf): - # Only check for FILE_OFFSET_BITS=64 if off_t is normally small: - # use raw routines because wrappers include previous _GNU_SOURCE - # or _FILE_OFFSET_BITS defines. -+ # The math for these tests is: -+ # array[-1 * !((int)(condition)) ] (condition is true) = array[0] = builds -+ # array[-1 * !((int)(condition)) ] (condition is false) = array[-1] = fails - conf.check(fragment="""#include -- int main(void) { return !(sizeof(off_t) < 8); }""", -- execute=True, msg='Checking for small off_t', -+ int main(void) { static int test_array[1 - 2 * !(((long int)(sizeof(off_t))) < 8)]; }""", -+ msg='Checking for small off_t', - define_name='SMALL_OFF_T') - # Unreliable return value above, hence use define. - if conf.CONFIG_SET('SMALL_OFF_T'): - conf.check(fragment="""#include -- int main(void) { return !(sizeof(off_t) >= 8); }""", -- execute=True, msg='Checking for -D_FILE_OFFSET_BITS=64', -+ int main(void) { static int test_array[1 - 2 * !(((long int)(sizeof(off_t))) >= 8)]; }""", -+ msg='Checking for -D_FILE_OFFSET_BITS=64', - ccflags='-D_FILE_OFFSET_BITS=64', - define_name='HAVE_FILE_OFFSET_BITS') - --- -1.8.3.2 - diff --git a/package/samba4/samba4-0004-build-allow-some-python-variable-overrides.patch b/package/samba4/samba4-0004-build-allow-some-python-variable-overrides.patch deleted file mode 100644 index 91634b9005..0000000000 --- a/package/samba4/samba4-0004-build-allow-some-python-variable-overrides.patch +++ /dev/null @@ -1,47 +0,0 @@ -From fdbdf04a9ab3f3a204e95106c4f8f6729d0bab1a Mon Sep 17 00:00:00 2001 -From: Gustavo Zacarias -Date: Tue, 4 Feb 2014 14:11:52 -0300 -Subject: [PATCH] build: allow some python variable overrides - -The python variables (settings) are fetched from a running python -interpreter which usually isn't the target one when cross compiling, -hence libraries and flags aren't the same and can pollute the target -build. -Allow some of these variables to be redefined via environment variables -in order to aid cross-compiling. -According to testing python_LDFLAGS and python_LIBDIR should be enough. - -Status: Upstream. - -Signed-off-by: Gustavo Zacarias ---- - buildtools/wafadmin/Tools/python.py | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - -diff --git a/buildtools/wafadmin/Tools/python.py b/buildtools/wafadmin/Tools/python.py -index ab1e817..35c61c2 100644 ---- a/buildtools/wafadmin/Tools/python.py -+++ b/buildtools/wafadmin/Tools/python.py -@@ -193,6 +193,19 @@ MACOSX_DEPLOYMENT_TARGET = %r - """ % (python, python_prefix, python_SO, python_SYSLIBS, python_LDFLAGS, python_SHLIBS, - python_LIBDIR, python_LIBPL, INCLUDEPY, Py_ENABLE_SHARED, python_MACOSX_DEPLOYMENT_TARGET)) - -+ # Allow some python overrides from env vars for cross-compiling -+ os_env = dict(os.environ) -+ -+ override_python_LDFLAGS = os_env.get('python_LDFLAGS', None) -+ if override_python_LDFLAGS is not None: -+ conf.log.write("python_LDFLAGS override from environment = %r\n" % (override_python_LDFLAGS)) -+ python_LDFLAGS = override_python_LDFLAGS -+ -+ override_python_LIBDIR = os_env.get('python_LIBDIR', None) -+ if override_python_LIBDIR is not None: -+ conf.log.write("python_LIBDIR override from environment = %r\n" % (override_python_LIBDIR)) -+ python_LIBDIR = override_python_LIBDIR -+ - if python_MACOSX_DEPLOYMENT_TARGET: - conf.env['MACOSX_DEPLOYMENT_TARGET'] = python_MACOSX_DEPLOYMENT_TARGET - conf.environ['MACOSX_DEPLOYMENT_TARGET'] = python_MACOSX_DEPLOYMENT_TARGET --- -1.8.3.2 - diff --git a/package/samba4/samba4-0005-build-find-blkcnt_t-size-via-array.patch b/package/samba4/samba4-0005-build-find-blkcnt_t-size-via-array.patch deleted file mode 100644 index f6e4d03668..0000000000 --- a/package/samba4/samba4-0005-build-find-blkcnt_t-size-via-array.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 934f8c8e9439de4f15b2e61016d5d29233d8d5fa Mon Sep 17 00:00:00 2001 -From: Gustavo Zacarias -Date: Wed, 16 Apr 2014 08:01:36 -0300 -Subject: [PATCH 5/5] build: find blkcnt_t size via array - -Using the same trick as commit 0d9bb86293c9d39298786df095c73a6251b08b7e -find blkcnt_t size via an array so that it can be determined via build -rather than running it. - -Status: Upstream. - -Signed-off-by: Gustavo Zacarias ---- - source3/wscript | 22 ++++++++++++---------- - 1 file changed, 12 insertions(+), 10 deletions(-) - -diff --git a/source3/wscript b/source3/wscript -index aade503..6a5728f 100644 ---- a/source3/wscript -+++ b/source3/wscript -@@ -277,18 +277,20 @@ int main(int argc, char **argv) - 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='replace.h sys/types.h sys/stat.h unistd.h', -- msg="Checking whether blkcnt_t is 32 bit") -+ conf.CHECK_CODE(''' -+ static int test_array[1 - 2 * !(((long int)(sizeof(blkcnt_t))) <= 4)];''', -+ 'SIZEOF_BLKCNT_T_4', -+ headers='replace.h sys/types.h sys/stat.h unistd.h', -+ msg="Checking whether blkcnt_t is 32 bit") - -+ # If sizeof is 4 it can't be 8 - if "HAVE_BLKCNT_T" in conf.env: -- conf.CHECK_CODE(''' -- return sizeof(blkcnt_t) == 8 ? 0 : 1''', -- 'SIZEOF_BLKCNT_T_8', execute=True, -- headers='replace.h sys/types.h sys/stat.h unistd.h', -- msg="Checking whether blkcnt_t is 64 bit") -+ if not conf.CONFIG_SET('SIZEOF_BLKCNT_T_4'): -+ conf.CHECK_CODE(''' -+ static int test_array[1 - 2 * !(((long int)(sizeof(blkcnt_t))) <= 8)];''', -+ 'SIZEOF_BLKCNT_T_8', -+ headers='replace.h 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') --- -1.8.3.2 - diff --git a/package/samba4/samba4-0006-build-unify-and-fix-endian-tests.patch b/package/samba4/samba4-0006-build-unify-and-fix-endian-tests.patch deleted file mode 100644 index 3fdfe6e742..0000000000 --- a/package/samba4/samba4-0006-build-unify-and-fix-endian-tests.patch +++ /dev/null @@ -1,165 +0,0 @@ -From ee4e06b7223fb2925bc887c89216a66029d44862 Mon Sep 17 00:00:00 2001 -From: Gustavo Zacarias -Date: Tue, 1 Apr 2014 06:41:47 -0300 -Subject: [PATCH 2/5] build: unify and fix endian tests - -Unify the endian tests out of lib/ccan/wscript into wafsamba since -they're almost cross-compile friendly. -While at it fix them to be so by moving the preprocessor directives out -of main scope since that will fail. -And keep the WORDS_BIGENDIAN, HAVE_LITTLE_ENDIAN and HAVE_BIG_ENDIAN -defines separate because of different codebases. - -Status: Upstream. - -Signed-off-by: Gustavo Zacarias ---- - buildtools/wafsamba/wscript | 65 ++++++++++++++++++++++++++++++++++++++++++--- - lib/ccan/wscript | 55 -------------------------------------- - 2 files changed, 62 insertions(+), 58 deletions(-) - -diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript -index 7984227..1a2cfe6 100755 ---- a/buildtools/wafsamba/wscript -+++ b/buildtools/wafsamba/wscript -@@ -390,9 +390,68 @@ def configure(conf): - else: - conf.define('SHLIBEXT', "so", quote=True) - -- conf.CHECK_CODE('long one = 1; return ((char *)(&one))[0]', -- execute=True, -- define='WORDS_BIGENDIAN') -+ # First try a header check for cross-compile friendlyness -+ conf.CHECK_CODE(code = """#ifdef __BYTE_ORDER -+ #define B __BYTE_ORDER -+ #elif defined(BYTE_ORDER) -+ #define B BYTE_ORDER -+ #endif -+ -+ #ifdef __LITTLE_ENDIAN -+ #define LITTLE __LITTLE_ENDIAN -+ #elif defined(LITTLE_ENDIAN) -+ #define LITTLE LITTLE_ENDIAN -+ #endif -+ -+ #if !defined(LITTLE) || !defined(B) || LITTLE != B -+ #error Not little endian. -+ #endif -+ int main(void) { return 0; }""", -+ addmain=False, -+ headers="endian.h sys/endian.h", -+ define="HAVE_LITTLE_ENDIAN") -+ conf.CHECK_CODE(code = """#ifdef __BYTE_ORDER -+ #define B __BYTE_ORDER -+ #elif defined(BYTE_ORDER) -+ #define B BYTE_ORDER -+ #endif -+ -+ #ifdef __BIG_ENDIAN -+ #define BIG __BIG_ENDIAN -+ #elif defined(BIG_ENDIAN) -+ #define BIG BIG_ENDIAN -+ #endif -+ -+ #if !defined(BIG) || !defined(B) || BIG != B -+ #error Not big endian. -+ #endif -+ int main(void) { return 0; }""", -+ addmain=False, -+ headers="endian.h sys/endian.h", -+ define="HAVE_BIG_ENDIAN") -+ -+ if not conf.CONFIG_SET("HAVE_BIG_ENDIAN") and not conf.CONFIG_SET("HAVE_LITTLE_ENDIAN"): -+ # That didn't work! Do runtime test. -+ conf.CHECK_CODE("""union { int i; char c[sizeof(int)]; } u; -+ u.i = 0x01020304; -+ return u.c[0] == 0x04 && u.c[1] == 0x03 && u.c[2] == 0x02 && u.c[3] == 0x01 ? 0 : 1;""", -+ addmain=True, execute=True, -+ define='HAVE_LITTLE_ENDIAN', -+ msg="Checking for HAVE_LITTLE_ENDIAN - runtime") -+ conf.CHECK_CODE("""union { int i; char c[sizeof(int)]; } u; -+ u.i = 0x01020304; -+ return u.c[0] == 0x01 && u.c[1] == 0x02 && u.c[2] == 0x03 && u.c[3] == 0x04 ? 0 : 1;""", -+ addmain=True, execute=True, -+ define='HAVE_BIG_ENDIAN', -+ msg="Checking for HAVE_BIG_ENDIAN - runtime") -+ -+ # Extra sanity check. -+ if conf.CONFIG_SET("HAVE_BIG_ENDIAN") == conf.CONFIG_SET("HAVE_LITTLE_ENDIAN"): -+ Logs.error("Failed endian determination. The PDP-11 is back?") -+ sys.exit(1) -+ else: -+ if conf.CONFIG_SET("HAVE_BIG_ENDIAN"): -+ conf.DEFINE('WORDS_BIGENDIAN', 1) - - # check if signal() takes a void function - if conf.CHECK_CODE('return *(signal (0, 0)) (0) == 1', -diff --git a/lib/ccan/wscript b/lib/ccan/wscript -index 1c5f337..0e540db 100644 ---- a/lib/ccan/wscript -+++ b/lib/ccan/wscript -@@ -25,61 +25,6 @@ def configure(conf): - conf.CHECK_CODE('int __attribute__((used)) func(int x) { return x; }', - addmain=False, link=False, cflags=conf.env['WERROR_CFLAGS'], - define='HAVE_ATTRIBUTE_USED') -- # We try to use headers for a compile-time test. -- conf.CHECK_CODE(code = """#ifdef __BYTE_ORDER -- #define B __BYTE_ORDER -- #elif defined(BYTE_ORDER) -- #define B BYTE_ORDER -- #endif -- -- #ifdef __LITTLE_ENDIAN -- #define LITTLE __LITTLE_ENDIAN -- #elif defined(LITTLE_ENDIAN) -- #define LITTLE LITTLE_ENDIAN -- #endif -- -- #if !defined(LITTLE) || !defined(B) || LITTLE != B -- #error Not little endian. -- #endif""", -- headers="endian.h sys/endian.h", -- define="HAVE_LITTLE_ENDIAN") -- conf.CHECK_CODE(code = """#ifdef __BYTE_ORDER -- #define B __BYTE_ORDER -- #elif defined(BYTE_ORDER) -- #define B BYTE_ORDER -- #endif -- -- #ifdef __BIG_ENDIAN -- #define BIG __BIG_ENDIAN -- #elif defined(BIG_ENDIAN) -- #define BIG BIG_ENDIAN -- #endif -- -- #if !defined(BIG) || !defined(B) || BIG != B -- #error Not big endian. -- #endif""", -- headers="endian.h sys/endian.h", -- define="HAVE_BIG_ENDIAN") -- -- if not conf.CONFIG_SET("HAVE_BIG_ENDIAN") and not conf.CONFIG_SET("HAVE_LITTLE_ENDIAN"): -- # That didn't work! Do runtime test. -- conf.CHECK_CODE("""union { int i; char c[sizeof(int)]; } u; -- u.i = 0x01020304; -- return u.c[0] == 0x04 && u.c[1] == 0x03 && u.c[2] == 0x02 && u.c[3] == 0x01 ? 0 : 1;""", -- addmain=True, execute=True, -- define='HAVE_LITTLE_ENDIAN', -- msg="Checking for HAVE_LITTLE_ENDIAN - runtime") -- conf.CHECK_CODE("""union { int i; char c[sizeof(int)]; } u; -- u.i = 0x01020304; -- return u.c[0] == 0x01 && u.c[1] == 0x02 && u.c[2] == 0x03 && u.c[3] == 0x04 ? 0 : 1;""", -- addmain=True, execute=True, -- define='HAVE_BIG_ENDIAN', -- msg="Checking for HAVE_BIG_ENDIAN - runtime") -- -- # Extra sanity check. -- if conf.CONFIG_SET("HAVE_BIG_ENDIAN") == conf.CONFIG_SET("HAVE_LITTLE_ENDIAN"): -- Logs.error("Failed endian determination. The PDP-11 is back?") -- sys.exit(1) - - conf.CHECK_CODE('return __builtin_choose_expr(1, 0, "garbage");', - link=True, --- -1.8.3.2 - diff --git a/package/samba4/samba4-0007-build-make-wafsamba-CHECK_SIZEOF-cross-compile-friendl.patch b/package/samba4/samba4-0007-build-make-wafsamba-CHECK_SIZEOF-cross-compile-friendl.patch deleted file mode 100644 index 72176cbe16..0000000000 --- a/package/samba4/samba4-0007-build-make-wafsamba-CHECK_SIZEOF-cross-compile-friendl.patch +++ /dev/null @@ -1,68 +0,0 @@ -From fd3eb1e9f712e4c96c0b55d4203745afb2bcc8c2 Mon Sep 17 00:00:00 2001 -From: Gustavo Zacarias -Date: Wed, 9 Apr 2014 10:21:59 -0300 -Subject: [PATCH 3/5] build: make wafsamba CHECK_SIZEOF cross-compile friendly - -Use the same trick as commit 0d9bb86293c9d39298786df095c73a6251b08b7e -We do the same array trick iteratively starting from 1 (byte) by powers -of 2 up to 32. - -The new 'critical' option is used to make the invocation die or not -according to each test. -The default is True since normally it's expected to find a proper -result and should error out if not. - -Status: Upstream. - -Signed-off-by: Gustavo Zacarias ---- - buildtools/wafsamba/samba_autoconf.py | 28 ++++++++++++++++------------ - 1 file changed, 16 insertions(+), 12 deletions(-) - -diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py -index 59d9e79..f60ce9d 100644 ---- a/buildtools/wafsamba/samba_autoconf.py -+++ b/buildtools/wafsamba/samba_autoconf.py -@@ -304,23 +304,27 @@ def CHECK_FUNCS(conf, list, link=True, lib=None, headers=None): - - - @conf --def CHECK_SIZEOF(conf, vars, headers=None, define=None): -+def CHECK_SIZEOF(conf, vars, headers=None, define=None, critical=True): - '''check the size of a type''' -- ret = True - for v in TO_LIST(vars): - v_define = define -+ ret = False - if v_define is None: - v_define = 'SIZEOF_%s' % v.upper().replace(' ', '_') -- if not CHECK_CODE(conf, -- 'printf("%%u", (unsigned)sizeof(%s))' % v, -- define=v_define, -- execute=True, -- define_ret=True, -- quote=False, -- headers=headers, -- local_include=False, -- msg="Checking size of %s" % v): -- ret = False -+ for size in list((1, 2, 4, 8, 16, 32)): -+ if CHECK_CODE(conf, -+ 'static int test_array[1 - 2 * !(((long int)(sizeof(%s))) <= %d)];' % (v, size), -+ define=v_define, -+ quote=False, -+ headers=headers, -+ local_include=False, -+ msg="Checking if size of %s == %d" % (v, size)): -+ conf.DEFINE(v_define, size) -+ ret = True -+ break -+ if not ret and critical: -+ Logs.error("Couldn't determine size of '%s'" % v) -+ sys.exit(1) - return ret - - @conf --- -1.8.3.2 - diff --git a/package/samba4/samba4-0008-build-tweak-SIZEOF-utmp-ut_line.patch b/package/samba4/samba4-0008-build-tweak-SIZEOF-utmp-ut_line.patch deleted file mode 100644 index 28f5f10a67..0000000000 --- a/package/samba4/samba4-0008-build-tweak-SIZEOF-utmp-ut_line.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 1a7f4f5e3fbbe83e147fffdfe00d7f37181a8ec1 Mon Sep 17 00:00:00 2001 -From: Gustavo Zacarias -Date: Wed, 9 Apr 2014 10:39:06 -0300 -Subject: [PATCH 4/5] build: tweak SIZEOF utmp->ut_line - -Set the critical parameter of CHECK_SIZEOF utmp->ut_line to False since -it's used to find out if utmp support should be enabled. -This is necessary with the introduction of the cross-compile aware -CHECK_SIZEOF. - -Status: Upstream. - -Signed-off-by: Gustavo Zacarias ---- - source3/wscript | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/source3/wscript b/source3/wscript -index e81a47b..aade503 100644 ---- a/source3/wscript -+++ b/source3/wscript -@@ -812,7 +812,7 @@ msg.msg_acctrightslen = sizeof(fd); - 'PUTUTLINE_RETURNS_UTMP', headers='utmp.h', - msg="Checking whether pututline returns pointer") - conf.CHECK_SIZEOF(['((struct utmp *)NULL)->ut_line'], headers='utmp.h', -- define='SIZEOF_UTMP_UT_LINE') -+ define='SIZEOF_UTMP_UT_LINE', critical=False) - if not conf.CONFIG_SET('SIZEOF_UTMP_UT_LINE'): - conf.env.with_utmp = False - elif int(conf.env.SIZEOF_UTMP_UT_LINE) < 15: --- -1.8.3.2 - diff --git a/package/samba4/samba4-0009-disable-libbsd.patch b/package/samba4/samba4-0009-disable-libbsd.patch deleted file mode 100644 index b29a812012..0000000000 --- a/package/samba4/samba4-0009-disable-libbsd.patch +++ /dev/null @@ -1,26 +0,0 @@ -Disable libbsd support, samba4 uses a global config.h for its own -codebase and that of heimdal (when building with builtin). -This causes redefinition conflicts for link(2) when both standard unistd.h -and bsd/unistd.h get included. - -Signed-off-by: Gustavo Zacarias - -diff -Nura samba-4.1.7.orig/lib/replace/wscript samba-4.1.7/lib/replace/wscript ---- samba-4.1.7.orig/lib/replace/wscript 2014-04-17 04:59:14.000000000 -0300 -+++ samba-4.1.7/lib/replace/wscript 2014-05-19 09:17:25.561947774 -0300 -@@ -253,15 +253,6 @@ - conf.CHECK_FUNCS('strtouq strtoll __strtoll strtoq memalign posix_memalign') - conf.CHECK_FUNCS('prctl') - -- # libbsd on some platforms provides strlcpy and strlcat -- if not conf.CHECK_FUNCS('strlcpy strlcat'): -- conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h', -- checklibc=True) -- if not conf.CHECK_FUNCS('getpeereid'): -- conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h') -- if not conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h'): -- conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h') -- - conf.CHECK_CODE(''' - struct ucred cred; - socklen_t cred_len; diff --git a/package/samba4/samba4.hash b/package/samba4/samba4.hash index bd6f6e9fa1..bff18a886e 100644 --- a/package/samba4/samba4.hash +++ b/package/samba4/samba4.hash @@ -1,2 +1,2 @@ # Locally calculated after checking pgp signature -sha256 9d84112124512428ddc9cc0d9975524bab730b9a598a9ff90458666afb3f42f4 samba-4.1.15.tar.gz +sha256 12a09c167bfa25f50b82775bcbeda94c71c5d71d3b0d1210f6dae0f23020a87b samba-4.1.16.tar.gz diff --git a/package/samba4/samba4.mk b/package/samba4/samba4.mk index 4a2f207f3f..4239b42362 100644 --- a/package/samba4/samba4.mk +++ b/package/samba4/samba4.mk @@ -4,7 +4,7 @@ # ################################################################################ -SAMBA4_VERSION = 4.1.15 +SAMBA4_VERSION = 4.1.16 SAMBA4_SITE = http://ftp.samba.org/pub/samba/stable SAMBA4_SOURCE = samba-$(SAMBA4_VERSION).tar.gz SAMBA4_LICENSE = GPLv3+