summaryrefslogtreecommitdiff
path: root/lib/replace
Commit message (Collapse)AuthorAgeFilesLines
* replace, attr.: use function attributes only if supported by feature macro ↵Björn Jacke2020-05-241-1/+6
| | | | | | | | | (or old gcc) BUG: https://bugzilla.samba.org/show_bug.cgi?id=12296 Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* lib: Add macro ARRAY_DEL_ELEMENT()Volker Lendecke2020-03-262-0/+48
| | | | | | | | Every time I have to remove an element from within an array I have to scratch my head about the memmove arguments. Make this easier to use. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* Undef ARRAY_SIZE, if defined, before define to avoid compilation warningsPeter Eriksson2020-02-271-0/+3
| | | | | | | | | Signed-off-by: Peter Eriksson <pen@lysator.liu.se> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Gary Lockyer <<gary@catalyst.net.nz> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu Feb 27 21:43:29 UTC 2020 on sn-devel-184
* lib/replace: remove unused check for aio.hStefan Metzmacher2020-02-151-1/+1
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/replace: prefer <sys/xattr.h> over <attr/xattr.h>Ralph Boehme2019-12-181-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This prevents the following compile error that may happens if "system/filesys.h" is included before "system/capability.h" on Ubuntu 16.04: [1802/4407] Compiling source3/lib/system.c In file included from ../../lib/replace/system/filesys.h:112:0, from ../../source3/include/vfs.h:29, from ../../source3/include/smb.h:150, from ../../source3/include/includes.h:284, from ../../source3/lib/system.c:23: /usr/include/x86_64-linux-gnu/sys/xattr.h:32:3: error: expected identifier before numeric constant XATTR_CREATE = 1, /* set value, fail if attr already exists. */ ^ The above error is from compiling a source tree which includes a change that adds an include "system/filesys.h" to the top of "source3/include/vfs.h". "source3/lib/system.c" has the following includes: #include "includes.h" #include "system/syslog.h" #include "system/capability.h" #include "system/passwd.h" #include "system/filesys.h" #include "../lib/util/setid.h" The first include of "includes.h" pulls in "vfs.h" which will pull in "system/filesys.h" with the mentioned change. "system/filesys.h" pulls in <attr/xattr.h> which has this define #define XATTR_CREATE 0x1 Later in "source3/lib/system.c" "system/capability.h" is included which includes <sys/xattr.h> on Ubuntu 16.04 (not in later versions of glibc). This defines the XATTR_* values as an enum: enum { XATTR_CREATE = 1, /* set value, fail if attr already exists. */ XATTR_REPLACE = 2 /* set value, fail if attr does not exist. */ }; The previous define of XATTR_CREATE as 1 makes this enum { 1 = 1, /* set value, fail if attr already exists. */ 2 = 2 /* set value, fail if attr does not exist. */ }; which is invalid C. The compiler error diagnostic is a bit confusing, as it prints the original enum from the include file. See also: <https://bugs.freedesktop.org/show_bug.cgi?id=78741> <https://bugs.launchpad.net/ubuntu/+source/attr/+bug/1288091> <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=756097> Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Björn Baumbach <bb@samba.org>
* lib/replace: work around an API conflict between ncurses and XFS xattr APIRalph Boehme2019-12-121-6/+4
| | | | | | | | | | | | | | | | | | | | | Compile error: [4530/4693] Compiling source3/utils/regedit_list.c In file included from ../../source3/utils/regedit_list.h:24, from ../../source3/utils/regedit_list.c:20: /usr/include/curses.h:611:28: error: conflicting types for ‘attr_get’ 611 | extern NCURSES_EXPORT(int) attr_get (attr_t *, NCURSES_PAIRS_T *, void *); /* generated */ | ^~~~~~~~ compilation terminated due to -Wfatal-errors. Both ncurses and XFS xattr API provide a get_attr() function. As a workaround avoid including <sys|attr/attributes.h> if <attr|sys/xattr.h> is present. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu Dec 12 20:22:51 UTC 2019 on sn-devel-184
* replace: ensure UTIME_NOW and UTIME_OMIT are always availableRalph Boehme2019-12-061-0/+7
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=7771 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* build: Only link against libcrypt where neededAndrew Bartlett2019-11-131-1/+1
| | | | | | Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: David Mulder <dmulder@suse.com> Reviewed-by: Andreas Schneider <asn@samba.org>
* lib/replace/xattr.c: typo fixesBjörn Jacke2019-10-311-8/+8
| | | | | Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* replace: Only link libnsl and libsocket if requriredAndreas Schneider2019-10-231-5/+31
| | | | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14168 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): Wed Oct 23 08:23:13 UTC 2019 on sn-devel-184
* replace: Improve sys/sysctl.h check to catch warning on glibc >= 2.30Andreas Schneider2019-10-071-1/+12
| | | | | | | | 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 Oct 7 11:48:24 UTC 2019 on sn-devel-184
* lib/replace: Remove libaio supportVolker Lendecke2019-10-043-34/+1
| | | | | | | | | | | io_uring is the way to go these days, libaio was never really useful for Samba Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Oct 4 18:18:41 UTC 2019 on sn-devel-184
* waf:replace: Do not link against libpthread if not necessaryAndreas Schneider2019-09-251-4/+6
| | | | | | | | | | | | | | | On Linux we should avoid linking everything against libpthread. Symbols used my most application are provided by glibc and code which deals with threads has to explicitly link against libpthread. This avoids setting LDFLAGS=-pthread globally. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14140 Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Isaac Boukris <iboukris@gmail.com> Pair-Programmed-With: Isaac Boukris <iboukris@gmail.com> Reviewed-by: Matthias Dieter Wallnöfer <mdw@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
* replace: Only link against librt if really neededAndreas Schneider2019-09-251-3/+21
| | | | | | | | | | | | | | fdatasync() and clock_gettime() are provided by glibc on Linux, so there is no need to link against librt. Checks have been added so if there are platforms which require it are still functional. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14140 Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Isaac Boukris <iboukris@gmail.com> Pair-Programmed-With: Isaac Boukris <iboukris@gmail.com> Reviewed-by: Matthias Dieter Wallnöfer <mdw@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
* replace: Remove crypt() reimplementationAndrew Bartlett2019-09-193-776/+0
| | | | | | | | | | | | | | | | | | | | Use of Samba with plaintext authenticaiton is incredibly rare, even more rare is plaintext authentication on systems without a crypt() call and where DES based crypt() would be the right thing to do. Remove this additional cryptographic code per our current efforts to rely entirely on external libraries instead. Similar to the arguments in this thread about zlib discussed on samba-technical here: https://lists.samba.org/archive/samba-technical/2019-May/133476.html Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Thu Sep 19 09:28:21 UTC 2019 on sn-devel-184
* build: Remove tests for getdents() and getdirentries()Andrew Bartlett2019-09-171-1/+1
| | | | | | | | | | | | | | | | These date back to 3a9beef2b7b25427ee4611cfc375e05cc82a1150 in 2003 and 829e72fe9c97feaa3d45b768984a4c47b906a23a in 1998 and appear to be related to smbwrapper. More of these should be removed but the getdirents() test caused a timeout on an ARM builder in Debian. It might just be a fluke but the tests are pointless regardless. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Tue Sep 17 13:48:18 UTC 2019 on sn-devel-184
* lib/replace/wscript: Avoid generating nested main functionKhem Raj2019-09-171-0/+1
| | | | | | | | | | 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>
* Spelling fixes s/convertion/conversion/Mathieu Parent2019-09-012-3/+3
| | | | | | Signed-off-by: Mathieu Parent <math.parent@gmail.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* replace/setxattr: correctly use our flags on DarwinBjörn Jacke2019-08-291-4/+2
| | | | | | | | Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Björn Jacke <bjacke@samba.org> Autobuild-Date(master): Thu Aug 29 17:10:32 UTC 2019 on sn-devel-184
* xattr/setxattr: fix flag support on AIXBjörn Jacke2019-08-291-2/+30
| | | | | | | AIX requires the flags to be 0, we need to do those checks manually. Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* replace/setxattr: set reasonable and unified errno value in case the EA ↵Björn Jacke2019-08-291-13/+41
| | | | | | | | | | value was too big FreeBSD and AIX already set errno to ENAMETOOLONG, this is what we should map other platforms also to to finally map to the correct NT error code also. Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* lib/replace: Remove #undef TCP_NODELAYAndrew Bartlett2019-06-181-28/+0
| | | | | | | | | | | | | | | | | | | | | A duplicate define warning is better than not defining this at all. Similar to a patch Torsten Werner submitted to the Samba Bugzilla in 2005. Not tested on HP-UX reverts fc84e916f628b4fb6f6667ad45d0ced0e9134b23 that was still present in the new copy of nis.h created in c29d087e1ea4c92717ef86e372fe80f410580fdc BUG: https://bugzilla.samba.org/show_bug.cgi?id=2406 BUG: https://bugzilla.samba.org/show_bug.cgi?id=2140 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Tue Jun 18 06:47:05 UTC 2019 on sn-devel-184
* lib: Only compile resolvconftest if fmemopen existsVolker Lendecke2019-05-251-0/+1
| | | | | | | | | 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
* replace: Fix "make test" to actually test libreplaceAndrew Bartlett2019-05-0610-9/+27
| | | | | | | | | | 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>
* build: Remove build of replacetortAndrew Bartlett2019-05-061-5/+4
| | | | | | | | 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>
* replace: Add ZERO_ARRAY_LEN() macroAndreas Schneider2019-04-301-0/+5
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* Revert "lib/replace: define NAME_MAX for platforms that don't have it"Günther Deschner2019-04-261-4/+0
| | | | | | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13872 This reverts commit e3c894fb6b87df8aa56e29ef3b16ae1ef456a875. Signed-off-by: Günther Deschner <gd@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Günther Deschner <gd@samba.org> Autobuild-Date(master): Fri Apr 26 13:03:05 UTC 2019 on sn-devel-184
* lib/replace: define NAME_MAX for platforms that don't have itGünther Deschner2019-04-161-0/+4
| | | | | | | | | | | | | | This allows the vfs_glusterfs_fuse build to complete on AIX. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13872 Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Günther Deschner <gd@samba.org> Autobuild-Date(master): Tue Apr 16 15:14:50 UTC 2019 on sn-devel-144
* replace: remove needless vxfs header file checkBjörn Jacke2019-02-172-9/+1
| | | | | Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Uri Simchoni <uri@samba.org>
* wafsamba/replace: move __STDC_WANT_LIB_EXT1__ to CFLAGSStefan Metzmacher2019-01-291-2/+8
| | | | | | | | | | | | | | This fixes the build of python bindings, which use memset_s() (via ZERO_STRUCT). In python bindings Python.h needs to be the first header, which means is already includes string.h. Defining __STDC_WANT_LIB_EXT1__ in replace.h is too late in that case. This fixes the --check-c-compiler=gcc --picky-developer on FreeBSD 12. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* replace: only include <sys/capability.h> with HAVE_POSIX_CAPABILITIESStefan Metzmacher2019-01-291-0/+2
| | | | | | | | | On FreeBSD <sys/capability.h> is a legacy wrapper to <sys/capsicum.h>, which implements something different. With FreeBSD 12 including <sys/capability.h> generates a compiler warning/error. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* waf:lib/replace: fix a build error with non-gcc compilersBjörn Jacke2019-01-101-1/+1
| | | | | | | | | | 3a175830e579ab10231439657b23733338cd5634 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>
* lib: replace: snprintf: Whitespace clean upLadislav Michl via samba-technical2019-01-101-72/+72
| | | | | | | | | Remove spaces before tab, spaces at the end of line and white chars on blank line. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Reviewed-by: Björn Jacke <bjacke@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* replace: Use memset_s for ZERO_* macrosAndreas Schneider2018-12-201-4/+8
| | | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* replace: Cleanup comments for ZERO_*Andreas Schneider2018-12-201-11/+13
| | | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* replace: Add memset_s to replacement functionsAndreas Schneider2018-12-202-1/+2
| | | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* replace: Fix checking for config.h #define in replace.hAndreas Schneider2018-12-161-1/+1
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* replace: Fix checking for config.h #define in gssapi.hAndreas Schneider2018-12-161-4/+4
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* replace: Fix checking for config.h #define in readline.hAndreas Schneider2018-12-161-1/+1
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* build: Move python detection back into waf (instead of in configure and ↵Andrew Bartlett2018-12-142-2/+1
| | | | | | | | | | | | | | | | | | | Makefile) This avoids creating a mini-configure in the configure script. Users wishing to use python2 to build need to specify PYTHON= to both ./configure and make After we merged the python3 change, it became clear that relying on systems prefixing the correct python just causes trouble and make debugging harder, so only use $PYTHON for the override, not the default case This essentially reverts a660b7fb8e519bd3be558fd0425bff8f287fca1f but leaves the files more consistent. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Noel Power <npower@samba.org>
* build: Workaround python3 hash order issues (for now)Andrew Bartlett2018-12-131-1/+1
| | | | | | | | | | | This works around python3 having a new hash seed each time it starts to allow a second "make" not to rebuild the world. This should probably be reverted once we find the hash that is causing the issue, but should reduce frustration for now. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* PY3: switch current build to use python3Noel Power2018-12-102-2/+4
| | | | | | | | | | | | | | Make sure default make and configure for all now defaults to building with python3. To build a samba (or sub component e.g. talloc etc.) with python3 ./configure && make To build a samba (or sub component e.g. talloc etc.) with python2 PYTHON=python ./configure && PYTHON=python make Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* replace: Correctly check for 'extern char **environ' in unistd.hAndreas Schneider2018-11-302-10/+13
| | | | | | | | 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
* replace: Use #ifdef instead of #if for config.h definitionsAndreas Schneider2018-11-285-11/+11
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* s3: Remove unsused MMAP_BLACKLIST ifdef checksAndreas Schneider2018-11-281-4/+0
| | | | | | | This doesn't get defined by anything. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* lib:replace: Check if HAVE_DECL_ENVIRON is defined firstAndreas Schneider2018-11-281-0/+2
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* replace: Add check for variable program_invocation_short_nameMartin Schwenke2018-11-132-5/+6
| | | | | | | | | | | | | | | | | | | | | 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
* lib:replace: Do not leak the file pointer in rep_getprogname()Andreas Schneider2018-11-131-5/+12
| | | | | | | And return NULL on error. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* lib:replace: Add getprogname()Andreas Schneider2018-11-123-0/+77
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* replace: Add memset_s() if not availableAndreas Schneider2018-10-163-0/+56
| | | | | | | 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>