1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-12 20:58:37 +03:00

149 Commits

Author SHA1 Message Date
Jeremy Allison
eb66074665 debug statement fixups.
Merge SAFE_FREE fix in tdb from 2.2, and IRIX fix.
Jeremy.
-
Andrew Tridgell
65e857b36e more irix -64 portability fixes -
Jeremy Allison
1d2504b5c7 Must check against -1 for fcntl error check.
Jeremy
-
Jeremy Allison
9e3581827d Fix up warnings. Make tdb_openXX() names const.
Jeremy.
-
Martin Pool
6c684c89a4 Doc. -
Martin Pool
caa08bb56e Allow for internal databases which may have no name. -
Martin Pool
8118676f78 Log more error messages. -
Martin Pool
b50e566ab9 Log more error messages. -
Martin Pool
a228c7efcc Allocate tdb name up front in case log functions want to use it. -
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.
-
Martin Pool
52ef112e10 Refactor code to check whether already open into its own function. -
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.
-
Martin Pool
bb6c0df4bc Doc. -
Martin Pool
fac685d30f tdb_open_ex: Continue previous refactoring so that we consistently
just say "tdb" not "&tdb".
-
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.
-
Martin Pool
3dbb5dfcfb Put back changes to set errno, which seem to do no harm. -
Martin Pool
fc176f15f2 undo -
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.
-
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.
-
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.
-
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.
-
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
-
Jeremy Allison
2b135fba62 Fix for tdb_oob() on TDB_INTERNAL databases.
Jeremy.
-
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.
-
Jeremy Allison
a3267551d8 Put pwrite code back in expand_file.
Jeremy.
-
Andrew Tridgell
f49518e497 added a hook to reopen all tdb's after the server fork
this prevents the fd seek pointer problem
-
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.
-
Jeremy Allison
b45793ec3f Return correct error code on lock fail in tdb_expand.
Jeremy.
-
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.
-
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.
-
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.
-
Jeremy Allison
aaa56bb3a3 Fix for rare tdb pattern store failure. Found & fixed by Rusty.
Jeremy.
-
Jeremy Allison
34951876a1 Always check fstat for error.
Jeremy.
-
Jeremy Allison
c8c138c1fb Fix for enumerating large numbers of users.
Jeremy.
-
Jeremy Allison
2d1c6d1f6b Ok - I misspoke.... mmap returns MAP_FAILED, not neccessarily -1 :-).
Jeremy.
-
Jeremy Allison
b77c8b536d When mmap fails it returns -1 *NOT NULL*.
This got regressed somehow.....
Jeremy.
-
Jeremy Allison
fc7830eec8 Fixed potential free of NULL found by SGI speedshop.
Jeremy.
-
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
-
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
-
Andrew Tridgell
ba106b9b07 more portable TDB_LOG macro -
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
-
Andrew Tridgell
b94cfb6843 make sure that when a tdb expands we fill the expanded area, otherwise ENOSPC could be very bad -
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.
-
Andrew Tridgell
ce6598c465 clearer tdb_mmap code -
Andrew Tridgell
13bf966cb8 merge from 2.2 -
Jeremy Allison
4c6a8273c6 Fix problem with OpenBSD mmap and write not being coherent.
Jeremy.
-
Jeremy Allison
d6889b1954 Fix for True64 treating readonly as a reserved word !
Jeremy.
-
Jeremy Allison
fc76681812 Merge of Andrew's changes in 2.2.
Jeremy.
-
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.
-
Tim Potter
cef7f58ac5 Set the tdb->map_ptr to NULL if mmap() returns -1. -