summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2012-06-29Move back to using per-thread credentials on Linux. Fixes the glibc native ↵Jeremy Allison3-12/+46
AIO lost wakeup problem. See this post: https://lists.samba.org/archive/samba-technical/2012-June/085101.html for details. Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Jun 29 03:57:45 CEST 2012 on sn-devel-104
2012-06-28Replace all uses of setXX[ug]id() and setgroups with samba_setXX[ug]id() calls.Jeremy Allison7-32/+264
Will allow thread-specific credentials to be added by modifying the central definitions. Deliberately left the setXX[ug]id() call in popt as this is not used in Samba.
2012-06-28Add missing setresgid() wrapper.Jeremy Allison1-0/+1
2012-06-29lib/param: let "SMB2" select PROTOCOL_SMB2_10Stefan Metzmacher1-1/+1
metze
2012-06-28replace: define INT64_MAX when not definedBjörn Jacke1-0/+4
Tru64 doesn't have any stdint.h Autobuild-User(master): Björn Jacke <bj@sernet.de> Autobuild-Date(master): Thu Jun 28 00:45:58 CEST 2012 on sn-devel-104
2012-06-27s3-param: Rename loadparm_s3_context -> loadparm_s3_helpersAndrew Bartlett2-3/+3
This helps clarify the role of this structure and wrapper function. The purpose here is to provide helper functions to the lib/param loadparm_context that point back at the s3 lp_ functions. This allows a struct loadparm_context to be passed to any point in the code, and always refer to the correct loadparm system. If this has not been set, the variables loaded in the lib/param code will be returned. As requested by Michael Adam. Andrew Bartlett Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Wed Jun 27 17:11:16 CEST 2012 on sn-devel-104
2012-06-27lib/ldb: Print trace messages for modify correctlyAndrew Bartlett1-1/+1
2012-06-26tdb: finish weaning off err.h.Rusty Russell7-23/+28
Commit 3c4263e7580143c69225729f5b67f09c00add2fd said it removed err.h from tdb, unfortuntely it didn't: tap-interface.h still included it. This finishes it properly! Reported-by:Stefan Metzmacher <metze@samba.org> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User(master): Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date(master): Tue Jun 26 10:22:03 CEST 2012 on sn-devel-104
2012-06-25lib/param: add "SMB3" as alias for PROTOCOL_SMB3_00Stefan Metzmacher1-0/+1
metze
2012-06-22ldb: lay foundation for proper utc/generalized time handlingMatthieu Patou3-5/+42
We use to handle UTCtime and generalized time the same way. The thing is that it's not the case, they are different in the way they are set (most of the time) with different format and also stored and return in different format too.
2012-06-22ldb: add the VERIFY_NAME controlMatthieu Patou2-0/+68
2012-06-22dbwrap: don't ignore the result of dbwrap_parse_record in dbwrap_fetch_int32()Stefan Metzmacher1-1/+5
metze Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Fri Jun 22 17:10:52 CEST 2012 on sn-devel-104
2012-06-22dbwrap: intialize state.status in dbwrap_fetch_int32()Stefan Metzmacher1-0/+2
This might not be needed, but it makes it more clear that we won't use uninitialized memory, it the callback was not triggered. metze
2012-06-22dbwrap: Convert fetch_int32 to dbwrap_parse_recordVolker Lendecke1-13/+24
Now dbwrap_fetch_int32 is used in smbd/locking/posix.c is used a lot more often than before. Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-22dbwrap: Add dbwrap_fetch_int32Volker Lendecke2-3/+11
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-22dbwrap: Add dbwrap_change_int32_atomicVolker Lendecke2-9/+21
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-22tdb: don't use err.h in tests.Rusty Russell21-22/+1
It's not portable. While we could use ccan/err, it seems overkill since we actually only use it in one test (I obviously cut & paste the #include). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User(master): Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date(master): Fri Jun 22 09:22:28 CEST 2012 on sn-devel-104
2012-06-22tdb: make TDB_NOSYNC merely disable sync.Rusty Russell3-15/+20
(As suggested by Stefan Metzmacher, based on the change to ntdb.) Since commit ec96ea690edbe3398d690b4a953d487ca1773f1c, we handle the case where a process dies during a transaction commit. Unfortunately, TDB_NOSYNC means this no longer works, as it disables the recovery area as well as the actual msync/fsync. We should do everything except the syncs. This also means we can do a complete test with $TDB_NO_FSYNC set; just to get more complete coverage, we disable it explicitly for one test (where we override the actual sync calls anyway). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22dbwrap: dbwrap_hash_size().Rusty Russell7-0/+12
Implemented for ntdb and tdb; falls back to 0 for others. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22dbwrap: dbwrap_name().Rusty Russell7-1/+11
Useful for debug messages: particularly once we start switching between .tdb and .ntdb files. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22dbwrap: dbwrap_transaction_start_nonblock().Rusty Russell4-0/+26
Implemented for ntdb and tdb; falls back to the blocking variant for others. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22dbwrap: dbwrap_fetch_locked_timeout().Rusty Russell4-0/+52
Implemented for ntdb and tdb; falls back to the non-timeout variant for others. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22dbwrap: add dbwrap_check() function.Rusty Russell4-0/+31
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22dbwrap: dbwrap_local_open()Rusty Russell4-0/+92
This simply opens a tdb: it will eventually switch depending on the extension. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22dbwrap: remove get_flags().Rusty Russell5-24/+0
The flags returned were TDB-specific: this was only used for detecting the endianness of obsolete databases (the conversion code was put in in 2003, with reference to Samba 2.3). It's easier to remove it than to translate the NTDB flags to TDB flags, and it's a really weird thing to ask for anyway. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22util_tdb: move timeout chainlock variants from source3/lib/util/util_tdb.cRusty Russell3-1/+98
We're about to use them for dbwrap. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22util: util_ntdb ntdb_fetch_int32/ntdb_store_int32 and ntdb_add_int32_atomicRusty Russell2-0/+89
Similar to the util_tdb versions, but return the error code. ntdb_add_int32_atomic seems a clearer name than tdb_change_int32_atomic. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22util: util_ntdb.c gets NTDB_ERROR => NTSTATUS map.Rusty Russell2-0/+49
Very similar to the tdb version. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22util: util_ntdb.c gains bystring functions.Rusty Russell2-1/+85
Very similar to the util_tdb versions, but these return the error. I've only implemented those functions actually used. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22util: ntdb_new() supports NTDB_CLEAR_IF_FIRST.Rusty Russell2-1/+99
There are various issues with NTDB_CLEAR_IF_FIRST which makes it better if we don't have to use it, but much of the code does, so we fake up support here. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22util: util_ntdb.cRusty Russell3-0/+168
The first function is ntdb_new: this is preferred over ntdb_open, as it makes the ntdb_context returned (and all NTDB_DATA returned from ntdb_fetch) valid talloc pointers. The API is very similar to tdb_wrap_open(). Note that we handle $TDB_NO_FSYNC here, since ntdb doesn't do that hack (and it's great for speeding up testing!). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22ntdb: take advantage of direct access across expand.Rusty Russell1-33/+15
This means we no longer have to unmap if we want to compare a record. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22ntdb: test arbitrary operations during ntdb_parse_record().Rusty Russell2-0/+90
In particular, this tests that we can store enough records to make the database expand while we map the given record. We use a global lock for this, but it could happen in theory with another process. It also tests the that we can recurse inside ntdb_parse_record(). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22ntdb: make database read-only during ntdb_parse() callback.Rusty Russell6-24/+195
Since we have a readlock, any write will grab a write lock: if it happens to be on the same bucket, we'll fail. For that reason, enforce read-only so every write operation fails (even for NTDB_NOLOCK or NTDB_INTERNAL dbs), and document it! Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22ntdb: allow direct access for NTDB_INTERNAL dbs during expansion.Rusty Russell1-14/+45
NTDB_INTERNAL databases need to malloc and copy to keep old versions around if we expand, in a similar way to the manner in which keep old mmaps around. Of course, it only works for read-only accesses, since the two copies are not synced. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22ntdb: enhancement to allow direct access to the ntdb map during expansion.Rusty Russell5-33/+86
This means keeping the old mmap around when we expand the database. We could revert to read/write, except for platforms with incoherent mmap (ie. OpenBSD), where we need to use mmap for all accesses. Thus we keep a linked list of old maps, and unmap them when the last access finally goes away. This is required if we want ntdb_parse_record() callbacks to be able to expand the database. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22ntdb: don't munmap the database on every close.Rusty Russell2-13/+16
Since we can have multiple openers, we should leave the mmap in place for the other openers to use. Enhance the test to check the bug (it still works, because without mmap we fall back to read/write, but performance would be terrible!). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22ntdb: hand correct error code when alloc_read allocation fails.Rusty Russell1-1/+1
-ECUTNPASTE. This is not a usage error! Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22autobuild: always set TDB_NO_FSYNC.Rusty Russell1-0/+4
Then we unset it inside the tdb test target itself. This means that new code can't accidently forget it, and we can set it in the 'buildnice' script on sn-devel, for example. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22ntdb: respect TDB_NO_FSYNC flag for 'make test'Rusty Russell51-151/+187
This reduces test time from 31 seconds to 6, on my laptop. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-21Add --disable-ntdb option for building.Jelmer Vernooij1-0/+1
Autobuild-User(master): Jelmer Vernooij <jelmer@samba.org> Autobuild-Date(master): Thu Jun 21 19:59:57 CEST 2012 on sn-devel-104
2012-06-20ntdb: fix occasional abort in testing.Rusty Russell1-1/+7
Occasionally, the capability test inserts multiple used records and they clash, but our primitive test layout engine doesn't handle hash clashes and aborts. Force a seed value which we know doesn't clash. Reported-by: Andrew Bartlett <abartlet@samba.org> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User(master): Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date(master): Wed Jun 20 16:50:20 CEST 2012 on sn-devel-104
2012-06-19ntdb: add autoconf support.Rusty Russell1-0/+41
This is copied from tdb; we build the utilities, but as nothing else links against it, we shouldn't be adding anything to the normal samba binary sizes. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User(master): Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date(master): Tue Jun 19 07:31:06 CEST 2012 on sn-devel-104
2012-06-19lib/tdb_wrap: use tdb directly, not tdb_compat.Rusty Russell3-4/+6
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-19ldb: use tdb directly, not tdb_compat.Rusty Russell8-21/+24
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-19lib/dbwrap: depend directly on tdb, not tdb_compat.Rusty Russell1-1/+1
Simple change, as we get rid of tdb_compat in favour of either ntdb directly or dbwrap. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-19lib/util_tdb: depend directly on tdb, not tdb_compat.Rusty Russell2-5/+5
Simple change, as we get rid of tdb_compat in favour of tdb directly. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-19ntdb: update documentation.Rusty Russell6-5821/+505
Update the design.lyx file with the latest status and the change in hashing. Also, refresh and add examples to the TDB_porting.txt file. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-19ntdb: optimize ntdb_fetch.Rusty Russell7-51/+59
We access the key on lookup, then access the data in the caller. It makes more sense to access both at once. We also put in a likely() for the case where the hash is not chained. Before: Adding 1000 records: 3644-3724(3675) ns (129656 bytes) Finding 1000 records: 1596-1696(1622) ns (129656 bytes) Missing 1000 records: 1409-1525(1452) ns (129656 bytes) Traversing 1000 records: 1636-1747(1668) ns (129656 bytes) Deleting 1000 records: 3138-3223(3175) ns (129656 bytes) Re-adding 1000 records: 3278-3414(3329) ns (129656 bytes) Appending 1000 records: 5396-5529(5426) ns (253312 bytes) Churning 1000 records: 9451-10095(9584) ns (253312 bytes) smbtorture results (--entries=1000) ntdb speed 183881-191112(188223) ops/sec After: Adding 1000 records: 3590-3701(3640) ns (129656 bytes) Finding 1000 records: 1539-1605(1566) ns (129656 bytes) Missing 1000 records: 1398-1440(1413) ns (129656 bytes) Traversing 1000 records: 1629-2015(1710) ns (129656 bytes) Deleting 1000 records: 3118-3236(3163) ns (129656 bytes) Re-adding 1000 records: 3235-3355(3275) ns (129656 bytes) Appending 1000 records: 5335-5444(5385) ns (253312 bytes) Churning 1000 records: 9350-9955(9494) ns (253312 bytes) smbtorture results (--entries=1000) ntdb speed 180559-199981(195106) ops/sec
2012-06-19ntdb: add -h arg to ntdbrestoreRusty Russell1-8/+28
Since our default hashsize is 8192 not 131, we look fat when we convert near-empty TDBs. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>