--- /dev/null
+#!/bin/sh
+# This test ensures that two different talloc processes do not use the same
+# magic value to lessen the opportunity for transferrable attacks.
+
+echo "test: magic differs"
+
+if [
+ "`./talloc_test_magic_differs_helper`" != "`./talloc_test_magic_differs_helper`"
+]; then
+ echo "failure: magic remained the same between executions"
+ exit 1
+fi
+
+echo "success: magic differs"
--- /dev/null
+#include <stdio.h>
+#include "talloc.h"
+
+/*
+ * This program is called by a testing shell script in order to ensure that
+ * if the library is loaded into different processes it uses different magic
+ * values in order to thwart security attacks.
+ */
+int main(int argc, char *argv[]) {
+ printf("%i\n", talloc_test_get_magic());
+ return 0;
+}
testsuite_deps,
install=False)
+ bld.SAMBA_BINARY('talloc_test_magic_differs_helper',
+ 'test_magic_differs_helper.c',
+ 'talloc', install=False)
+
else:
private_library = True
cmd = os.path.join(Utils.g_module.blddir, 'talloc_testsuite')
ret = samba_utils.RUN_COMMAND(cmd)
print("testsuite returned %d" % ret)
+ magic_cmd = os.path.join(srcdir, 'lib', 'talloc',
+ 'test_magic_differs.sh')
+
+ magic_ret = samba_utils.RUN_COMMAND(magic_cmd)
+ print("magic differs test returned %d" % magic_ret)
pyret = samba_utils.RUN_PYTHON_TESTS(['test_pytalloc.py'])
print("python testsuite returned %d" % pyret)
- sys.exit(ret or pyret)
+ sys.exit(ret or magic_ret or pyret)
def dist():
'''makes a tarball for distribution'''