summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2012-03-29lib/tdb: Add/expose lock functions to support CTDBAmitay Isaacs1-2/+16
This patch adds two lock functions used by CTDB to perform asynchronous locking. These functions do not actually perform any fcntl operations, but only increment internal counters. - tdb_transaction_write_lock_mark() - tdb_transaction_write_lock_unmark() It also exposes two internal functions - tdb_lock_nonblock() - tdb_unlock() These functions are NOT exposed in include/tdb.h to prevent any further uses of these functions. If you ever need to use these functions, consider using tdb2. Signed-off-by: Amitay Isaacs <amitay@gmail.com>
2012-03-29cast: make sure suncc sees a constant.Rusty Russell2-8/+22
cast_const() et. al. are supposed to be a constant expression, so you can do things like: static char *p = cast_const(char *, (const char *)"hello"); Unfortunately, a cast to intptr_t and arithmetic makes suncc reject it as a constant expression. We need the cast, because (1) the expression could be a void *, so we can't just add to it, and (2) gcc complains with -Wcast-qual without it. So instead of adding BUILD_BUG_OR_ZERO, we use a ? :, which keeps everyone happy. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 74859ab18b10aaf990848e49d7789ff5c6cf96c6) Autobuild-User: Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date: Thu Mar 29 08:18:57 CEST 2012 on sn-devel-104
2012-03-29cast: test/compile_fail-cast_static.c should fail without COMPOUND_LITERALS.Rusty Russell1-3/+9
It still gave a warning on gcc, because casting a char to a char* gives a warning. Not so on sun CC. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 6569a707d169a629e25e10710c760c8dc84525c7)
2012-03-29tdb2: fix prototype in tdb1 code.Rusty Russell1-5/+5
We were handing an int-returning function where we should hand an enum TDB_ERROR returning function. Worse, it was returning 0/-1 instead of 0/TDB_ERR_*. Fortunately, it's only compared against success, but the Solaris compiler warns about it, and it's not correct anyway. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-03-27s4 dns: Check smb.conf if we should allow recursionKai Blin1-0/+21
2012-03-26LDB/s4 - deny the "(dn=...)" syntax on search filters when in AD modeMatthias Dieter Wallnöfer3-2/+19
Achieve this by introducing a "disallowDNFilter" flag. Reviewed-by: Andrew Bartlett <abartlet@samba.org> Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2012-03-25replace: Avoid DEBUG(), which is not available in libreplace.Jelmer Vernooij1-1/+1
Autobuild-User: Jelmer Vernooij <jelmer@samba.org> Autobuild-Date: Sun Mar 25 00:13:59 CET 2012 on sn-devel-104
2012-03-24libreplace: Add usleep implementation.Jelmer Vernooij2-0/+20
2012-03-24lib/util: Remove obsolete sys_getpid() and sys_fork().Jelmer Vernooij4-43/+2
The performance of these is minimal (these days) and they can return invalid results when used as part of applications that do not use sys_fork(). Autobuild-User: Jelmer Vernooij <jelmer@samba.org> Autobuild-Date: Sat Mar 24 21:55:41 CET 2012 on sn-devel-104
2012-03-24lib/util: Allow calloc use in util.c, too.Jelmer Vernooij1-0/+1
Autobuild-User: Jelmer Vernooij <jelmer@samba.org> Autobuild-Date: Sat Mar 24 18:50:32 CET 2012 on sn-devel-104
2012-03-24replace: Work around socket wrapper.Jelmer Vernooij1-0/+1
It's fine to ignore socket wrapper here, as it doesn't deal with unix domain sockets.
2012-03-24replace: Add system/network.h for ucred struct.Jelmer Vernooij1-0/+1
2012-03-24libreplace: Add getpeereid implementation.Jelmer Vernooij6-31/+71
2012-03-24lib/util: Remove dummy wrapper for getgrgid().Jelmer Vernooij2-10/+0
2012-03-24lib/util: Remove dummy wrapper for getgrnam().Jelmer Vernooij2-7/+1
2012-03-24lib/util: Remove dummy wrapper for getpwuid().Jelmer Vernooij2-8/+2
2012-03-24lib/util: Remove dummy wrapper for getpwnam().Jelmer Vernooij2-8/+2
2012-03-24lib/util: Remove dummy wrappers for setpwent/getpwent/endpwent.Jelmer Vernooij2-22/+0
2012-03-24lib/util: Move calloc_array and memalign_array to top-level libutil.Jelmer Vernooij2-0/+32
2012-03-24lib/util: Remove prototype for removed sys_memalign.Jelmer Vernooij1-4/+0
2012-03-24lib/util: Remove trivial wrapper sys_connect() around connect().Jelmer Vernooij2-20/+0
2012-03-24replace: Move memalign() from lib/util/system.c to libreplace.Jelmer Vernooij5-38/+45
2012-03-23lib/async_req: Retry read_packet with read(2)Volker Lendecke1-0/+4
This way it will also work with pipes Autobuild-User: Volker Lendecke <vl@samba.org> Autobuild-Date: Fri Mar 23 17:31:24 CET 2012 on sn-devel-104
2012-03-23lib/tdb: fix transaction issue for HAVE_INCOHERENT_MMAP.Rusty Russell1-11/+10
We unmap the tdb on expand, the remap. But when we have INCOHERENT_MMAP (ie. OpenBSD) and we're inside a transaction, doing the expand can mean we need to read from the database to partially fill a transaction block. This fails, because if mmap is incoherent we never allow accessing the database via read/write. The solution is not to unmap and remap until we've actually written the padding at the end of the file. Reported-by: Amitay Isaacs <amitay@gmail.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User: Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date: Fri Mar 23 02:53:15 CET 2012 on sn-devel-104
2012-03-23lib/tdb: fix test/run-die-during-transaction when HAVE_INCOHERENT_MMAP.Rusty Russell1-0/+5
Since we force mmap on, we don't intercept writes to the db, so we never see it in an inconsistent state. #ifdef over the check that we should have recovered it at least once. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-03-23lib/tdb: fix missing return 0 code.Rusty Russell1-1/+1
fde694274e1e5a11d1473695e7ec7a97f95d39e4 made tdb_mmap return an int, but didn't put the return 0 on the "internal db" case. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-03-22lib/tdb2: fix -Wcast-qual warnings.Rusty Russell15-59/+33
We use tdb_mkdata() to get rid of many of them from the tests, and explicit cast_const() in a few places. tlist_for_each() still causes a warning, but that needs to be fixed in CCAN. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User: Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date: Thu Mar 22 03:29:32 CET 2012 on sn-devel-104
2012-03-22lib/tdb2: fix -Wshadow warnings.Rusty Russell6-27/+27
These warnings clutter things up, even though they're of marginal utility. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-03-22lib/tdb2: fix OpenBSD incoherent mmap (tdb2 version)Rusty Russell3-8/+31
This handles incoherent mmaps for TDB2 native databases, by forcing mmap on for such systems, just like we did for tdb1. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-03-22lib/tdb2: fix OpenBSD incoherent mmap (tdb1 version)Rusty Russell3-24/+56
This is a direct port of the previous patch, to the TDB2 codebase. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-03-22lib/tdb: fix OpenBSD incoherent mmap.Rusty Russell4-24/+58
This comment appears in two places in the code (commit 4c6a8273c6dd3e2aeda5a63c4a62aa55bc133099 from 2001): /* * We must ensure the file is unmapped before doing this * to ensure consistency with systems like OpenBSD where * writes and mmaps are not consistent. */ But this doesn't help, because if one process is using mmap and another using pwrite, we get incoherent results. As demonstrated by OpenBSD's failure on the tdb unit tests. Rather than disable mmap on OpenBSD, we test for this issue and force mmap to be enabled. This means that we will fail on very large TDBs on 32-bit systems, but it's better than the horrendous performance penalty on every OpenBSD system. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-03-22lib/replace: test for incoherent mmap.Rusty Russell3-0/+97
We test for other mmap features here, and both tdb1 and tdb2 want this check. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-03-22lib/ccan/failtest: compile fix for OpenBSDRusty Russell3-0/+17
OpenBSD doesn't idempotent-wrap sys/mman.h, so when we #define mmap to an alternative, it fails to compile when sys/mman.h is included again. Workaround is not to #define mmap to add arguments on Open BSD. (Imported from CCAN commit e18e80fe175422d26efe689addc0f67bdba0e097) Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-03-22lib/ccan: namespacize ccan/list to avoid conflict with OpenIndiana's sys/list.hRusty Russell20-357/+392
CCAN includes a little utility called "namespacize" which prepends ccan_ to all public methods of a module, and fixes up any dependencies it finds. It's a little primitive, but it works here. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-03-22lib/tdb: fix up run-die-during-transaction test cases on Solaris.Rusty Russell4-5/+4
By using a different include order, we end up with a different version of FILE_OFFSET_BITS (and probably other things) in parts of the test. The different variants get linked together, and the result is weird: the stat returns 0 size. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-03-16build: Fix build issue on OpenBSD 5.xAmitay Isaacs1-1/+1
Do not use -Wl,-no-undefined flag on OpenBSD 5.x (tested on 5.0) Autobuild-User: Amitay Isaacs <amitay@samba.org> Autobuild-Date: Fri Mar 16 05:14:03 CET 2012 on sn-devel-104
2012-03-16Remove more unnecessary shebang lines in python files.Jelmer Vernooij1-2/+0
Autobuild-User: Jelmer Vernooij <jelmer@samba.org> Autobuild-Date: Fri Mar 16 02:48:52 CET 2012 on sn-devel-104
2012-03-15util: Add --disable-fault-handling.Ira Cooper3-0/+8
On some platforms you can not debug coredumps after the default signal handler gets done dumping core. This allows waf to have an option to disable our default signal handler.
2012-03-14testtools/matchers.py: fix a comment typoMichael Adam1-1/+1
2012-03-14lib/util: only change umask during mkdir()Stefan Metzmacher1-7/+4
metze
2012-03-14lib/util: cope with races between lstat and mkdir in directory_create_or_exist()Stefan Metzmacher1-2/+8
metze
2012-03-14lib/util: use a helper variable in directory_create_or_exist()Stefan Metzmacher1-2/+5
metze
2012-03-14lib/util: do an early return on error directory_create_or_exist()Stefan Metzmacher1-10/+10
metze
2012-03-14lib/util: remove unneeded else branch in directory_create_or_exist()Stefan Metzmacher1-21/+24
metze
2012-03-14lib/util: don't start DEBUG output with 'error 'Stefan Metzmacher1-1/+1
This confused the subunit code. metze
2012-03-14lib/tdb: remove unnecessary XOPEN and FILE_OFFSET_BITS defines in test/Rusty Russell17-20/+0
These were relics: they don't need to be defined here as long as we are careful to include the replace headers before any standard headers (we are). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User: Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date: Wed Mar 14 10:12:26 CET 2012 on sn-devel-104
2012-03-14lib/tdb2: remove unneccessary _FILE_OFFSET_BITS define in test/.Rusty Russell1-2/+0
This was a relic from testing; it can interfere with compile. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-03-14lib/crypto: Detect CommonCrypto and use it if availableMatthieu Patou3-1/+15
CommonCrypto/CommonDigest is available on Mac and there is function in the libc for MD5 calculation. MD5Final is a C define of CC_MD5_Final. Under some circumstance we have the symbol defined twice in samba binaries on Snow Leopard at least. By detecting CommonCrypto/CommonDigest we end up always using the system version if available.
2012-03-14lib/tdb2: make summary handle capabilities properly.Rusty Russell1-31/+13
Another PPC issue (endian?) revealed that the summary code did not handle capabilities correctly: in fact, it went into an endless loop. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User: Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date: Wed Mar 14 06:51:43 CET 2012 on sn-devel-104
2012-03-14lib/tdb2: fix error string formatting.Rusty Russell3-5/+7
This caused a crash on PPC64 when we failed the mmap (found by failtest, reported by Amitay) Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>