summaryrefslogtreecommitdiff
path: root/source3/lib/util_tdb.c
AgeCommit message (Collapse)AuthorFilesLines
2013-04-18util_tdb: add function tdb_data_string()Gregor Beck1-0/+33
Signed-off-by: Gregor Beck <gbeck@sernet.de> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2012-08-31tdb: return unpack error on strdup failureDavid Disseldorp1-0/+3
Signed-off-by: Lars Müller <lars@samba.org> Autobuild-User(master): David Disseldorp <ddiss@samba.org> Autobuild-Date(master): Fri Aug 31 21:05:21 CEST 2012 on sn-devel-104
2012-06-22util_tdb: move timeout chainlock variants from source3/lib/util/util_tdb.cRusty Russell1-81/+0
We're about to use them for dbwrap. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-19TDB2: make SAMBA use tdb1 again for the moment.Rusty Russell1-106/+0
Otherwise the following surgery will break the SAMBA build and testsuite. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-04-18lib/util: Move map_nt_error_from_tdb to the top levelAndrew Bartlett1-58/+0
This will help with making dbwrap available as a top level library. Andrew Bartlett
2011-09-14util_tdb: return -1/0 from lock_with_timeout functions.Rusty Russell1-2/+2
Keeps the tdb2 API change (which returns error codes, rather than -1) localized. The function returns -1 down the other path, so make it consistent. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-09-14tdb_compat: adapt to tdb2 API change.Rusty Russell1-3/+4
Add the ecode arg to all the log functions, and log it. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-08-15s3:lib: fix a comment in tdb_unpack()Michael Adam1-1/+1
2011-08-15s3: avoid reading past the end of buffer in tdb_unpack 'f' if zero ↵Gregor Beck1-1/+1
termination is missing Signed-off-by: Michael Adam <obnox@samba.org>
2011-08-15s3: avoid reading past the end of buffer in tdb_unpack 'P' if zero ↵Gregor Beck1-1/+3
termination is missing Signed-off-by: Michael Adam <obnox@samba.org>
2011-06-20source3/lib/util_tdb.c: operation timeout support for TDB2.Rusty Russell1-0/+96
TDB2 doesn't have (the racy) signal pointer; the new method is to override the locking callbacks and do the timeout internally. The technique here is to invalidate the struct flock when the timeout occurs, so it works even if it happens before we enter the fcntl() call. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20tdb_compat: Higher level API fixes.Rusty Russell1-3/+3
My previous patches fixed up all direct TDB callers, but there are a few utility functions and the db_context functions which are still using the old -1 / 0 return codes. It's clearer to fix up all the callers of these too, so everywhere is consistent: non-zero means an error. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20tdb_compat: use tdb_open_compat.Rusty Russell1-6/+11
This is a helper for the common case of opening a tdb with a logging function, but it doesn't do all the work, since TDB1 and TDB2's log functions are different types. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20tdb2: #ifdef out TDB_ERR_NOLOCK and TDB_ERR_LOCK_TIMEOUT.Rusty Russell1-0/+4
These don't exist in tdb2. The former is used in one weird place in tdb1, and the latter not at all. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20tdb_chainlock: check returns for 0, not -1.Rusty Russell1-1/+1
TDB2 returns a negative error number on failure. This is compatible if we always check for != 0 instead of == -1. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20tdb_transaction_cancel: ignore return value.Rusty Russell1-6/+2
TDB2 returns void here. tdb_transaction_cancel will *always* return with the transaction cancelled, but it will complain via the log function if a transaction wasn't in progress. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-09s3-talloc Change TALLOC_REALLOC_ARRAY() to talloc_realloc()Andrew Bartlett1-1/+1
Using the standard macro makes it easier to move code into common, as TALLOC_REALLOC_ARRAY isn't standard talloc. Andrew Bartlett
2011-05-06s3: only include tdb headers where needed.Günther Deschner1-0/+2
Guenther
2011-05-06lib/util Move source3 tdb_wrap_open() into the common code.Andrew Bartlett1-159/+0
This #if _SAMBA_BUILD == 3 is very unfortunate, as it means that in the top level build, these options are not available for these databases. However, having two different tdb_wrap lists is a worse fate, so this will do for now. Andrew Bartlett
2011-03-30s3-includes: only include system/filesys.h when needed.Günther Deschner1-0/+1
Guenther
2010-03-14s3: Use a switch to implement map_nt_error_from_tdbVolker Lendecke1-30/+47
First, this immediately gave me the warning that TDB_ERR_NESTING was not covered and second, this saved 48 bytes in the .o :-)
2010-03-13s3: Make tdb_wrap_open more robustVolker Lendecke1-41/+87
This hides the use of talloc_reference from the caller, making it impossible to wrongly call talloc_free() on the result.
2010-02-23s3-lib: Remove obsolete signal type cast.Andreas Schneider1-3/+3
2009-08-07Fix some nonempty blank linesVolker Lendecke1-7/+7
2009-07-15Add tdb_data_cmpVolker Lendecke1-0/+19
2009-01-28s3: separate tdb validation code out into its own source fileMichael Adam1-484/+0
So this gets now linked only into its single user: winbindd (needed by winbindd_cache.c) Michael
2009-01-19Remove unused tdb_search_keys()Volker Lendecke1-68/+0
2009-01-16s3-util: for convenience, provide format comments in tdb_unpack().Günther Deschner1-7/+7
Guenther
2009-01-08Fix race condition in alarm lock processing noticed by Richard Sharpe ↵Jeremy Allison1-1/+1
<realrichardsharpe@gmail.com>. "It seems to me that if the lock is already held by another process when we enter this code, there is a race between the timeout and the granting. If the lock is subsequently granted, the process releasing the lock will signal the wait variable (or whatever) and our process will be scheduled. However, if the timeout occurs before we are scheduled, the timeout will be delivered first. We will have the lock but will forget we have the lock, and never release it." Jeremy.
2008-10-12Sync util_tdb implementations.Jelmer Vernooij1-297/+0
2008-04-12util_tdb: fix a segfault caused by a fatal typo.Michael Adam1-1/+1
In tdb_wrap_log(), in on occurrence of "debug_level = 0" instead of "debuglevel = 0" caused me segfaults when accessing DEBUGLEVEL (which is defined as "*debug_level"...) Michael (This used to be commit d9bd894c2ec4faf87e8ff96e27c7e2b8175f9387)
2008-03-26util_tdb: remove trivial and unused tdb_wipe().Michael Adam1-17/+0
It has been replaced by tdb_wipe_all(). Michael (This used to be commit cdde2e4eaca51d51f036ad99d55df7bfd6535b03)
2008-03-26util_tdb: make the _byblob fetch/store functions public again.Michael Adam1-4/+4
Users of these are currently being written... Michael (This used to be commit 1c51bec5318bad085c09931aa7e8f72f41d103fe)
2008-03-25util_tdb: add my (C) for the tdb validation codeMichael Adam1-0/+1
Michael (This used to be commit abf02a5a142c55d9e0053d319c867e4fcc3e6c30)
2008-03-25util_tdb: add a wrapper tdb_wipe() for traverse with tdb_traverse_delete_fn().Michael Adam1-2/+8
Replace all callers of traverse with this tdb_traverse_delete_fn() and don't export tdb_traverse_delete_fn() anymore. Michael (This used to be commit d4be4e30cd8c3bdc303da30e42280f892a45a8c9)
2008-03-25util_tdb: make the _byblob functions static - not currently used elsewhere.Michael Adam1-5/+5
Michael (This used to be commit b42cf3fc69414270be9d0f430f2e95a72894f00e)
2008-02-25Fix some warningsVolker Lendecke1-7/+9
warning: ignoring return value of 'asprintf', declared with attribute warn_unused_result (This used to be commit ad37b7b0aee265a3e4d8b7552610f4b9a105434d)
2008-01-27Adding missing calls to va_end().Tim Potter1-0/+1
Just a small commit to get a handle on this git thingy. This patch fixes some missing calls to va_end() to match various calls to va_start() and VA_COPY(). Tim. (This used to be commit ec367f307dff7948722b9ac97beb960efd91991f)
2007-12-03Change tdb_unpack "P" to return a malloc'ed string ratherJeremy Allison1-10/+9
than expect a pstring space to put data into. Fix the (few) callers. Jeremy. (This used to be commit 7722a7d2c63f84b8105aa775b39f0ceedd4ed513)
2007-11-06Fix bug where tdb lock call interrupted withJeremy Allison1-0/+2
an alarm sig would not terminate and could lead to runaway smbd processes. Thanks to Dave Daugherty @ Centrify for pointing this out to us. Jeremy. (This used to be commit ef8da1698371c95495add53df81a978df709c88d)
2007-10-18RIP BOOL. Convert BOOL -> bool. I found a few interestingJeremy Allison1-11/+11
bugs in various places whilst doing this (places that assumed BOOL == int). I also need to fix the Samba4 pidl generation (next checkin). Jeremy. (This used to be commit f35a266b3cbb3e5fa6a86be60f34fe340a3ca71f)
2007-10-10r24877: Don't panic in tdb validation code when the fork or waitpid fails.Michael Adam1-5/+7
Return error instead. Michael (This used to be commit 9b25355dd66519afd548fecbf2da7608b024a35b)
2007-10-10r24848: Make tdb_validate() take an open tdb handle instead of a file name.Michael Adam1-16/+41
A new wrapper tdb_validate_open() takes a filename an opens and closes the tdb before and after calling tdb_validate() respectively. winbindd_validata_cache_nobackup() now dynamically calls one of the above functions depending on whether the cache tdb has already been opened or not. Michael (This used to be commit dc0b08e6590caa4974fd4d9f34f39f261d1f1dee)
2007-10-10r24847: Change standard failure return code of tdb_validate from "-1" to "1".Michael Adam1-2/+2
(This is more safely used with casts from int to uint8, e.g.) Michael (This used to be commit cb3583b39212688a627a29bbddb2e98497714d42)
2007-10-10r24267: Fix the build farmVolker Lendecke1-2/+2
I had only tested with "net getlocalsid". posix_locking_init() calls this with a NULL name... (This used to be commit 3eee1fe28057e2e3da2e9d1506f57f3e35fd37b7)
2007-10-10r24265: Add the tdb_hashsize:<tdbname> parameterVolker Lendecke1-0/+22
This makes it possible to set the default hashsize for any tdb. I would like to remove the "open files database hash size" in favor of this one. I'll check that removal in with the next commit, please complain/revert if it's not ok. Volker (This used to be commit e9bd7a63a8d462b1fc3bab99ff843e25bffd156b)
2007-10-10r23981: Make tdb_validate_and_backup try harder to end up with a valid tdb:Michael Adam1-23/+60
If restoring a backup fails due to lack of space, remove the corrupt tdb previously moved away to "name.corrupt", and retry. If restoring still fails, move the backup in place instead of copying it. Michael (This used to be commit f81f2bf480a955213be8461636ee6f81643f17b8)
2007-10-10r23975: Enhance some debug output.Michael Adam1-2/+4
(This used to be commit 909172839a512b60db075fb1a7488345a2e48eb0)
2007-10-10r23957: Use tdb_open_log instead of tdb_open.Michael Adam1-6/+6
Michael (This used to be commit efabd7fe03733d1fcb02d0d270c18ede7836f3a9)
2007-10-10r23952: Streamline and improve the logic of tdb_validate_and backup:Michael Adam1-29/+63
- call tdb_validate on the given tdb. - if validation is successful, create a backup return 0 (success) even if the backup fails. - if validation fails: - move tdb to name.corrupt (don't exit if this fails) - look for a valid backup - if a valid backup is found, restore it, else return -1 (failure) if restoring succeeds, return 0 (success), else -1 (failure) Summing up: If 0 is returned, there is a valid tdb at the given location: either the original one ore one restrored from a backup. If -1 is returned, there is no valid tdb at the given location: Either there is no file at all, or the original file is still in place (if moving it away failed). Michael (This used to be commit 1c36ccd86d85b02f27ec66d37bdf7f04ad760901)