summaryrefslogtreecommitdiff
path: root/source3/lib/util_tdb.c
AgeCommit message (Collapse)AuthorFilesLines
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)
2007-10-10r23938: Add a debug message.Michael Adam1-0/+2
(This used to be commit 6bd2c48921dd8dbf2885a8135ba01a1324e020c8)
2007-10-10r23932: Fill extended status with information in case the validation traverseMichael Adam1-1/+5
functions did not do so but returned an error. (This is the case when error occurred deeper than at the level of the content checking done by the per entry validate_fn.) Michael (This used to be commit e56be59947a29d0a5692f3f3bc6c089dd8b4b5d9)
2007-10-10r23930: Introduce tdb_validate_and_backup:Michael Adam1-1/+239
This is a wrapper around tdb_validate, that does backup handling: * if the given tdb is valid, a backup is created (name.bak) * if the tdb is invalid, if a valid bakup is found (validated with the same validation function) under the name "name.bak" the orignal tdb is moved to name.corrupt and the backup is restored. For the backup handling, a variant of the backup_tdb function from lib/tdb/tools/tdbbackup.c is included in lib/util_tdb.c. The copy function for the traverse action eliminates the need to maintain a global success state by using a struct wrapping the target tdb and a success flag as the private data. Michael (This used to be commit ca63a99b6188c0976603dc2852e478cc7a6b2f8b)
2007-10-10r23828: Add entry and exit debug statments to tdb_validateMichael Adam1-0/+5
at a lower debug level. Michael (This used to be commit b636f8cdad72a9a9bc1d302d8d681dca2da6105a)
2007-10-10r23822: Clean some debugging output (as well in content andMichael Adam1-34/+19
amount as in source code formatting...) Michael (This used to be commit 9794b94ebf79686da2e1b3ae343953581e3459a1)
2007-10-10r23819: It is currently unnecessary to pass the extended validation statusMichael Adam1-42/+10
from the validating child process down to the parent though the pipe. All the parent evaluates is the overall success, so the exit status should do. Michael (This used to be commit 9415ea0fde2ff0c801d043ce77b778fceedb6592)
2007-10-10r23814: Fix a couple of comments and debug messages.Michael Adam1-7/+7
(This used to be commit ef40ef67649c8793921619c128e2923e20aa68da)
2007-10-10r23784: use the GPLv3 boilerplate as recommended by the FSF and the license textAndrew Tridgell1-2/+1
(This used to be commit b0132e94fc5fef936aa766fb99a306b3628e9f07)
2007-10-10r23779: Change from v2 or later to v3 or later.Jeremy Allison1-1/+1
Jeremy. (This used to be commit 407e6e695b8366369b7c76af1ff76869b45347b3)
2007-10-10r23769: Move removal of the tdb from the generic tdb_validate functionMichael Adam1-6/+0
to the caller (winbindd_validate_cache in this case). Next, there will be a backup handling for the tdb files. Michael (This used to be commit 821bc84109625c9d85edee38fa26d16f9f0a0fe2)
2007-10-10r23751: Call tdb_close even when validation was not successful.Michael Adam1-9/+1
Michael (This used to be commit b68856d9902f41079224ba11c7d0ab811b082201)
2007-10-10r23639: Eliminate trailing whitespaces in the new tdb_validate functions...Michael Adam1-8/+7
Michael (This used to be commit d4accdbb5285216d532f57f545a846734a2fe774)
2007-10-10r23610: Move some winbindd_cache specific flags and actionsMichael Adam1-7/+1
back to winbindd_cache.c. The generic mechanism should open the cache tdb readonly and with default flags. Michael (This used to be commit 062d8c61294a1e9f8588fa8af31954dd286c7bde)
2007-10-10r23600: First step in abstracting the winbindd cache validationMichael Adam1-0/+203
code into a generic tdb validation code. In lib/util_tdb.c for a start. Michael (This used to be commit 527edfa0cbcb233218ebabc395666d1d7228ee37)
2007-10-10r23510: Tidy calls to smb_panic by removing trailing newlines. Print theJames Peach1-2/+2
failed expression in SMB_ASSERT. (This used to be commit 171dc060e2a576d724eed1ca65636bdafffd7713)
2007-10-10r23362: Respect "use mmap" in tdb_wrap_open(). Tridge, you might want to mergeVolker Lendecke1-0/+3
this in your tree. (This used to be commit c0f40eb5846f617d9c421136b0e1ea593c8d8458)
2007-10-10r23170: Add map_nt_error_from_tdb()Volker Lendecke1-0/+37
(This used to be commit 02beae81c8ecef7cfe300a29852d74813c9409bf)
2007-10-10r22009: change TDB_DATA from char * to unsigned char *Stefan Metzmacher1-15/+15
and fix all compiler warnings in the users metze (This used to be commit 3a28443079c141a6ce8182c65b56ca210e34f37f)
2007-10-10r22007: make string_tdb_data(NULL) possible...Stefan Metzmacher1-2/+2
metze (This used to be commit d03094708378bde088bf6e90efe54deb83d3952e)
2007-10-10r21972: - add string_term_tdb_data() it creates a null-terminates tdb key ↵Stefan Metzmacher1-23/+32
from a string (the current string_tdb_data() creates a non-terminates tdb key from a string!) - pass TDB_DATA instead of const char *, size_t len to some functions metze (This used to be commit 815ef8acdc7f89d30f3fd1812b12bd0e2dc62473)
2007-10-10r21960: Fix bugs 4463,4464,4465,4466. Thanks Jason :-)Volker Lendecke1-13/+0
(This used to be commit a2e27c443101a59ef3429a55e049af3ebd5ec1f2)
2007-10-10r21076: Two pieces of infrastructure from Samba4: An API-compatible ↵Volker Lendecke1-0/+98
messaging wrapper and tdb_wrap_open. Volker (This used to be commit c01f164dcaf88fb7f3bed8f69b210ba8fab326d1)
2007-10-10r19841: Wrap regdb_store_keys and regdb_store_values in tdb transactionsVolker Lendecke1-0/+8
(This used to be commit 5ec737922041b723b9e60c08049ace5fa2fa5dec)
2007-10-10r19448: Convert delete_share_security to struct share_params plus some cleanupsVolker Lendecke1-0/+29
(This used to be commit c73d0815a3a1f58b951caa62fac601a8f4630894)
2007-10-10r19429: moved tdb/common/tdbutil.c into lib/util_tdb.cAndrew Tridgell1-0/+811
see discussion on samba-technical (This used to be commit 1ad563286f00be0d72930b81b10cb74f13c5fbff)