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

394 Commits

Author SHA1 Message Date
Jeremy Allison
354e444ee3 r17046: Ensure we're using the right pointers ...
Jeremy.
(This used to be commit a8df1863bf)
2007-10-10 11:19:22 -05:00
Jeremy Allison
ad673ea988 r17043: Fix memleak when processing CIFS POSIX lock/unlock
requests. Maybe the Linux kernel OOM killer will
be kinder to smbd now :-). Back to tdbtorture
tests on cifsfs.
Jeremy.
(This used to be commit 1201383e7a)
2007-10-10 11:19:21 -05:00
Jeremy Allison
d22d540c32 r17041: Trying to track down a *big* memory leak in the new lock code.
Fix a small one first.... (easy to valgrind).
Jeremy
(This used to be commit 43d24fbd41)
2007-10-10 11:19:21 -05:00
Jeremy Allison
75a2f4dbc8 r17000: Allow CIFS POSIX locks to coexist with Windows locks.
We shouldn't allow this on the same smbd, but the cifsfs
client negotiates POSIX locks then sends Windows ones.
Doh ! Can't fix shipped client code....
Jeremy.
(This used to be commit 2f8cabe98d)
2007-10-10 11:19:17 -05:00
Jeremy Allison
8dbe2651d3 r16992: Fix bug #3922 reported by jason@ncac.gwu.edu, correctly
look at the return code.
Jeremy.
(This used to be commit f11933b3ac)
2007-10-10 11:19:17 -05:00
Jeremy Allison
1722226189 r16987: Fix the logic errors in ref-counting Windows locks.
Hopefully will fix the build farm. Still a few errors
in RAW-LOCK to look at though...
Jeremy.
(This used to be commit edd72d37de)
2007-10-10 11:19:16 -05:00
Jeremy Allison
297df32751 r16973: Fix subtle logic error in lock ref counting found by
cifsfs client code.
Jeremy.
(This used to be commit 53094435d8)
2007-10-10 11:19:16 -05:00
Jeremy Allison
fbdcf2663b r16945: Sync trunk -> 3.0 for 3.0.24 code. Still need
to do the upper layer directories but this is what
everyone is waiting for....

Jeremy.
(This used to be commit 9dafb7f48c)
2007-10-10 11:19:14 -05:00
Jeremy Allison
cc1457beb0 r16661: Fix from jason@ncac.gwu.edu for bug #3875,
bad cast warning.
Jeremy.
(This used to be commit d60e6e0abc)
2007-10-10 11:19:06 -05:00
Jeremy Allison
54ea3c23e3 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.
(This used to be commit d929323d6f)
2007-10-10 11:18:54 -05:00
Jeremy Allison
a90026e7a6 r16307: Make sure we know we must pass a valid pointer here.
Klocwork #1129.
Jeremy.
(This used to be commit e8d86362ba)
2007-10-10 11:17:32 -05:00
Jeremy Allison
c115570b85 r16281: Start fixing up gcc4 -O6 warnings on an x86_64 box. size_t != unsigned
int
in a format string.
Jeremy.
(This used to be commit c49ad9200b)
2007-10-10 11:17:30 -05:00
James Peach
0a1ca7fa3d r15943: Update misleading DEBUG statements and comments that refer to
open_file_shared.
(This used to be commit 784126edff)
2007-10-10 11:17:14 -05:00
Jeremy Allison
6a026d5618 r15670: Fix valgrind-spotted issue in BASE-DELETE test.
We were forgetting to increment after copying
the primary group gid.
Jeremy
(This used to be commit 31d16c434e)
2007-10-10 11:17:06 -05:00
Jeremy Allison
cc9ea93456 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
(This used to be commit fd6fa1d4ea)
2007-10-10 11:17:06 -05:00
Jeremy Allison
fca8766ee1 r15419: Never write the same function twice :-). In a traversal
function we must copy the data before modifying.
Jeremy.
(This used to be commit ef4c70f58e)
2007-10-10 11:16:42 -05:00
Jeremy Allison
6eb1187765 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.
(This used to be commit c665310963)
2007-10-10 11:16:40 -05:00
Jeremy Allison
f93da6d684 r15269: Fix incorrect boolean in assert to make POSIX lock tests
pass with CIFSFS.
Jeremy.
(This used to be commit 89b604285e)
2007-10-10 11:16:31 -05:00
Tim Potter
f353704bbf r15255: Add return statement after abort to placate fussy compilers. Closes #3721.
(This used to be commit ab5a55ec8b)
2007-10-10 11:16:30 -05:00
Jeremy Allison
713eaf1d67 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.
(This used to be commit 1c99aed563)
2007-10-10 11:16:22 -05:00
Jeremy Allison
fdd55885da 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.
(This used to be commit 2f8b527dcf)
2007-10-10 11:16:00 -05:00
Jeremy Allison
423352b90e r15026: Fix warning until POSIX locking finished.
Jeremy.
(This used to be commit 15f39a4c72)
2007-10-10 11:15:57 -05:00
Jeremy Allison
22dbd67708 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.
(This used to be commit 08e52ead03)
2007-10-10 11:15:57 -05:00
Jeremy Allison
81d4f40bbe 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.
(This used to be commit e7225f7e81)
2007-10-10 11:15:46 -05:00
Jeremy Allison
7f57dc61cb r14703: Clarify the return codes for the POSIX locking case. This
was confusing.
Jeremy.
(This used to be commit bc1a605a39)
2007-10-10 11:15:44 -05:00
James Peach
d6eebce490 r14428: Call fill_share_mode_entry with NO_OPLOCK instead of 0.
(This used to be commit a39cbaa699)
2007-10-10 11:15:30 -05:00
Jeremy Allison
894358a8f3 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.
(This used to be commit 1d710d06a2)
2007-10-10 11:10:59 -05:00
Gerald Carter
fb5362c069 r13571: Replace all calls to talloc_free() with thye TALLOC_FREE()
macro which sets the freed pointer to NULL.
(This used to be commit b65be8874a)
2007-10-10 11:10:14 -05:00
Jeremy Allison
30e47fdfe2 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.
(This used to be commit 89db006997)
2007-10-10 11:10:00 -05:00
Jeremy Allison
40d3c7ebb2 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.
(This used to be commit dbe2572d1c)
2007-10-10 11:06:25 -05:00
Jeremy Allison
466230e5a1 r13294: Fix basic delete on close tests - don't forget to tell
the data struct how big the token is... :-).
Jeremy.
(This used to be commit f259de8b69)
2007-10-10 11:06:21 -05:00
Jeremy Allison
d14af63e6a 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.
(This used to be commit 23f16cbc2e)
2007-10-10 11:06:21 -05:00
Jeremy Allison
86c9bac4c3 r13274: Fix for bug #3467. Not a show stopper.
jason qian <jason@infrant.com> was a *fantastic*
help in tracking this down.
Jeremy.
(This used to be commit 9f4a9c70fa)
2007-10-10 11:06:20 -05:00
Jeremy Allison
bd34c2ac25 r13198: Fix issues exposed by Jerry's testing on 64-bit Solaris
(I hope). Separate 3.0.21b patch sent to Jerry.
Jeremy.
(This used to be commit 837e7ea7e4)
2007-10-10 11:06:17 -05:00
Jeremy Allison
6f08a557ba r13194: Don't do extra memcpy's unless we're asked to.
Jeremy.
(This used to be commit f93e1e7556)
2007-10-10 11:06:17 -05:00
Jeremy Allison
6a097ab20e r13192: Fix up alignment issues when printing share mode
entries. Add paranioa to debug so we know when an
entry is unused.
Jeremy.
(This used to be commit fa5fab313e)
2007-10-10 11:06:16 -05:00
Gerald Carter
6afd823e42 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)
(This used to be commit e1f75ea637)
2007-10-10 11:06:14 -05:00
Jeremy Allison
3317484799 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.
(This used to be commit d01824b785)
2007-10-10 11:06:05 -05:00
Jeremy Allison
e7d2e311a2 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.
(This used to be commit 855f5f8c32)
2007-10-10 11:05:50 -05:00
Jeremy Allison
762901cfb9 r12221: Fix error code paths that can potentially leave a dangling lock.
Jeremy.
(This used to be commit 123135ed1d)
2007-10-10 11:05:49 -05:00
Jeremy Allison
ab7a4f7e8e 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.
(This used to be commit 932e337db8)
2007-10-10 11:05:49 -05:00
Jeremy Allison
7d2771e758 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.
(This used to be commit 9d93af713f)
2007-10-10 11:05:49 -05:00
Jeremy Allison
a00c76d9fb 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.
(This used to be commit 6a902ec49f)
2007-10-10 11:05:16 -05:00
Jeremy Allison
533da83852 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.
(This used to be commit 1134abbbb3)
2007-10-10 11:05:13 -05:00
Gerald Carter
54abd2aa66 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)
(This used to be commit 939c3cb5d7)
2007-10-10 11:04:48 -05:00
Jeremy Allison
af8a691db1 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.
(This used to be commit c7fe18761e)
2007-10-10 10:58:18 -05:00
Jeremy Allison
74563c5806 r7975: One more tidyup to ensure we're using "struct posix_lock".
Jeremy.
(This used to be commit 960a5d37d1)
2007-10-10 10:58:05 -05:00
Jeremy Allison
3d306127aa 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.
(This used to be commit f2bcfdddc7)
2007-10-10 10:58:05 -05:00
Jeremy Allison
114067ced1 r6594: Fix silly typo causing tdb to be freed twice.
Jeremy.
(This used to be commit 4f431dfc6b)
2007-10-10 10:56:46 -05:00
Jeremy Allison
fc396cb220 r6543: Fix EDEADLCK problem with deferred open calls. Problem found by
"Hu, David J" <david.hu@hp.com>
Jeremy.
(This used to be commit ec86ac4b28)
2007-10-10 10:56:44 -05:00
Herb Lewis
ed1f7121a3 r6502: add LOCKING debug class - pull PRINTINGDB class definition from trunk
so our numbers don't get out of sync
(This used to be commit 58e307664e)
2007-10-10 10:56:43 -05:00
Jeremy Allison
8dddd763d8 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.
(This used to be commit ff4c201d93)
2007-10-10 10:55:51 -05:00
Jeremy Allison
c4591307aa r5625: Reformat (tidy).
(This used to be commit b94db3a758)
2007-10-10 10:55:51 -05:00
Jeremy Allison
9345663328 r4143: Make strict locking an enum. Auto means use oplock optimization.
Jeremy.
(This used to be commit 0dd4adeae2)
2007-10-10 10:53:36 -05:00
Jeremy Allison
822fcec39d r4121: Optimisation from Nadav Danieli <nadavd@exanet.com>. If we're oplocked,
short circuit some is_locked() tests.
Jeremy.
(This used to be commit f4feed8f90)
2007-10-10 10:53:35 -05:00
Jeremy Allison
695188cc26 r4108: As check_self is *always* False in every invokation, remove the
logic for it. We still pass Samba4 RAW-LOCK test.
Jeremy.
(This used to be commit 596f230513)
2007-10-10 10:53:34 -05:00
Jeremy Allison
acf9d61421 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.
(This used to be commit 620f2e608f)
2007-10-10 10:53:32 -05:00
Jeremy Allison
5aafdee906 r3120: Fix bug #1955 reported by Love <lha@stacken.kth.se>. Inconsistent error return.
Jeremy.
(This used to be commit c6b144654a)
2007-10-10 10:53:01 -05:00
Jeremy Allison
8c1c918c94 r3050: Steal from Samba4 :-). Make us pass most of the new lock tests (except for
the cancel lock which I have to add).
Jeremy.
(This used to be commit cf7f89999e)
2007-10-10 10:52:59 -05:00
Andrew Tridgell
b0202c7b85 r3008: when checking for the existance of a lock we are only doing a single
tdb call, so there is no need to get the chainlock. This reduces the
number of tdb locking calls made on file IO
(This used to be commit 78e904c27b)
2007-10-10 10:52:59 -05:00
Jeremy Allison
f820b921cd r2413: Arggg. Stupid, stupid, stupid me ! I added a paranoia test
case when I was developing the deferred open case and made it
too tight. It will fire (incorrectly) and panic when a client
does a second open for a file with a different mid (multiplex-id)
request. Doh ! This is a perfectly valid thing for a client to
do (have two pending opens with different mids outstanding on
the same file) and currently when the first pending open expires
with a share violation the paranoia code will panic smbd.

It's a rare condition, but obvious now I've looked at the
code.

Fix for bug #1743.

Jeremy.
(This used to be commit e1bf108ae9)
2007-10-10 10:52:42 -05:00
Jeremy Allison
2fc57c9a2c r1085: Now it's had some proper user testing, merge in the deferred open fix. I'm
still doing more testing, but it fixes a behaviour that we've been wrong
on ever since the start of Samba.
Jeremy.
(This used to be commit 894cc6d162)
2007-10-10 10:51:54 -05:00
Gerald Carter
386a11f49e r1011: fix bad merge (from a few months ago) and ensure that we always use tdb_open_log() instead of tdb_open_ex()
(This used to be commit e65564ab4a)
2007-10-10 10:51:53 -05:00
Jeremy Allison
ac5f0785c8 r984: Ensure memmove & memcpy aren't called with len == 0.
Jeremy.
(This used to be commit 40c77dddc6)
2007-10-10 10:51:52 -05:00
Gerald Carter
df6d2db4ce merge from old APP_HEAD
* remove corrupt tdb and shutdown (only for printing tdbs, connections,
  sessionid & locking)
* decrement smbd counter in connections.tdb in smb_panic()
* various Makefile hack to get things to link

'max smbd processes' looks like it might be broken.  The counter KEY is not
being set.  Will look into that tomorrow.
(This used to be commit 6e22c5da92)
2004-02-12 05:24:02 +00:00
Jeremy Allison
22c0241571 Changes to allow Samba3 to pass the Samba4 RAW-READ tests.
Jeremy.
(This used to be commit e7565dbba6)
2003-10-09 01:46:01 +00:00
Jeremy Allison
07c90e499e Tidy up some formatting. Get ready for allowing bad password lockout. (based
on a patch posted from Richard Renard <rrenard@idealx.com>.
Jeremy.
(This used to be commit abf54b58e9)
2003-09-08 20:42:33 +00:00
Jeremy Allison
ef915c8eaf Final fix for the bug tridge found. Only push locks onto a blocking lock
queue if the posix lock failed with EACCES or EAGAIN (this means another
lock conflicts). Else return an error and don't queue the request.
Jeremy.
(This used to be commit 43fbc18fdc)
2003-08-01 06:10:30 +00:00
Tim Potter
80c1f1d865 Fixup a bunch of printf-style functions and debugs to use unsigned long when
displaying pid_t, uid_t and gid_t values.  This removes a whole lot of warnings
on some of the 64-bit build farm machines as well as help us out when 64-bit
uid/gid/pid values come along.
(This used to be commit f93528ba00)
2003-07-22 04:31:20 +00:00
Jeremy Allison
78a4f6fc4b More fixes for debug log to catch logic error.
Jeremy.
(This used to be commit 84a7714eba)
2003-05-22 18:56:51 +00:00
Alexander Bokovoy
bc2a3748e9 Prefix VFS API macros with SMB_ for consistency and to avoid problems with VFS_ macros at system side. We currently have one clash with AIX and its VFS_LOCK. Compiled and tested -- no new functionality or code, just plain rename of macros for yet-unreleased VFS API version. Needs to be done before a24 is out
(This used to be commit c2689ed118)
2003-05-14 10:59:01 +00:00
Alexander Bokovoy
e7c8c15888 Fix VFS layer:
1. Finally work with cascaded modules with private data storage per module
2. Convert VFS API to macro calls to simplify cascading
3. Add quota support to VFS layer (prepare to NT quota support)

Patch by Stefan (metze) Metzemacher, with review of Jelmer and me
Tested in past few weeks. Documentation to new VFS API for third-party developers to follow
(This used to be commit 91984ef5ca)
2003-05-11 23:34:18 +00:00
Jeremy Allison
34226f1bd4 Fix for very subtle POSIX lock interaction race condition found by
Herb. We need to unlock POSIX locks before notifying pending lock
processes.
Jeremy.
(This used to be commit 6999eef51c)
2003-04-04 20:38:12 +00:00
Jeremy Allison
fb3e4b8797 Fix to allow blocking lock notification to be done rapidly (no wait
for smb -> smb lock release). Adds new PENDING_LOCK type to lockdb
(does not interfere with existing locks).
Jeremy.
(This used to be commit 766928bbba)
2003-02-27 01:04:34 +00:00
Andrew Bartlett
98410be607 Merge off-by-one fix from HEAD (caused crash with --enable-developer)
(This used to be commit d714254130)
2003-02-24 03:03:15 +00:00
Jeremy Allison
285a3b0ef8 When checking is_locked() new WRITE locks conflict with existing READ locks even
if the context is the same. See LOCKTEST7 in smbtorture.
Jeremy.
(This used to be commit 1698092ba5)
2003-02-22 01:09:57 +00:00
Jeremy Allison
7fe6742d04 Fixes for HPUX only having limited POSIX lock range from Michael Steffens <michael.steffens@hp.com>
Jeremy.
(This used to be commit e9b4fb8b9a)
2003-02-12 20:40:29 +00:00
Andrew Bartlett
8a20407442 Cleanups: (merge from HEAD)
- use safe_strcpy() instead of pstrcpy() for malloc()ed strings

 - CUPS: a failure in an attempt to automaticly add a printer is not level 0 stuff.

 - Fix up a possible Realloc() failure segfault

Andrew Bartlett
(This used to be commit c1cfc296c2)
2003-02-10 11:47:21 +00:00
Jeremy Allison
20f1cf6cdc Fix problem with "hide unreadable". stat file opens are baaack :-).
Jeremy.
(This used to be commit 62038a0abf)
2003-01-03 18:50:13 +00:00
Jeremy Allison
ef8bd7c4f7 Forward port the change to talloc_init() to make all talloc contexts
named. Ensure we can query them.
Jeremy.
(This used to be commit 09a218a9f6)
2002-12-20 20:21:31 +00:00
Jeremy Allison
de474974ea Lots of fixes for error paths where tdb_fetch() data need freeing.
Found via a post from Arcady Chernyak <Arcady.Chernyak@efi.com>.
Jeremy.
(This used to be commit 5d5762d178)
2002-11-23 02:52:36 +00:00
Gerald Carter
a834a73e34 sync'ing up for 3.0alpha20 release
(This used to be commit 65e7b5273b)
2002-09-25 15:19:00 +00:00
Andrew Tridgell
e90b652848 updated the 3.0 branch from the head branch - ready for alpha18
(This used to be commit 03ac082dcb)
2002-07-15 10:35:28 +00:00
Jeremy Allison
c90cd26e94 Fix the mp3 rename bug - also tidy up our open code and remove the special
cases for rename and unlink. Had to add desired_access into the share mode record.
Jeremy.
(This used to be commit 3b1b8ac435)
2002-03-23 02:57:44 +00:00
Andrew Tridgell
7d4378cc89 if our lock spin code fails then return the first error code, not the
last one. This is what caused the lock1 and lock2 tests to fail.
(This used to be commit e7ae8003cb)
2002-03-15 09:51:37 +00:00
Jeremy Allison
d6d9e385cc Use sys_usleep not usleep.
Jeremy.
(This used to be commit 8587dd95f8)
2002-03-14 01:05:34 +00:00
Jeremy Allison
f9af25c4ec Ensure we attempt to lock at least once. Only sleep if time param set.
Jeremy.
(This used to be commit 62b80d5c65)
2002-03-13 20:49:57 +00:00
Jeremy Allison
5e3b923124 include/smb_macros.h: Don't round up an allocation if the size is zero.
"One of these locks is not like the others... One of these locks is not
quite the same" :-). When is a zero timeout lock not zero ? When it's
being processed by Windows 2000 of course.. This code change, ugly though
it is - completely fixes the foxpro/access multi-user file system database
problems that people have been having. I used a *wonderful* test program
donated by "Gerald Drouillard" <gerald@drouillard.ca> which allowed me
to completely reproduce this problem, and to finally determine the correct
fix. This also explains why Windows 2000 is *so slow* when responding to
the smbtorture lock tests. I *love* it when all these things come together
and finally make sense :-).
Jeremy.
(This used to be commit 8aa9860ea2)
2002-03-13 20:28:19 +00:00
Andrew Tridgell
be389e25dd this attempts to handle the rather bizarre lock cache semantics in
w2k. It isn't entirely accurate, but its close
(This used to be commit e02d736470)
2002-03-10 23:17:07 +00:00
Andrew Tridgell
d160b35240 accept the 0/0 lock but don't treat it in any sort of special way
(This used to be commit 8f7bf38de1)
2002-03-05 19:54:45 +00:00
Tim Potter
cd68afe312 Removed version number from file header.
Changed "SMB/Netbios" to "SMB/CIFS" in file header.
(This used to be commit 6a58c9bd06)
2002-01-30 06:08:46 +00:00
Jeremy Allison
c1efcac59c Debugs that print out a share mode table in debug level 10. This code
enabled me to track down a *nasty* bug.
Jeremy.
(This used to be commit ed5a9a0ee3)
2002-01-08 00:52:36 +00:00
Jeremy Allison
86b3aeb42a Added DEBUG in set_share_mode to track down logic insanity.
Jeremy.
(This used to be commit 32f4f3a45d)
2002-01-05 02:37:23 +00:00
Tim Potter
95a4903b20 Removed unused function, delete_fn()
(This used to be commit f26e8205cf)
2001-12-18 05:04:09 +00:00
Jeremy Allison
9e88a7ebe9 After conversations with Andrew, improved the robustness of the
sharemode db in the following way.

Originally, on startup and shutdown, smbd would scan the share mode
db to ensure it was correct. This lead to scalability issues as
scans lock the db for quite a long time. Andrew had the brainstorm
that we only care about the record we're about to read.

This new code (small change really, but quite significant) causes
get_share_modes() to do a process_exists() call against each pid
in each record, and to delete any that don't and re-write the
entry if any dead records were detected.

This allowed me to remove the startup/shutdown scans of the
db (they can be added into smbstatus if anyone really cares to
have them back). This will please the vfs author who was worried
about the time taken on open() calls, and will lead to much
greater robustness and scalability in the share mode db.

We need much testing of this, and also netbench tests to
ensure the extra process_exists() calls don't hurt performance
(they shouldn't it's a very simple system call).

Jeremy.
(This used to be commit 4098d44203)
2001-11-30 01:59:03 +00:00
Jeremy Allison
e5c5adb197 Don't scan locking db on closedown.
Jeremy.
(This used to be commit 59cfcd8a6c)
2001-11-21 04:00:35 +00:00
Jeremy Allison
88b55f47b4 Move from timestamp to gen count file id's for finding oplocked files
in a tdb.
Jeremy.
(This used to be commit 058ae6b58f)
2001-10-20 21:59:34 +00:00
Jeremy Allison
07f54cb592 Ensure we mask off deny modes correctly on being set (this shouldn't have
caused problems but is tidier).
Fix debug statement in locking.c
Jeremy.
(This used to be commit eac6bbd24e)
2001-10-19 23:56:21 +00:00
Tim Potter
dc1fc3ee8e Removed 'extern int DEBUGLEVEL' as it is now in the smb.h header.
(This used to be commit 2d0922b0ea)
2001-10-02 04:29:50 +00:00
Jeremy Allison
8c8b9c69e5 Removed test code that got added by accident.
Jeremy.
(This used to be commit fc91ecc236)
2001-09-19 06:49:02 +00:00
Jeremy Allison
5bc82e443b Correct fix for unaligned memcpy - malloc'ed memory incremented by sizeof(struct locking_data)
was not forced to be 8 byte aligned. Use union to force it to be correctly aligned
for memcpy and use void *, to tell compiler not to optimize aligned copy (this last fix
suggested by Trond @ RedHat). The first fix should be sufficient, but this provides a
"belt and braces" fix.
Jeremy.
(This used to be commit 22c5915bb4)
2001-09-18 06:41:29 +00:00
Jeremy Allison
36a6611da2 Use structure copy to fix unaligned accesses on 64bit architectures on
Linux.
Jeremy.
(This used to be commit b4b891279b)
2001-09-18 06:20:28 +00:00
Simo Sorce
81fdc3c3f7 move to SAFE_FREE()
(This used to be commit e61aec84ed)
2001-09-17 04:16:35 +00:00
Jeremy Allison
83ebf2b6b2 Fix the 62bit locking onto 32 bit NFS mounts problem generically for HPUX.
Don. please check this out.
Jeremy.
(This used to be commit ce9f959964)
2001-09-06 22:43:21 +00:00
Andrew Tridgell
9a9ac2739b got rid of USE_TDB_MMAP_FLAG as its not needed any more
(This used to be commit c26e0d3f27)
2001-09-06 22:08:19 +00:00
Andrew Tridgell
9ef7a6c786 use NTSTATUS not BOOL in do_lock()
(This used to be commit b1b2a5fa5d)
2001-09-06 01:19:35 +00:00
Andrew Tridgell
4f0509aeeb 2nd DELETE_ON_CLOSE_FLAG fix ...
we set the DELETE_ON_CLOSE_FLAG on all share modes on the file, which
means the share mode in the fsp will not match the one in the tdb when
we come to close for other file handles, which means we end up with
share modes on files after all handles are closed

fixed by making the comparison function that says if two shares modes
are equal ignore the DELETE_ON_CLOSE_FLAG
(This used to be commit 7b39c4c598)
2001-09-05 21:39:43 +00:00
Jeremy Allison
d3518f1d8a NFS v2 can return ENOLCK when greater than 31 bit offsets are used.
Treat this the same as an EFBIG error.
Jeremy
(This used to be commit 8fad517770)
2001-09-05 00:05:07 +00:00
Andrew Tridgell
19fea3242c the next stage in the NTSTATUS/WERROR change. smbd and nmbd now compile, but the client code still needs some work
(This used to be commit dcd6e735f7)
2001-09-04 07:13:01 +00:00
Andrew Tridgell
b031af348c converted another bunch of stuff to NTSTATUS
(This used to be commit 1d36250e33)
2001-08-27 19:46:22 +00:00
Andrew Tridgell
ee5f7237de started converting NTSTATUS to be a structure on systems with gcc in order to make it type incompatible with BOOL so we catch errors sooner. This has already found a number of bugs
(This used to be commit 1b778bc7d2)
2001-08-27 17:52:23 +00:00
Andrew Tridgell
e8e98c9ea0 converted smbd to use NTSTATUS by default
major changes include:

- added NSTATUS type
- added automatic mapping between dos and nt error codes
- changed all ERROR() calls to ERROR_DOS() and many to ERROR_NT()
  these calls auto-translate to the client error code system
- got rid of the cached error code and the writebmpx code

We eventually will need to also:
- get rid of BOOL, so we don't lose error info
- replace all ERROR_DOS() calls with ERROR_NT() calls

but that is too much for one night
(This used to be commit 83d9896c1e)
2001-08-27 08:19:43 +00:00
Jeremy Allison
4a3f07456d Ignore locks of length zero as they mean different things in Win32
and POSIX.
Jeremy.
(This used to be commit bd9cbf4c68)
2001-08-26 19:39:40 +00:00
Jeremy Allison
10c240ef97 Don't use CLEAR_IF_FIRST if opening read-only.
Jeremy.
(This used to be commit f5ba19c129)
2001-08-26 19:27:18 +00:00
Andrew Tridgell
c1598db18e we now have all but the dreaded 0/0 lock working
(This used to be commit 98b6aef18c)
2001-08-24 21:09:38 +00:00
Andrew Tridgell
7874b0ac17 0 byte lock ranges ARE valid
(This used to be commit 5498da6664)
2001-08-24 04:55:28 +00:00
Jeremy Allison
85e063f5b8 Tidyup fixes for fcntl spin problem.
Jeremy.
(This used to be commit 27d3dd0e7c)
2001-08-22 01:01:37 +00:00
Jeremy Allison
e4275a35a6 Fixed the (incorrect) paranioa fix I put in for the fcntl lock spin.
Don't delete a share mode that failed to remove the oplock (doh!),
just set the oplock entry to zero....
Jeremy.
(This used to be commit fe4aa72018)
2001-08-22 00:29:40 +00:00
Jeremy Allison
dd53785225 Missed uninitialized variable return for del_share_mode().
Jeremy.
(This used to be commit e4a57fb456)
2001-08-21 18:33:58 +00:00
Volker Lendecke
e6a6dee027 This is Jeremy pretending to be Volker, 'cos the
link from Seattle is having problems.
I've added 3 things here to work on the fcntl spin
problem.
1). Check *all* tdb return codes... :-).
2). If we're asking ourselves to break an oplock, and we can't
find a fsp pointer that matches the entry, this is a *logic bug*
and we should abort and panic so someone with gdb can pick up
the pieces.
3). After we've broken an oplock, ensure that the entry itself
has been removed, and if not remove it ourselves. This should
not be neccessary in a correctly working environmen,t, but will
provide an added layer of robustness in error situations.
4). I hate german keyboards :-) :-).
Jeremy.
(This used to be commit 1c94fa8064)
2001-08-21 01:25:45 +00:00
Jeremy Allison
c786a4d89a Ensure we are very explicit about what we're comparing when
we're comparing structures (ie. don't just do a memcmp). I
don't think this will fix the fcntl spin issue, but it's a
"just in case" change.
Jeremy.
(This used to be commit 41066208ad)
2001-08-20 22:13:53 +00:00
Jeremy Allison
e430190a66 Add printing of errno when POSIX lock requests fail.
Jeremy.
(This used to be commit befbfea210)
2001-08-13 17:58:54 +00:00
Simo Sorce
2e783a4707 this is a big global fix for the ptr = Realloc(ptr, size) bug.
many possible mem leaks, and segfaults fixed.

someone should port this fix to 2.2 also.
(This used to be commit fa8e55b8b4)
2001-08-12 17:30:01 +00:00
Jeremy Allison
996719cce2 Added "use mmap" for HPUX.
Jeremy.
(This used to be commit 840802f106)
2001-07-30 22:21:31 +00:00
Jeremy Allison
5b69009b25 Fixed the nastiest locking bug to track down.... smb_pids are sent in the
lockingX calls - use that instead of smb_pid in the packet.
Jeremy.
(This used to be commit a3925cb9c6)
2001-07-02 02:42:41 +00:00
Jeremy Allison
064b4904f9 Ensure we return correct error on trying to unlock a region not locked.
Jeremy.
(This used to be commit 015a077acc)
2001-06-30 03:11:44 +00:00
Jeremy Allison
d1f38ac531 Fixed the first locking error (test #8 found by locktest code from
Clarion locktest.
Jeremy.
(This used to be commit 5c42845b5b)
2001-06-30 01:59:48 +00:00
Andrew Tridgell
05fc3e578c use LDSHFLAGS not -shared in several places
(This used to be commit 8ec9c87b5d)
2001-06-04 05:13:59 +00:00
Jeremy Allison
840fb1643d Stupid typo. Should be if (!tdb).
Jeremy.
(This used to be commit d3496897f1)
2001-05-23 18:33:45 +00:00
Jeremy Allison
faa0bef196 Defensive brlock and locking database cleaning code.
Jeremy.
(This used to be commit d7aa42e459)
2001-05-22 20:35:48 +00:00
Jeremy Allison
2ef68c7e92 Merge of Andrew's changes in 2.2.
Jeremy.
(This used to be commit fc76681812)
2001-04-13 19:12:06 +00:00
Jeremy Allison
6e7f03f9b9 This is a big, rather ugly patch. Whilst investigating the files not truncated
when copying to a full disk problem, I discovered that we were not allowing
the delete on close flag to be set properly, this led to other things, and
after investigation of the proper delete on close semantics and their relationship
to the file_share_delete flag I discovered there were some cases where we
weren't doing the deny modes properly. And this after only 5 years working
on them..... :-) :-).
So here's the latest attempt. I realised the delete on close flag needs to
be set across all smbds with a dev/ino pair open - in addition, the delete
on close flag, allow share delete and delete access requested all need to
be stored in the share mode tdb.
The "delete_on_close" entry in the fsp struct is now redundant and should
really be removed. This may also mean we can get rid of the "iterate_fsp"
calls that I didn't like adding in the first place. Whilst doing this patch,
I also discovered we needed to do the se_map_generic() call for file opens
and POSIX ACL mapping, so I added that also.
This code, although ugly, now passes the deny mode torture tests plus the
delete on close tests I added. I do need to add one more multiple connection
delete on close test to make sure I got the semantics exactly right, plus we
should also (as Andrew suggested) move to random testing here.

The good news is that NT should now correctly delete the file on disk
full error when copying to a disk :-).

Jeremy.
(This used to be commit 51987684bd)
2001-03-30 08:57:24 +00:00
Jeremy Allison
da3053048c Merge of new 2.2 code into HEAD (Gerald I hate you :-) :-). Allows new SAMR
RPC code to merge with new passdb code.
Currently rpcclient doesn't compile. I'm working on it...
Jeremy.
(This used to be commit 0be41d5158)
2001-03-11 00:32:10 +00:00
Tim Potter
a58ca91245 tdb_unlockchain() no longer returns a value
(This used to be commit aee52c7acf)
2000-12-06 02:51:13 +00:00
Jeremy Allison
7e4c4721b4 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.
(This used to be commit 9dea7b7c25)
2000-12-06 00:05:15 +00:00
Jeremy Allison
ac4d277561 Fix from John Reilly for equivalence tests.
Jeremy.
(This used to be commit b456274a7b)
2000-11-17 23:10:56 +00:00
Jeremy Allison
ba00796e6d Herb's warning fixes. Also the POSIX locking fix.
We now use our own vfs layer to do get/set acl calls (hurrah!).
Jeremy.
(This used to be commit dfe77c7046)
2000-10-06 18:13:52 +00:00
Jeremy Allison
636f146abf Restructuring of vfs layer to include a "this" pointer - can be an fsp or
a conn struct depending on the call.
We need this to have a clean NT ACL call interface.
This will break any existing VFS libraries (that's why this is pre-release
code).
Andrew gets credit for this one :-) :-).

In addition - added Herb's WITH_PROFILE changes - Herb - please examine
the changes I've made to the smbd/reply.c code you added. The original
code was very ugly and I have replaced it with a
START_PROFILE(x)/END_PROFILE(x) pair using the preprocessor.
Please check this compiles ok with the --with-profile switch.
Jeremy.
(This used to be commit b07611f815)
2000-10-06 03:21:49 +00:00
Andrew Tridgell
3689e4ffc1 the first cut of the internal messaging system.
The motivation for this system is to replace the UDP message for
oplocks, but this commit only does the "set debug level" message.
(This used to be commit 2a34ee95f3)
2000-09-11 07:02:43 +00:00
Andrew Tridgell
b50ca095af allow posix locking database to be opened read-only (for smbstatus)
(This used to be commit b9d78738bb)
2000-06-13 15:46:46 +00:00
Andrew Tridgell
33179a95d8 add some brackets
(This used to be commit bf67721ef5)
2000-06-13 15:46:15 +00:00
Jeremy Allison
9c4079d8c3 Fixed misunderstanding found during CIFS conference. Overlapping lock
ranges (not just included lock ranges) should be handled correctly.
UNIT test still needed.
Jeremy.
(This used to be commit 07872298e3)
2000-05-25 20:05:50 +00:00
Herb Lewis
e522de4808 Using a structure for a tdb key can lead to insideous, hard
to find bugs. On 64 bit IRIX, structure packing means that
a
struct {
SMB_DEV_T dev /* 4 bytes */
SMB_INO_T ino /* 8 bytes */
}

has 4 bytes of padding between the two members. If you
don't null the memory before using it as a tdb key,
you randomly can't find keys depending on what is in
the padding. This caused me immense pain and was hard
to track down.... :-)

Jeremy.
(This used to be commit f2a5ba3f09)
2000-05-10 00:05:27 +00:00
Jeremy Allison
6d9ce38306 Fix for uninitialized memory read in brlock code. brl_locktest now needs
to correctly set the fnum, as the brl_conflict code looks at it.
Jeremy.
(This used to be commit df87259a35)
2000-05-05 20:50:22 +00:00
Jeremy Allison
091c970682 Two fixes. Added missong logic & case in lock split code.
Fixed range split into two, as DLIST_ADD has the wrong semantics...
Jeremy.
(This used to be commit 82681edda1)
2000-05-05 02:17:39 +00:00
Jeremy Allison
fffeaf527d Updated to fix overlapping problem.
Jeremy.
(This used to be commit 9bdfe0f502)
2000-05-04 19:01:14 +00:00
Jeremy Allison
05a28f1dfd Fix for debug statement crash.
Jeremy.
(This used to be commit 57bf92d901)
2000-05-04 00:29:50 +00:00
Jeremy Allison
8c19fa8f7a Fix based on Elrond's code to reduce the store size on removing dead records.
Jeremy.
(This used to be commit 09e92a61a9)
2000-05-03 20:33:25 +00:00
Jeremy Allison
756798d000 Fixed the bug locktest.c found, it was an off-by-one error in the non-overlap
case.
Jeremy.
(This used to be commit 65150c408a)
2000-05-03 19:37:47 +00:00
Jeremy Allison
0d917c6cd6 Fixed silly bug where I wasn't checking for matching fd's in closing a file.
This caused smbd crashes on SIGKILL.
Jeremy.
(This used to be commit d4dcefd12d)
2000-05-03 18:57:21 +00:00