1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-10 13:57:47 +03:00

285 Commits

Author SHA1 Message Date
Jeremy Allison
d929323d6f r16435: Add in the uid info that Jerry needs into the
share_mode struct. Allows us to know the unix
uid of the opener of the file/directory. Needed
for info level queries on open files.
Jeremy.
2007-10-10 11:18:54 -05:00
Jeremy Allison
e8d86362ba r16307: Make sure we know we must pass a valid pointer here.
Klocwork #1129.
Jeremy.
2007-10-10 11:17:32 -05:00
Jeremy Allison
c49ad9200b r16281: Start fixing up gcc4 -O6 warnings on an x86_64 box. size_t != unsigned
int
in a format string.
Jeremy.
2007-10-10 11:17:30 -05:00
James Peach
784126edff r15943: Update misleading DEBUG statements and comments that refer to
open_file_shared.
2007-10-10 11:17:14 -05:00
Jeremy Allison
31d16c434e r15670: Fix valgrind-spotted issue in BASE-DELETE test.
We were forgetting to increment after copying
the primary group gid.
Jeremy
2007-10-10 11:17:06 -05:00
Jeremy Allison
fd6fa1d4ea r15668: DOS or FCB opens share one share mode entry from different
fsp pointers. Ensure we cope with this to pass Samba4
DENY tests (we used to pass these, there must have been
a regression with newer code). We now pass them.
Jeremy
2007-10-10 11:17:06 -05:00
Jeremy Allison
ef4c70f58e r15419: Never write the same function twice :-). In a traversal
function we must copy the data before modifying.
Jeremy.
2007-10-10 11:16:42 -05:00
Jeremy Allison
c665310963 r15402: Fix for bug #3587. Dead entries can be left in the locking
db. Make this db self-cleaning on first read of entry after
open, and also on smbstatus -b call. Needs more testing when
I get back from Boston but passes valgrind at first look.
Jeremy.
2007-10-10 11:16:40 -05:00
Jeremy Allison
89b604285e r15269: Fix incorrect boolean in assert to make POSIX lock tests
pass with CIFSFS.
Jeremy.
2007-10-10 11:16:31 -05:00
Tim Potter
ab5a55ec8b r15255: Add return statement after abort to placate fussy compilers. Closes #3721. 2007-10-10 11:16:30 -05:00
Jeremy Allison
1c99aed563 r15083: Using talloc with destructors is nice and all, but in this
case it's in a performace critical path and it *hurts* us.
Go back to plain malloc/free with an explicit destructor
call.
Jeremy.
2007-10-10 11:16:22 -05:00
Jeremy Allison
2f8b527dcf r15060: The brlock code gets called a lot. Ensure we keep the
key around while we're using it - saves many calls to
locking_key() (now deleted).
Jeremy.
2007-10-10 11:16:00 -05:00
Jeremy Allison
15f39a4c72 r15026: Fix warning until POSIX locking finished.
Jeremy.
2007-10-10 11:15:57 -05:00
Jeremy Allison
08e52ead03 r15018: Merge Volker's ipc/trans2/nttrans changes over
into 3.0. Also merge the new POSIX lock code - this
is not enabled unless -DDEVELOPER is defined.
This doesn't yet map onto underlying system POSIX
locks. Updates vfs to allow lock queries.
Jeremy.
2007-10-10 11:15:57 -05:00
Jeremy Allison
e7225f7e81 r14763: Add a new tuning parameter, open files database hash size,
this allows us to experiment with ensuring the tdb hash
size for our open files and locking db are appropriately
sized. Make the hash size larger by default (10007 instead
of 1049) and make the locking db hash size the same as the
open file db hash size.
Jeremy.
2007-10-10 11:15:46 -05:00
Jeremy Allison
bc1a605a39 r14703: Clarify the return codes for the POSIX locking case. This
was confusing.
Jeremy.
2007-10-10 11:15:44 -05:00
James Peach
a39cbaa699 r14428: Call fill_share_mode_entry with NO_OPLOCK instead of 0. 2007-10-10 11:15:30 -05:00
Jeremy Allison
1d710d06a2 r13915: Fixed a very interesting class of realloc() bugs found by Coverity.
realloc can return NULL in one of two cases - (1) the realloc failed,
(2) realloc succeeded but the new size requested was zero, in which
case this is identical to a free() call.

The error paths dealing with these two cases should be different,
but mostly weren't. Secondly the standard idiom for dealing with
realloc when you know the new size is non-zero is the following :

 tmp = realloc(p, size);
 if (!tmp) {
    SAFE_FREE(p);
    return error;
 } else {
    p = tmp;
 }

However, there were *many* *many* places in Samba where we were
using the old (broken) idiom of :

 p = realloc(p, size)
 if (!p) {
    return error;
 }

which will leak the memory pointed to by p on realloc fail.

This commit (hopefully) fixes all these cases by moving to
a standard idiom of :

 p = SMB_REALLOC(p, size)
 if (!p) {
    return error;
 }

Where if the realloc returns null due to the realloc failing
or size == 0 we *guarentee* that the storage pointed to by p
has been freed. This allows me to remove a lot of code that
was dealing with the standard (more verbose) method that required
a tmp pointer. This is almost always what you want. When a
realloc fails you never usually want the old memory, you
want to free it and get into your error processing asap.

For the 11 remaining cases where we really do need to keep the
old pointer I have invented the new macro SMB_REALLOC_KEEP_OLD_ON_ERROR,
which can be used as follows :

 tmp = SMB_REALLOC_KEEP_OLD_ON_ERROR(p, size);
 if (!tmp) {
    SAFE_FREE(p);
    return error;
 } else {
    p = tmp;
 }

SMB_REALLOC_KEEP_OLD_ON_ERROR guarentees never to free the
pointer p, even on size == 0 or realloc fail. All this is
done by a hidden extra argument to Realloc(), BOOL free_old_on_error
which is set appropriately by the SMB_REALLOC and SMB_REALLOC_KEEP_OLD_ON_ERROR
macros (and their array counterparts).

It remains to be seen what this will do to our Coverity bug count :-).

Jeremy.
2007-10-10 11:10:59 -05:00
Gerald Carter
b65be8874a r13571: Replace all calls to talloc_free() with thye TALLOC_FREE()
macro which sets the freed pointer to NULL.
2007-10-10 11:10:14 -05:00
Jeremy Allison
89db006997 r13412: Don't use arbitrary uint32 size for uid and gid storage. Use
correct system size. Fixed a bug that was accidentally introduced
by use of uint32 - uid was stored twice, not uid and gid.
Jeremy.
2007-10-10 11:10:00 -05:00
Jeremy Allison
dbe2572d1c r13329: Fix libsmbsharemodes.so to work with the stored delete token.
Less trouble than I thought plus it didn't need an interface
change (thank goodness !).
Jeremy.
2007-10-10 11:06:25 -05:00
Jeremy Allison
f259de8b69 r13294: Fix basic delete on close tests - don't forget to tell
the data struct how big the token is... :-).
Jeremy.
2007-10-10 11:06:21 -05:00
Jeremy Allison
23f16cbc2e r13293: Rather a big patch I'm afraid, but this should fix bug #3347
by saving the UNIX token used to set a delete on close flag,
and using it when doing the delete. libsmbsharemodes.so still
needs updating to cope with this change.
Samba4 torture tests to follow.
Jeremy.
2007-10-10 11:06:21 -05:00
Jeremy Allison
9f4a9c70fa r13274: Fix for bug #3467. Not a show stopper.
jason qian <jason@infrant.com> was a *fantastic*
help in tracking this down.
Jeremy.
2007-10-10 11:06:20 -05:00
Jeremy Allison
837e7ea7e4 r13198: Fix issues exposed by Jerry's testing on 64-bit Solaris
(I hope). Separate 3.0.21b patch sent to Jerry.
Jeremy.
2007-10-10 11:06:17 -05:00
Jeremy Allison
f93e1e7556 r13194: Don't do extra memcpy's unless we're asked to.
Jeremy.
2007-10-10 11:06:17 -05:00
Jeremy Allison
fa5fab313e r13192: Fix up alignment issues when printing share mode
entries. Add paranioa to debug so we know when an
entry is unused.
Jeremy.
2007-10-10 11:06:16 -05:00
Gerald Carter
e1f75ea637 r13110: remove an invalid debug message about call get_share_mode_lock() with a NULL service path and fname (we do it all the time internally) 2007-10-10 11:06:14 -05:00
Jeremy Allison
d01824b785 r12877: Stop passing structs around in smb messages, instead
always linearize into little-endian. Should fix all
Solaris issues with this, plus provide a cleaner base
moving forward for cluster-aware Samba where smbd's
can communicate across different compilers/architectures
(eventually these message will have to go cross-machine).
Jeremy.
2007-10-10 11:06:05 -05:00
Jeremy Allison
855f5f8c32 r12234: Reduce the race condition for renames by holding the lock
longer. Instigated by complaints on the fix for #3303 from
SATOH Fumiyasu <fumiyas@miraclelinux.com>.
Jeremy.
2007-10-10 11:05:50 -05:00
Jeremy Allison
123135ed1d r12221: Fix error code paths that can potentially leave a dangling lock.
Jeremy.
2007-10-10 11:05:49 -05:00
Jeremy Allison
932e337db8 r12213: Final fix for #3303 - send rename messages to smbd's
that have open file handles to allow them to correctly
implement delete on close. There is a further correctness
fix I'm intending to add to this to cope with different share
paths, but not right now...
Jeremy.
2007-10-10 11:05:49 -05:00
Jeremy Allison
9d93af713f r12203: Add the share path into the sharemode db. This involves
revving the minor version number for libsmbsharemodes (we
now have a new _ex interface that takes the share path
as well as the filename). Needed for #3303. Some code written
by SATOH Fumiyasu <fumiya@samba.gr.jp> included in the changes
to locking/locking.c. The smbstatus output is a bit of a mess
and needs overhauling...
Jeremy.
2007-10-10 11:05:49 -05:00
Jeremy Allison
6a902ec49f r11435: Allow the hash size of the tdb open (locking) database
to be set in local.h. Change from the default (131) to
another prime (1049). Should this be an smb.conf tunable parameter
based on the number of open file descriptors available ?
If so what scaling factor ? More tests to follow.
Jeremy.
2007-10-10 11:05:16 -05:00
Jeremy Allison
1134abbbb3 r11341: Put directory opens into the share mode db so we
can treat them similarly to file opens (delete on
close, share mode violations etc.). This fixes bug
#3216 I will up the default hash size on the locking
db in a later commit as this means more entries.
Jeremy.
2007-10-10 11:05:13 -05:00
Gerald Carter
939c3cb5d7 r10656: BIG merge from trunk. Features not copied over
* \PIPE\unixinfo
* winbindd's {group,alias}membership new functions
* winbindd's lookupsids() functionality
* swat (trunk changes to be reverted as per discussion with Deryck)
2007-10-10 11:04:48 -05:00
Jeremy Allison
c7fe18761e r8219: Merge the new open code from HEAD to 3.0. Haven't yet run the torture
tests on this as it's very late NY time (just wanted to get this work
into the tree). I'll test this over the weekend....
Jerry - in looking at the difference between the two trees there
seem to be some printing/ntprinting.c and registry changes we might
want to examine to try keep in sync.
Jeremy.
2007-10-10 10:58:18 -05:00
Jeremy Allison
960a5d37d1 r7975: One more tidyup to ensure we're using "struct posix_lock".
Jeremy.
2007-10-10 10:58:05 -05:00
Jeremy Allison
f2bcfdddc7 r7972: Tidy up the posix locking in memory db code whilst I'm waiting for jht
to get back to me with a backtrace.
Jeremy.
2007-10-10 10:58:05 -05:00
Jeremy Allison
4f431dfc6b r6594: Fix silly typo causing tdb to be freed twice.
Jeremy.
2007-10-10 10:56:46 -05:00
Jeremy Allison
ec86ac4b28 r6543: Fix EDEADLCK problem with deferred open calls. Problem found by
"Hu, David J" <david.hu@hp.com>
Jeremy.
2007-10-10 10:56:44 -05:00
Herb Lewis
58e307664e r6502: add LOCKING debug class - pull PRINTINGDB class definition from trunk
so our numbers don't get out of sync
2007-10-10 10:56:43 -05:00
Jeremy Allison
ff4c201d93 r5634: Fix 64-bit overflow problems found by BlueArc torture tester.
We still have a few strange bugs with 64-bit locking values. I will
get traces.
Jeremy.
2007-10-10 10:55:51 -05:00
Jeremy Allison
b94db3a758 r5625: Reformat (tidy). 2007-10-10 10:55:51 -05:00
Jeremy Allison
0dd4adeae2 r4143: Make strict locking an enum. Auto means use oplock optimization.
Jeremy.
2007-10-10 10:53:36 -05:00
Jeremy Allison
f4feed8f90 r4121: Optimisation from Nadav Danieli <nadavd@exanet.com>. If we're oplocked,
short circuit some is_locked() tests.
Jeremy.
2007-10-10 10:53:35 -05:00
Jeremy Allison
596f230513 r4108: As check_self is *always* False in every invokation, remove the
logic for it. We still pass Samba4 RAW-LOCK test.
Jeremy.
2007-10-10 10:53:34 -05:00
Jeremy Allison
620f2e608f r4088: Get medieval on our ass about malloc.... :-). Take control of all our allocation
functions so we can funnel through some well known functions. Should help greatly with
malloc checking.
HEAD patch to follow.
Jeremy.
2007-10-10 10:53:32 -05:00
Jeremy Allison
c6b144654a r3120: Fix bug #1955 reported by Love <lha@stacken.kth.se>. Inconsistent error return.
Jeremy.
2007-10-10 10:53:01 -05:00
Jeremy Allison
cf7f89999e r3050: Steal from Samba4 :-). Make us pass most of the new lock tests (except for
the cancel lock which I have to add).
Jeremy.
2007-10-10 10:52:59 -05:00