1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
Commit Graph

288 Commits

Author SHA1 Message Date
Khem Raj
98fe813d9c lib/replace/wscript: Avoid generating nested main function
clang is not happy when it sees another main nested inside the main
function and fails the test for prctl syscall, therefore avoid adding
implicit main() here

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Reviewed-by: Matthias Dieter Wallnöfer <mdw@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-09-17 12:31:40 +00:00
Mathieu Parent
4449f5d1b8 Spelling fixes s/convertion/conversion/
Signed-off-by: Mathieu Parent <math.parent@gmail.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2019-09-01 22:21:26 +00:00
Volker Lendecke
da87fa998a lib: Only compile resolvconftest if fmemopen exists
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13961
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat May 25 00:05:25 UTC 2019 on sn-devel-184
2019-05-25 00:05:25 +00:00
Andrew Bartlett
6cc68c1ccf replace: Fix "make test" to actually test libreplace
Found by Joe Guo during preperation for automated code coverage output.

In order to allow the Makefile wrapper to work we need to rename the
test directory to tests.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2019-05-06 05:46:11 +00:00
Andrew Bartlett
1692908966 build: Remove build of replacetort
This is built close to the code it tests in lib/replace/wscript_build as
replace_testsuite.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2019-05-06 05:46:10 +00:00
Björn Jacke
2888bee43c replace: remove needless vxfs header file check
Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2019-02-17 13:33:12 +01:00
Björn Jacke
121db8c08f waf:lib/replace: fix a build error with non-gcc compilers
3a175830e5 added that variable which should have
been an empty initialization here. -Wno-format-zero-length (which might be
unsupported by the compiler) should not be set if we really only want to
initialize the cflags.

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-01-10 22:46:11 +01:00
Andreas Schneider
9968217b88 replace: Add memset_s to replacement functions
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-12-20 12:16:39 +01:00
Andreas Schneider
b349004957 replace: Correctly check for 'extern char **environ' in unistd.h
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Nov 30 11:41:44 CET 2018 on sn-devel-144
2018-11-30 11:41:44 +01:00
Martin Schwenke
9f5768106f replace: Add check for variable program_invocation_short_name
It appears that wafsamba's configure() defines _GNU_SOURCE
unconditionally, so checking _GNU_SOURCE isn't enough to know if this
variable is available.

For example, it isn't available on AIX with the xlc compiler:

  [ 6/10] Compiling lib/replace/replace.c
  ...
  "../../lib/replace/replace.c", line 991.16: 1506-045 (S) Undeclared identifier program_invocation_short_name.

Instead, add a configure check for program_invocation_short_name and
use it.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Nov 13 11:11:11 CET 2018 on sn-devel-144
2018-11-13 11:11:11 +01:00
Andreas Schneider
c8e27b6f33 lib:replace: Add getprogname()
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-11-12 09:50:25 +01:00
Andreas Schneider
84615c1982 replace: Add memset_s() if not available
See https://en.cppreference.com/w/c/string/byte/memset

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-10-16 08:42:18 +02:00
Noel Power
693834f731 PY3: fix iteritems usage, not supported in python3
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-09-16 06:16:19 +02:00
Stefan Metzmacher
200ddf8e73 Revert "lib/replace: force to unset defines if check has failed"
This reverts commit 8ec7eb0c01.

There was already a better fix under discusion.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-09-10 19:28:14 +02:00
Alexander Bokovoy
8ec7eb0c01 lib/replace: force to unset defines if check has failed
For HAVE_WORKING_STRPTIME and HAVE_INCOHERENT_MMAP we always want to
have their defines unset as the code is using '#ifdef' rather than just
'#if'. Setting them to 0 means #ifdef will succeed due to a difference
how '#ifdef' and '#if' are working.

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-09-08 08:44:16 +02:00
Alexander Bokovoy
364077d262 lib/replace/wscript: fix detection of a fallthrough attribute for clang
clang issues a warning but otherwise allows our test to be compiled and
linked. We consider this case a successful pass for a fallthrough
attribute detection while it is an error.

Turn missing declaration warning into an error so that we actually do
not define fallthrough attribute support in case it doesn't really work.

Fixes FreeBSD 11.2 with clang.

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-09-07 11:37:23 +02:00
Alexander Bokovoy
ea578830ce lib/replace/wscript: update to handle waf 2.0.4
Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-09-05 06:37:23 +02:00
Stefan Metzmacher
66aaa22f0f lib/replace: also check for valgrind/helgrind.h
This will be used in lib/pthreadpool/pthreadpool_tevent.c
in order to avoid extected helgrind/drd warnings.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-07-24 17:38:27 +02:00
Stefan Metzmacher
5fa5764f30 replace: add checks for atomic_thread_fence(memory_order_seq_cst) and add possible fallbacks
This implements a full memory barrier.
On ubuntu amd64 with results in an 'mfence' instruction.

This is required to syncronization between threads, where
there's typically only one write of a memory that should be
synced between all threads with the barrier.

Much more details can be found here:
https://gcc.gnu.org/onlinedocs/gcc-7.3.0/gcc/_005f_005fatomic-Builtins.html#g_t_005f_005fatomic-Builtins
https://gcc.gnu.org/onlinedocs/gcc-7.3.0/gcc/_005f_005fsync-Builtins.html#g_t_005f_005fsync-Builtins

The main one we use seems to be in C11 via stdatomic.h,
the oldest fallback is __sync_synchronize(), which is available
since 2005 in gcc.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-07-24 17:38:26 +02:00
Stefan Metzmacher
2ebb5847de lib/replace: check for __thread support
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-07-24 17:38:26 +02:00
Amitay Isaacs
59dfd2d797 replace: Be strict when checking __attribute__ features
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13493

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
2018-07-04 23:56:43 +02:00
Björn Jacke
3287bfe2b4 build: bundle and reduce huge number of EA function tests
It's sufficient to check for one basic function of an EA implementation and a
use a single ifdef for each group of EA functions. This makes more sense than
checking for each EA function on each platform.

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Jul  3 13:24:51 CEST 2018 on sn-devel-144
2018-07-03 13:24:51 +02:00
Amitay Isaacs
7eeba9c5a4 replace: Add test for sin6_len in sockaddr_in6 structure
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13493

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-02 08:51:20 +02:00
Andreas Schneider
08e350b54f replace: Check for -Wno-strict-overflow
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-04-03 20:20:11 +02:00
Noel Power
618c714b6b lib:replace: Fix linking when libtirpc-devel overwrites system headers
Some systems (like SUSE currently) install the new tirpc headers by
overwritting the existing system location used by gcc. This patch will
detect if the headers in the system location belong to tirpc or not.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13341

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Mar 20 16:07:05 CET 2018 on sn-devel-144
2018-03-20 16:07:05 +01:00
Andreas Schneider
05dae361b3 lib:replace: Add FALL_THROUGH support
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-03-01 04:37:41 +01:00
Andreas Schneider
350826868d replace: Only warn if rpc/rpc.h haven't been found
This is also used by talloc, tevent, etc. Those libs don't need or use
rpc.h

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Feb 27 03:23:37 CET 2018 on sn-devel-144
2018-02-27 03:23:37 +01:00
Andreas Schneider
39a6ea766d waf: Fix NFS quota support with libtirpc
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13238

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Jan 22 17:26:52 CET 2018 on sn-devel-144
2018-01-22 17:26:52 +01:00
Günther Deschner
ee0be7eb72 build: deal with recent glibc sunrpc header removal
We need to rely on libtirpc or libntirpc to be around in that case.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13238
BUG: https://bugzilla.samba.org/show_bug.cgi?id=10976

Guenther

Pair-Programmed-With: Andreas Schneider <asn@samba.org>

Signed-off-by: Guenther Deschner <gd@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
2018-01-22 12:26:20 +01:00
Uri Simchoni
a74896d48f build: detect availability of -Wno-unused-function
Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-11-22 10:20:20 +01:00
Andrew Bartlett
593dacd274 replace: Link to -lbsd when building replace.c by hand
This ensures that we correctly detect HAVE_IFACE_GETIFADDRS
et al, which are based on a "build the source" style test.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13087

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2017-10-20 04:05:20 +02:00
Gary Lockyer
4f84b6dfa8 s4:smbd: call setproctitle_init
Call setproctitle_init() in main which suppresses the
  "samba: setproctitle not initialized, please either call
   setproctitle_init() or link against libbsd-ctor."
messages, but more importantly it displays meaningful details in ps
output.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=9816

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2017-09-26 00:41:16 +02:00
Volker Lendecke
ab132ba7e5 configure: Centralize check for posix_fallocate
This checks for posix_fallocate unless we are sitting on an ancient glibc.
With this we don't need HAVE_BROKEN_POSIX_FALLOCATE anymore,
HAVE_POSIX_FALLOCATE will only be defined if we have a valid [g]libc.

./configure tested on Debian, FreeBSD (which does have posix_fallocate) and
OpenBSD (which does not have posix_fallocate). Also tested with changing the
not have an old-enough glibc around. All did the right thing.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-08-24 01:46:08 +02:00
Björn Baumbach
3a175830e5 waf:lib/replace: Fix building with older GCC versions
Using gcc 4.3.2:
cc1: error: unrecognized command line option "-Wno-format-truncation"

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2017-06-23 21:01:17 +02:00
Gary Lockyer
378ae342c4 strerror_r: provide XSI-compliant strerror_r
Provide a XSI-compliant strerror_r on GNU based systems.
The default GNU strerror_r is not XSI-compliant, this patch wraps the
GNU-specific call in an XSI-compliant wrapper.

This reverts 18ed32ce0821d11c0c06d82c07ba1c27b0c2b886 which tried to
make Heimdal use roken, rather than libreplace for strerror_r.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2017-06-13 18:38:14 +02:00
Andreas Schneider
1670d00be8 waf: Do not trhow a format-truncation error for test/snprintf.c
This fixes building with GCC 7.1

Error:
../lib/replace/test/testsuite.c:355:6: error: ‘%d’ directive output
truncated writing 1 byte into a region of size 0
[-Werror=format-truncation=]

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2017-06-01 19:35:10 +02:00
Gary Lockyer
9e9bff1f27 password_hash: conditional compilation for crypt_r
Add check for crypt_r, and if absent fall back to crypt

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
2017-06-01 19:35:09 +02:00
Amitay Isaacs
59514f2e4c replace: Fix compiler warning flag
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2017-03-16 20:30:19 +01:00
Chris Lamb
1e0bca1e6c Correct "seperate" typos.
Signed-off-by: Chris Lamb <chris@chris-lamb.co.uk>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-02-22 08:26:22 +01:00
Douglas Bagnall
b02d636e0b lib/replace tests: prevent GCC fretting over snprintf sizes
These tests deliberately use snprintf for truncating strings, which is
fine for tests. This has the effect of leaving the warning in place
but preventing it from becoming a fatal error.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-02-10 05:09:08 +01:00
Lukas Slebodnik
59abfcb794 WAF: Fix detection of IPv6
Detection of IPv6 failed with strict CFLAGS due to missing
header file.

  Checking for HAVE_IPV6       : not found

../test.c: In function ‘main’:
../test.c:226:34: error: implicit declaration of function
    ‘if_nametoindex’ [-Werror=implicit-function-declaration]
                        int idx = if_nametoindex("iface1");
                                  ^~~~~~~~~~~~~~

Signed-off-by: Lukas Slebodnik <lslebodn@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon Jan  2 18:03:20 CET 2017 on sn-devel-144
2017-01-02 18:03:20 +01:00
Volker Lendecke
4771d0792e libreplace: Ask for eventfd(2)
This will be used in tevent soon

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-08-24 01:33:48 +02:00
Volker Lendecke
55529d0f85 libreplace: Add a closefrom() implementation
There is closefrom in some BSDs, but Linux ships this only as part
of libbsd.  Add a new implementation of it in libreplace. The one in
libbsd of jessie and upstream differ and it has for example optimizations
for FreeBSD, but it gets some of the array calculations slightly wrong
from my point of view. If you want those, use libbsd. This replacement
is optimized on Linux only looking at /proc/self/fd/, everything else
would do the OPEN_MAX brute force fallback.

Signed-off-by: Volker Lendecke <vl@samba.org>
2016-06-13 10:10:11 +02:00
Jérémie Courrèges-Anglas
53e0860122 Fix CHECK_CODE usage in atomics builtin detection
CHECK_CODE already wraps the code with main().  Adding another layer
results in a nested function, eg

  int main(void) { int main(void) { __sync_fetch_and_add(); } }

Since the inner function isn't called it is optimized out at cc -O2,
thus the linker doesn't fail if __sync_fetch_and_add() isn't available.

Issue noticed on OpenBSD/hppa.

Signed-off-by: Jérémie Courrèges-Anglas <jca@wxcvbn.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Apr 26 01:19:40 CEST 2016 on sn-devel-144
2016-04-26 01:19:40 +02:00
Volker Lendecke
5f6c4fa486 libreplace: Only check for malloc.h if needed
OpenBSD complains that malloc.h is deprecated on every gcc invocation.
That hides a lot of real warnings. malloc and friends nowadays are
typically defined in stdlib.h, only check there.

We need memalign. On OpenBSD this does not exist, so libreplace replaces
it. The wscript test in libreplace only checks whether memalign can
link. Unfortunately in glibc memalign comes from malloc.h.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2015-11-19 07:01:09 +01:00
Volker Lendecke
b64f24971c libreplace: Put the malloc.h check on a line of its own
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2015-11-19 07:01:09 +01:00
Volker Lendecke
4dfa4edd1b libreplace: Only check malloc.h once
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2015-11-19 07:01:09 +01:00
Thomas Nagy
963ccff806 build:wafsamba: Remove samba_utils.runonce
The decorator order matters in the following:
"""
@runonce
@conf
function()
"""

First, the @conf decorator binds the function to the configuration context
and then returns the same function. The @runonce decorator then takes
the output function and replaces it by another that performs caching. This new
function remains in the current script and is never bound to the configuration
context, so caching never occurs.

The declaration would have been correct if written like this:
"""
@conf
@runonce
function()
"""

Yet the decorator @run_once does not keep the function name (__name__), so the
annotation with @conf would fail. The straightforward approach is to remove
all the incorrect @runonce occurrences.

Besides that, the function Utils.run_once is already present in the Waf library,
and is sufficient for the current needs of the Samba code (it caches only the
first argument). Therefore samba_utils.runonce can be safely replaced by
Utils.run_once, which is also present in Waf 1.8.

Note: at runtime, only SETUP_BUILD_GROUPS seems to actually use caching.

Signed-off-by: Thomas Nagy <tnagy@waf.io>
Reviewed-by: Uri Simchoni uri@samba.org
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-11-06 10:37:24 +01:00
Thomas Nagy
84b7a9f939 build:wafsamba: dead code removal in gettext detection
Since the --gettext-location command-line option has no effect, the misleading
code is removed. The samba functions ADD_CFLAGS must also be used in the future

Signed-off-by: Thomas Nagy <tnagy@waf.io>
Reviewed-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Oct 27 03:34:28 CET 2015 on sn-devel-104
2015-10-27 03:34:28 +01:00
Volker Lendecke
d9000cbc94 libreplace: Fix the build on Solaris
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-10-01 02:55:21 +02:00