1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

217 Commits

Author SHA1 Message Date
Jeremy Allison
1233b553e7 Added int32 version of "atomic" update.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
d57fb9a8c2 Added int32 versions of the endian-dependent code.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
a0cdec3acc Fixed nasty cast of tdb_delete in traversals.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
eb66074665 debug statement fixups.
Merge SAFE_FREE fix in tdb from 2.2, and IRIX fix.
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
65e857b36e more irix -64 portability fixes 0001-01-01 00:00:00 +00:00
Martin Pool
79feca4d25 Ignore torture.tdb 0001-01-01 00:00:00 +00:00
Andrew Tridgell
412e79c448 net ads password and net ads chostpass commands from Remus Koos 0001-01-01 00:00:00 +00:00
Jeremy Allison
1d2504b5c7 Must check against -1 for fcntl error check.
Jeremy
0001-01-01 00:00:00 +00:00
Herb Lewis
fe0db4c55f add *.po32 to ignore list 0001-01-01 00:00:00 +00:00
Jeremy Allison
9e3581827d Fix up warnings. Make tdb_openXX() names const.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
b03aaddcf3 Tidyups to remove warnings on tdb standalone code.
Jeremy.
0001-01-01 00:00:00 +00:00
Martin Pool
6c684c89a4 Doc. 0001-01-01 00:00:00 +00:00
Martin Pool
caa08bb56e Allow for internal databases which may have no name. 0001-01-01 00:00:00 +00:00
Martin Pool
8118676f78 Log more error messages. 0001-01-01 00:00:00 +00:00
Martin Pool
b50e566ab9 Log more error messages. 0001-01-01 00:00:00 +00:00
Martin Pool
a228c7efcc Allocate tdb name up front in case log functions want to use it. 0001-01-01 00:00:00 +00:00
Martin Pool
b1d7d80068 tdb_open_ex: More cleanups: just dynamically allocate the TDB_CONTEXT
up front, rather than working on the stack and then copying across.
0001-01-01 00:00:00 +00:00
Martin Pool
52ef112e10 Refactor code to check whether already open into its own function. 0001-01-01 00:00:00 +00:00
Martin Pool
fe901ec194 tdb_open_ex should always "goto fail" in case of error, rather than
just returning.  I don't think this would leak at the moment, but it's
an accident waiting to happen.
0001-01-01 00:00:00 +00:00
Martin Pool
bb6c0df4bc Doc. 0001-01-01 00:00:00 +00:00
Martin Pool
fac685d30f tdb_open_ex: Continue previous refactoring so that we consistently
just say "tdb" not "&tdb".
0001-01-01 00:00:00 +00:00
Martin Pool
d159415049 tdb_open_ex: Refactor to use a pointer to tdb, rather than an auto
tdb, to be consistent with the rest of the code.
0001-01-01 00:00:00 +00:00
Tim Potter
d902baf709 Formatting fixup. 0001-01-01 00:00:00 +00:00
Andrew Tridgell
c4f5a6c65d added a simple tdbdump utility 0001-01-01 00:00:00 +00:00
Jean-François Micouleau
7e20fad5ed changed the DEBUG level of tdb_pack and tdb_unpack. Instead of 8, it's now
18.

when you're looking at a level 10, and it's all clutered with
tdb_pack/unpack, it's getting .... And anyway most of our code using
tdb_pack/unpack have DEBUG around the call if there is a problem.

	J.F.
0001-01-01 00:00:00 +00:00
Jeremy Allison
837f2b961b Tidup.
Jeremy.
0001-01-01 00:00:00 +00:00
Martin Pool
3dbb5dfcfb Put back changes to set errno, which seem to do no harm. 0001-01-01 00:00:00 +00:00
Martin Pool
58cfea3c2a Fix headers. This I know is correct. 0001-01-01 00:00:00 +00:00
Martin Pool
0c22a10d73 Fix headers. This I know is correct. 0001-01-01 00:00:00 +00:00
Martin Pool
fc176f15f2 undo 0001-01-01 00:00:00 +00:00
Martin Pool
391a65395e Implement suggestion from tridge to leave the old tdb_open interface
as it was, and add tdb_open_ex() which takes a log callback.  I guess
this makes more sense since it's a public interface.
0001-01-01 00:00:00 +00:00
Martin Pool
0aa800618e Better error handling:
- tdb_open api changed so that you now pass an error handling
   callback when opening the file, so that errors detected during
   opening have somewhere to go.  (All calls from the body of Samba to
   this function go through a wrapper in tdbutil, which has been
   updated.)

 - Clean up logic for deciding how to open tdb.  Emit log messages if
   something goes wrong (e.g. bad magic.)

 - tdbtool now logs errors to stderr.
0001-01-01 00:00:00 +00:00
Martin Pool
e9085129dd Magic file for TDB databases. 0001-01-01 00:00:00 +00:00
Martin Pool
5630a988be Set errno in tdb_open in cases where we detect an error in opening the
database, but no underlying system call sets errno.

The particular case I had was a mangled .tdb, but there are others.
For this one, set EIO.  It's a shame Unix messages aren't more
detailed -- "bad data format" would be better.
0001-01-01 00:00:00 +00:00
Jeremy Allison
2a7bd621b4 Added prototypes for new fns. Thanks Elrond.
Jeremy.
0001-01-01 00:00:00 +00:00
Tim Potter
a1cf70ab65 Don't display any data if tdb_fetch() failed in the tdbtool "fetch"
command.
0001-01-01 00:00:00 +00:00
Tim Potter
303b3a3595 Updated definition of fstring.
print_asc(): Don't try to print a trailing NULL character
print_key(), print_rec(): Display key in ASCII
0001-01-01 00:00:00 +00:00
Tim Potter
1d2305c233 Added a 'keys' command to tdbtool which prints out all keys in the tdb. 0001-01-01 00:00:00 +00:00
Tim Potter
dad688d8c6 Removed #ifdef TDB_DEBUG around tdb_dump_all() and tdb_printfreelist()
so that tdbtool can be compiled without having to make clean.
0001-01-01 00:00:00 +00:00
Jeremy Allison
21f776df59 Don't core dump when using spinlocks on a read-only tdb. Unfortunately this
means that a read-write opener and a read-only opener are using different
locking mechanisms - this needs to be addressed, but it's hard as the
read-write opener using the spinlocks is usually first, so there's no
way to force them to change down to the fcntl method.
Read only access is less important anyway and can never corrupt the
tdb anyway, so errors in read-only record reads are more tolerable.
Jeremy
0001-01-01 00:00:00 +00:00
Jeremy Allison
2b135fba62 Fix for tdb_oob() on TDB_INTERNAL databases.
Jeremy.
0001-01-01 00:00:00 +00:00
Anton Blanchard
6612abf827 PPC spinlocks work again. Sorry, my bad. 0001-01-01 00:00:00 +00:00
Jeremy Allison
a71d9d98b0 Ensure accessing NT member servers works with a Samba PDC. Don't
change these timestamp settings without good reason.
Remove CLEAR_IF_FIRST flag is tdb is read-only.
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
2f44756233 fixed compilation of tdbtorture 0001-01-01 00:00:00 +00:00
Andrew Tridgell
b8d9d1fca3 tdbtorture updates from when I was trying to track down the hp tdb bug 0001-01-01 00:00:00 +00:00
Jeremy Allison
a3267551d8 Put pwrite code back in expand_file.
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
f49518e497 added a hook to reopen all tdb's after the server fork
this prevents the fd seek pointer problem
0001-01-01 00:00:00 +00:00
Jeremy Allison
0e75c0fc1a Fix based on Andrew's insight as re-using a tdb after fork means
parent and child share seek pointer. Damn....
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
b45793ec3f Return correct error code on lock fail in tdb_expand.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
e4b41a8f31 Roll back earlier fix after talking with Andrew. The write_lock_record and
unlock are explicitly non-blocking. I will add a comment to this effect later.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
313c2e8652 Fixed a couple of nasty bugs only easily seen with no mmap. Firstly,
map_ptr not neccessarily set to NULL if no mmap, secondly, iterating
through a tdb was using SETLK, instead of SETLKW - would almost never
fail with mmap as the time holding the lock was so short, but was
easily seen with read/write. One finaly bug needs tracking down w.r.t.
traversal......
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
d32ac363a5 flush stdout in test logging fns 0001-01-01 00:00:00 +00:00
Andrew Tridgell
931bded1c9 use a different test tdb name for tdbtest and tdbtorture 0001-01-01 00:00:00 +00:00
Andrew Tridgell
b36c98036b actually obey the "use mmap" smb.conf option 0001-01-01 00:00:00 +00:00
Tim Potter
888c852f01 Renamed rwlock_t type to tdb_rwlock_t to avoid conflict with Solaris 8
header files.
0001-01-01 00:00:00 +00:00
Anton Blanchard
a58b89d339 Add missing gcc memory barriers, this bug showed up when doing a
heavy netbench run. :)

Rework ppc spinlocks to be faster.
0001-01-01 00:00:00 +00:00
Tim Potter
78207d0fc8 Patch for having spaces in tdb keys, NULL termination fixes and other
stuff.  From Andrew Esh <AEsh@tricord.com>
0001-01-01 00:00:00 +00:00
Volker Lendecke
b4f06c3ecf Print an error message if database could not be opened.
Volker
0001-01-01 00:00:00 +00:00
Jeremy Allison
38d2e6983a Added mmap fix to pass lock test from HP.
Ok - now we're no longer trying to reach a silly 1k loc target,
change the formatting to be *readable* - eg.
change if (x) y else z to be :
if (x)
    y
else
    z

and other compact sillyness. Oh look - when I did this I found
some areas where we *WEREN'T CHECKING SYSTEM CALL ERROR RETURNS !!!!*
CompSci 101 guys....... :-).
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
aaa56bb3a3 Fix for rare tdb pattern store failure. Found & fixed by Rusty.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
34951876a1 Always check fstat for error.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
c8c138c1fb Fix for enumerating large numbers of users.
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
1f6240daae removed some debug code 0001-01-01 00:00:00 +00:00
Jeremy Allison
2d1c6d1f6b Ok - I misspoke.... mmap returns MAP_FAILED, not neccessarily -1 :-).
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
b77c8b536d When mmap fails it returns -1 *NOT NULL*.
This got regressed somehow.....
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
fc7830eec8 Fixed potential free of NULL found by SGI speedshop.
Jeremy.
0001-01-01 00:00:00 +00:00
Tim Potter
870e9e4e89 Added *.po to .cvsignore files. 0001-01-01 00:00:00 +00:00
Andrew Tridgell
200b682e9b merged fix for tdb_unpack from 2_2 0001-01-01 00:00:00 +00:00
Andrew Tridgell
c20838c635 added list function to tdbtool 0001-01-01 00:00:00 +00:00
Andrew Tridgell
6e1277df9d - fixed an off-by-1 bug in the delayed deletion code that I believe
was the initial cause of the connections database becoming corrupt.
  Note that this bug only happens when doing deletions within a
  traversal, which is why it has only showed up now
- added delete within traversal testing to tdbtorture
- added a lot more logging to tdb
0001-01-01 00:00:00 +00:00
Andrew Tridgell
3ab770484c added a tdb_open_log() function that opens a tdb and enables logging
of messages from the tdb code into the Samba DEBUG() system
just call tdb_open_log() instead of tdb_open() to enable this on
any tdb
0001-01-01 00:00:00 +00:00
Andrew Tridgell
ba106b9b07 more portable TDB_LOG macro 0001-01-01 00:00:00 +00:00
Andrew Tridgell
dda086fdf9 try to make the tailer code much more robust. When a record
can't be merged don't fail the operation, instead just add
it to the free list anyway

added logging to tdb
0001-01-01 00:00:00 +00:00
Jeremy Allison
cf5015f159 Added tdb_change_int_atomic() to allow atomic updates of a tdb int value.
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
b94cfb6843 make sure that when a tdb expands we fill the expanded area, otherwise ENOSPC could be very bad 0001-01-01 00:00:00 +00:00
Jeremy Allison
0852465053 Implemented max connections in a similar way to 2.0.x (scan of connection db).
This needs testing !
Tidied up tabs in tdb.c.
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
ce6598c465 clearer tdb_mmap code 0001-01-01 00:00:00 +00:00
Andrew Tridgell
13bf966cb8 merge from 2.2 0001-01-01 00:00:00 +00:00
Jeremy Allison
4c6a8273c6 Fix problem with OpenBSD mmap and write not being coherent.
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
f52a5014ee merge from 2.2 0001-01-01 00:00:00 +00:00
Tim Potter
d05c3cf0f4 Getting medieval with compiler warnings as Jeremy puts it. 0001-01-01 00:00:00 +00:00
Jeremy Allison
d6889b1954 Fix for True64 treating readonly as a reserved word !
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
fc76681812 Merge of Andrew's changes in 2.2.
Jeremy.
0001-01-01 00:00:00 +00:00
Tim Potter
cda0f211b0 Fixed some compiler warnings. 0001-01-01 00:00:00 +00:00
Jeremy Allison
e404e00199 Added HAVE_STDARG_H to tdbutil.c
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
a500519544 optimise by default 0001-01-01 00:00:00 +00:00
Jeremy Allison
408672d382 It compiles for me now :-). rpc_server/srv_lsa.c - added fix to allow w2k
clients to join a Samba domain - odd or even domain name length. Needs more testing.
Jeremy.
0001-01-01 00:00:00 +00:00
David O'Neill
025f7a092a Changes from APPLIANCE_HEAD:
source/include/proto.h
        - make proto

    source/printing/nt_printing.c
    source/rpc_server/srv_spoolss_nt.c
        - Fix for the overwriting of printerdata entries when WinNT and
          Win2k are modifying printer parameters on PCL printers. Turns out
          that Win2k creates a printer with a NULL devmode entry and then
          expects to set it on *OPEN* (yes this is insane). So we cannot
          return a "default" devmode for a printer - and we must allow an
          open to set it.

    source/tdb/tdb.c
        - Show freelist in an easier format. Show total free.
        - When storing a new record, allocate memory for the key + data
          before the tdb_allocate() as if the malloc fails a (sparse) hole
          is left in the tdb.

    source/tdb/tdbtool.c
        - Show freelist in an easier format. Show total free.

    source/tdb/Makefile
        - cleaned up Makefile dependancies

    source/smbd/lanman.c
        -  Fix for Win9x corrupting it's own parameter string.

    source/printing/printfsp.c
    source/printing/printing.c
    source/rpc_server/srv_spoolss_nt.c
    source/smbd/close.c
        - Added normal close parameter into print_fsp_end() which treats an
          abnormal close as error condition and deletes the spool file.
0001-01-01 00:00:00 +00:00
Tim Potter
cef7f58ac5 Set the tdb->map_ptr to NULL if mmap() returns -1. 0001-01-01 00:00:00 +00:00
Christopher R. Hertel
e651d1d642 The line was:
struct tdb_traverse_lock tl = { tdb->travlocks.next, 0, 0 };

The IRIX compiler complained that the first initialization value was not a
constant and errored out.  Here's what it looks like now:

        struct tdb_traverse_lock tl = { NULL, 0, 0 };
        int ret, count = 0;

        /* This was in the initializaton, above, but the IRIX compiler
         * did not like it.  crh
         */
        tl.next = tdb->travlocks.next;

That worked.

Chris -)-----
0001-01-01 00:00:00 +00:00
Jeremy Allison
506b5e34c3 Added lock backouts on fail.
When chaining together long lines of bloody "if" statements, which should
logically be separated, and one of them allocates memory, remember to
*free* it *WHETHER OR NOT THE IF STATEMENTS SUCCEEDED* !!!!
Yes I do consider this a bug in the coding style of Tridge, Rusty, Tim et al. :-).
I'm just pissed 'cos this took 4 hours to track down even with an insure error report
stating me in the face and also Ben Woodward looking over the code with me :-).
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
dd959fa325 Two tdb bugfixes. First one - ensure that traverse lock is moved before deleting
dead records, else the record is just marked for deletion, not actually deleted.
Second, ensure allocated record is marked as "in use" before free list lock is
released, else other processes in the freelist merge code may try and merge it.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
cfc62fecdf Added Tim's fix for read-only crashes.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
f3b5e2a172 Fixed bug with tdb_next_lock failing when reaching then end of a hashchain
and the next hashchain is empty.
Jeremy
0001-01-01 00:00:00 +00:00
Tim Potter
2c9704c3db tdb_chainunlock() no longer returns a value. 0001-01-01 00:00:00 +00:00
Jeremy Allison
9dea7b7c25 Changed to sourceforge tdb code. This includes spinlocks (so we now have
a --with-spinlocks option to configure, this does mean the on-disk tdb
format has changed, so 2.2alphaX sites will need to re-create their
tdb's. The upside is no more tdb fragmentation and a +5% on netbench.
Swings and roundabouts....
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
c9884e16fc Fixed one tdb_read -> rec_free_read call.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
7ae54a93e7 Added sorted freelist neighbour merge code to stop tdb fragmentation.
This needs TESTING !!! (It passes tdbtest of course :-).
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
ee89ca9e68 Added print_freelist command.
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
b64e1ae693 change the split threahold for the free list to prevent freelist
fragmentation
0001-01-01 00:00:00 +00:00