summaryrefslogtreecommitdiff
path: root/lib/replace
Commit message (Collapse)AuthorAgeFilesLines
* replace: Be strict when checking __attribute__ featuresAmitay Isaacs2018-07-041-1/+1
| | | | | | | 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>
* build: bundle and reduce huge number of EA function testsBjörn Jacke2018-07-033-92/+56
| | | | | | | | | | | | 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
* replace: Add test for sin6_len in sockaddr_in6 structureAmitay Isaacs2018-07-021-0/+4
| | | | | | | 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>
* replace: Check for -Wno-strict-overflowAndreas Schneider2018-04-031-0/+3
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/replace: define __[u]intptr_t_defined if we prove an replacementStefan Metzmacher2018-04-031-0/+2
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13344 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Björn Jacke <bjacke@samba.org>
* lib:replace: Fix linking when libtirpc-devel overwrites system headersNoel Power2018-03-201-1/+9
| | | | | | | | | | | | | | | 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
* lib:replace: Add FALL_THROUGH statements in strptime.cAndreas Schneider2018-03-011-2/+4
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* lib:replace: Add FALL_THROUGH supportAndreas Schneider2018-03-012-0/+45
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* replace: Only warn if rpc/rpc.h haven't been foundAndreas Schneider2018-02-271-2/+1
| | | | | | | | | | | 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
* replace: remove some duplicate checksBjörn Jacke2018-02-211-8/+0
| | | | | Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* waf: Fix NFS quota support with libtirpcAndreas Schneider2018-01-221-1/+1
| | | | | | | | | | 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
* build: deal with recent glibc sunrpc header removalGünther Deschner2018-01-221-5/+33
| | | | | | | | | | | | | | | 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>
* include: Create system/nis.h in libreplaceAndreas Schneider2018-01-221-0/+83
| | | | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13238 Pair-Programmed-With: Guenther Deschner <gd@samba.org> Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
* lib/replace: apply readline -Wstrict-prototypes workaroundUri Simchoni2017-11-241-0/+3
| | | | | | | | | | | | | | clang -Wstrict-prototypes has issues with readline > 6.3. Fix suggested by Timur I. Bakeyev <timur@freebsd.org> cf. https://lists.gnu.org/archive/html/bug-readline/2014-04/msg00018.html cf. https://lists.samba.org/archive/samba-technical/2017-November/123923.html Signed-off-by: Uri Simchoni <uri@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Fri Nov 24 05:16:10 CET 2017 on sn-devel-144
* build: detect availability of -Wno-unused-functionUri Simchoni2017-11-221-0/+3
| | | | | Signed-off-by: Uri Simchoni <uri@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* replace: Link to -lbsd when building replace.c by handAndrew Bartlett2017-10-201-3/+9
| | | | | | | | | | 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>
* s4:smbd: call setproctitle_initGary Lockyer2017-09-263-0/+11
| | | | | | | | | | | | | | 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>
* configure: Centralize check for posix_fallocateVolker Lendecke2017-08-241-0/+12
| | | | | | | | | | | | | 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>
* waf:lib/replace: Fix building with older GCC versionsBjörn Baumbach2017-06-231-1/+7
| | | | | | | | | 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>
* strerror_r: provide XSI-compliant strerror_rGary Lockyer2017-06-133-1/+26
| | | | | | | | | | | | | 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>
* libbreplace: compatibility fix for AIXGuillaume Xavier Taillon2017-06-131-1/+9
| | | | | | | | | | | | | | Adds macros for preprocessor compares and replaces an incomptatible compare with one of the new macros. This fixes a comptability bug on AIX. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11621 Signed-off-by: Guillaume Xavier Taillon <gtaillon@ca.ibm.com> Reviewed-by: Björn Jacke <bjacke@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Björn Jacke <bj@sernet.de> Autobuild-Date(master): Tue Jun 13 09:11:56 CEST 2017 on sn-devel-144
* waf: Do not trhow a format-truncation error for test/snprintf.cAndreas Schneider2017-06-011-1/+1
| | | | | | | | | | | | 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>
* replace: Use the same size as d_name member of struct direntAndreas Schneider2017-06-011-1/+1
| | | | | | | This fixes an error with GCC 7.1 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* password_hash: conditional compilation for crypt_rGary Lockyer2017-06-011-0/+1
| | | | | | | 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>
* replace: Fix compiler warning flagAmitay Isaacs2017-03-161-1/+1
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Jeremy Allison <jra@samba.org>
* Correct "seperate" typos.Chris Lamb2017-02-221-1/+1
| | | | | | 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>
* Correct "formated" typos.Chris Lamb2017-02-221-1/+1
| | | | | | 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>
* lib/replace: validate xattr namespace prefix on FreeBSDRalph Boehme2017-02-101-24/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | We should validate the xattr name string ensuring it either begins with "sytem." or "user.". If it doesn't, we should fail the request with EINVAL. The FreeBSD xattr API uses namespaces but doesn't put the namespace name as a string prefix at the beginning of the xattr name. It gets passed as an additional int arg instead. On the other hand, our libreplace xattr API expects the caller to put a namespace prefix into the xattr name. Unfortunately the conversion and stripping of the namespace string prefix from the xattr name gives the following unexpected result on FreeBSD: rep_setxattr("foo.bar", ...) => xattr with name "bar" The code checks if the name begins with "system.", if it doesn't find it, it defaults to the user namespace and then does a strchr(name, '.') which skips *any* leading string before the first dot. Bug: https://bugzilla.samba.org/show_bug.cgi?id=12490 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/replace tests: prevent GCC fretting over snprintf sizesDouglas Bagnall2017-02-101-3/+4
| | | | | | | | | 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>
* replace: fix some trailing whitespacesBjörn Jacke2017-01-211-10/+10
| | | | | Signed-off-by: Bjoern Jacke <bj@sernet.de> Reviewed-by: David Disseldorp <ddiss@samba.org>
* replace: Include sysmacros.hAndreas Schneider2017-01-081-0/+4
| | | | | | | | | | | | In the GNU C Library, "makedev" is defined by <sys/sysmacros.h>. For historical compatibility, it is currently defined by <sys/types.h> as well, but it is planned to remove this soon. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Sun Jan 8 22:30:03 CET 2017 on sn-devel-144
* WAF: Fix detection of IPv6Lukas Slebodnik2017-01-021-1/+1
| | | | | | | | | | | | | | | | | | | | 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
* lib replace: Fix detection of featuresLukas Slebodnik2017-01-023-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | If configure script is executed with stricter cflags "-Werrorr=implicit-function-declaration -Werror=implicit-int" then detection of few features will fail. Checking for C99 vsnprintf : not found Checking for HAVE_SHARED_MMAP : not found Checking for HAVE_MREMAP : not found lib/replace/test/shared_mmap.c:18:1: error: return type defaults to ‘int’ [-Werror=implicit-int] main() ^~~~ lib/replace/test/shared_mmap.c: In function ‘main’: lib/replace/test/shared_mmap.c:25:16: error: implicit declaration of function ‘exit’ [-Werror=implicit-function-declaration] if (fd == -1) exit(1); ^~~~ lib/replace/test/shared_mmap.c:25:16: warning: incompatible implicit declaration of built-in function ‘exit’ lib/replace/test/shared_mmap.c:25:16: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’ Signed-off-by: Lukas Slebodnik <lslebodn@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* replace: make sure we have a SCOPE_DELIMITER defineBjörn Jacke2016-12-091-0/+4
| | | | | Signed-off-by: Bjoern Jacke <bj@sernet.de> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* replace: Include libgen.h if availableAmitay Isaacs2016-12-011-0/+4
| | | | | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Thu Dec 1 18:08:54 CET 2016 on sn-devel-144
* libreplace: Ask for eventfd(2)Volker Lendecke2016-08-241-0/+3
| | | | | | | | 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>
* lib: Add a little closefrom() testVolker Lendecke2016-06-131-0/+33
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Mon Jun 13 14:11:11 CEST 2016 on sn-devel-144
* libreplace: Add a closefrom() implementationVolker Lendecke2016-06-133-0/+150
| | | | | | | | | | | | 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>
* lib: replace: snprintf - Fix length calculation for hex/octal 64-bit values.Lorinczy Zsigmond2016-06-031-3/+3
| | | | | | | | | | | | | Prevents truncation due to buffer size being too small. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11947 Signed-off-by: Lorinczy Zsigmond <lzsiga@freemail.c3.hu> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Fri Jun 3 03:48:58 CEST 2016 on sn-devel-144
* Fix CHECK_CODE usage in atomics builtin detectionJérémie Courrèges-Anglas2016-04-261-12/+4
| | | | | | | | | | | | | | | | | | | 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
* lib:replace: Missing semicolon on function definition.Jeremy Allison2016-04-021-1/+1
| | | | | | | | Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Sat Apr 2 06:04:13 CEST 2016 on sn-devel-144
* libreplace: use HAVE___ATTRIBUTE__ instead of __GNUC__Douglas Bagnall2016-03-241-2/+2
| | | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Uri Simchoni <uri@samba.org>
* libreplace: Only check for malloc.h if neededVolker Lendecke2015-11-191-1/+8
| | | | | | | | | | | | | 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>
* libreplace: Put the malloc.h check on a line of its ownVolker Lendecke2015-11-191-1/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* libreplace: Only check malloc.h onceVolker Lendecke2015-11-191-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* build:wafsamba: Remove samba_utils.runonceThomas Nagy2015-11-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* lib/replace: Make sure that replacement strto[u]ll does not reset errno ↵Felix Janda2015-10-311-2/+4
| | | | | | | | | | | | | | unexpectedly Fix the replacement functions for strtoll and strtoull to not set errno to 0 if errno is EINVAL before calling, strto[u]ll does not modify errno and the base is ok. Bug: https://bugzilla.samba.org/show_bug.cgi?id=11455 Signed-off-by: Felix Janda <felix.janda@posteo.de> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* lib/replace: Replace BSD strtoull by wrapping strtoull instead of strtouqFelix Janda2015-10-311-6/+3
| | | | | | | | | | | Same as commit e50bf6d537ef09e936d19d6e0bf63f9bbc5d4818 but for strtoull instead of strtoll. Bug: https://bugzilla.samba.org/show_bug.cgi?id=11455 Signed-off-by: Felix Janda <felix.janda@posteo.de> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* build:wafsamba: dead code removal in gettext detectionThomas Nagy2015-10-271-11/+0
| | | | | | | | | | | | 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
* libreplace: Fix the build on SolarisVolker Lendecke2015-10-012-1/+6
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>