1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-02 00:23:50 +03:00
Commit Graph

36 Commits

Author SHA1 Message Date
Jeremy Allison
ef8da16983 Fix bug where tdb lock call interrupted with
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.
2007-11-06 21:47:57 -08:00
Jeremy Allison
f35a266b3c RIP BOOL. Convert BOOL -> bool. I found a few interesting
bugs in various places whilst doing this (places that assumed
BOOL == int). I also need to fix the Samba4 pidl generation
(next checkin).
Jeremy.
2007-10-18 17:40:25 -07:00
Michael Adam
9b25355dd6 r24877: Don't panic in tdb validation code when the fork or waitpid fails.
Return error instead.

Michael
2007-10-10 12:30:28 -05:00
Michael Adam
dc0b08e659 r24848: Make tdb_validate() take an open tdb handle instead of a file name.
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
2007-10-10 12:30:27 -05:00
Michael Adam
cb3583b392 r24847: Change standard failure return code of tdb_validate from "-1" to "1".
(This is more safely used with casts from int to uint8, e.g.)

Michael
2007-10-10 12:30:27 -05:00
Volker Lendecke
3eee1fe280 r24267: Fix the build farm
I had only tested with "net getlocalsid". posix_locking_init() calls this
with a NULL name...
2007-10-10 12:29:22 -05:00
Volker Lendecke
e9bd7a63a8 r24265: Add the tdb_hashsize:<tdbname> parameter
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
2007-10-10 12:29:21 -05:00
Michael Adam
f81f2bf480 r23981: Make tdb_validate_and_backup try harder to end up with a valid tdb:
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
2007-10-10 12:28:52 -05:00
Michael Adam
909172839a r23975: Enhance some debug output. 2007-10-10 12:28:51 -05:00
Michael Adam
efabd7fe03 r23957: Use tdb_open_log instead of tdb_open.
Michael
2007-10-10 12:28:49 -05:00
Michael Adam
1c36ccd86d r23952: Streamline and improve the logic of tdb_validate_and backup:
- 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
2007-10-10 12:28:49 -05:00
Michael Adam
6bd2c48921 r23938: Add a debug message. 2007-10-10 12:28:47 -05:00
Michael Adam
e56be59947 r23932: Fill extended status with information in case the validation traverse
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
2007-10-10 12:28:46 -05:00
Michael Adam
ca63a99b61 r23930: Introduce tdb_validate_and_backup:
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
2007-10-10 12:28:46 -05:00
Michael Adam
b636f8cdad r23828: Add entry and exit debug statments to tdb_validate
at a lower debug level.

Michael
2007-10-10 12:28:31 -05:00
Michael Adam
9794b94ebf r23822: Clean some debugging output (as well in content and
amount as in source code formatting...)

Michael
2007-10-10 12:28:30 -05:00
Michael Adam
9415ea0fde r23819: It is currently unnecessary to pass the extended validation status
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
2007-10-10 12:28:30 -05:00
Michael Adam
ef40ef6764 r23814: Fix a couple of comments and debug messages. 2007-10-10 12:28:29 -05:00
Andrew Tridgell
b0132e94fc r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text 2007-10-10 12:28:22 -05:00
Jeremy Allison
407e6e695b r23779: Change from v2 or later to v3 or later.
Jeremy.
2007-10-10 12:28:20 -05:00
Michael Adam
821bc84109 r23769: Move removal of the tdb from the generic tdb_validate function
to the caller (winbindd_validate_cache in this case).
Next, there will be a backup handling for the tdb files.

Michael
2007-10-10 12:23:55 -05:00
Michael Adam
b68856d990 r23751: Call tdb_close even when validation was not successful.
Michael
2007-10-10 12:23:52 -05:00
Michael Adam
d4accdbb52 r23639: Eliminate trailing whitespaces in the new tdb_validate functions...
Michael
2007-10-10 12:23:39 -05:00
Michael Adam
062d8c6129 r23610: Move some winbindd_cache specific flags and actions
back to winbindd_cache.c. The generic mechanism
should open the cache tdb readonly and with default
flags.

Michael
2007-10-10 12:23:36 -05:00
Michael Adam
527edfa0cb r23600: First step in abstracting the winbindd cache validation
code into a generic tdb validation code.
In lib/util_tdb.c for a start.

Michael
2007-10-10 12:23:35 -05:00
James Peach
171dc060e2 r23510: Tidy calls to smb_panic by removing trailing newlines. Print the
failed expression in SMB_ASSERT.
2007-10-10 12:23:23 -05:00
Volker Lendecke
c0f40eb584 r23362: Respect "use mmap" in tdb_wrap_open(). Tridge, you might want to merge
this in your tree.
2007-10-10 12:23:10 -05:00
Volker Lendecke
02beae81c8 r23170: Add map_nt_error_from_tdb() 2007-10-10 12:22:51 -05:00
Stefan Metzmacher
3a28443079 r22009: change TDB_DATA from char * to unsigned char *
and fix all compiler warnings in the users

metze
2007-10-10 12:19:00 -05:00
Stefan Metzmacher
d030947083 r22007: make string_tdb_data(NULL) possible...
metze
2007-10-10 12:19:00 -05:00
Stefan Metzmacher
815ef8acdc r21972: - add string_term_tdb_data() it creates a null-terminates tdb key 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
2007-10-10 12:18:54 -05:00
Volker Lendecke
a2e27c4431 r21960: Fix bugs 4463,4464,4465,4466. Thanks Jason :-) 2007-10-10 12:18:52 -05:00
Volker Lendecke
c01f164dca r21076: Two pieces of infrastructure from Samba4: An API-compatible messaging wrapper
and tdb_wrap_open.

Volker
2007-10-10 12:17:33 -05:00
Volker Lendecke
5ec7379220 r19841: Wrap regdb_store_keys and regdb_store_values in tdb transactions 2007-10-10 12:16:01 -05:00
Volker Lendecke
c73d0815a3 r19448: Convert delete_share_security to struct share_params plus some cleanups 2007-10-10 12:15:36 -05:00
Andrew Tridgell
1ad563286f r19429: moved tdb/common/tdbutil.c into lib/util_tdb.c
see discussion on samba-technical
2007-10-10 12:15:35 -05:00