1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-11 17:58:16 +03:00

229 Commits

Author SHA1 Message Date
Andrew Tridgell
5498da6664 0 byte lock ranges ARE valid -
Jeremy Allison
27d3dd0e7c Tidyup fixes for fcntl spin problem.
Jeremy.
-
Jeremy Allison
fe4aa72018 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.
-
Jeremy Allison
e4a57fb456 Missed uninitialized variable return for del_share_mode().
Jeremy.
-
Volker Lendecke
1c94fa8064 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.
-
Jeremy Allison
41066208ad 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.
-
Jeremy Allison
befbfea210 Add printing of errno when POSIX lock requests fail.
Jeremy.
-
Simo Sorce
fa8e55b8b4 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.
-
Jeremy Allison
840802f106 Added "use mmap" for HPUX.
Jeremy.
-
Jeremy Allison
a3925cb9c6 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.
-
Jeremy Allison
015a077acc Ensure we return correct error on trying to unlock a region not locked.
Jeremy.
-
Jeremy Allison
5c42845b5b Fixed the first locking error (test #8 found by locktest code from
Clarion locktest.
Jeremy.
-
Andrew Tridgell
8ec9c87b5d use LDSHFLAGS not -shared in several places -
Jeremy Allison
d3496897f1 Stupid typo. Should be if (!tdb).
Jeremy.
-
Jeremy Allison
d7aa42e459 Defensive brlock and locking database cleaning code.
Jeremy.
-
Jeremy Allison
fc76681812 Merge of Andrew's changes in 2.2.
Jeremy.
-
Jeremy Allison
51987684bd 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.
-
Jeremy Allison
0be41d5158 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.
-
Tim Potter
aee52c7acf tdb_unlockchain() no longer returns a value -
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.
-
Jeremy Allison
b456274a7b Fix from John Reilly for equivalence tests.
Jeremy.
-
Jeremy Allison
dfe77c7046 Herb's warning fixes. Also the POSIX locking fix.
We now use our own vfs layer to do get/set acl calls (hurrah!).
Jeremy.
-
Jeremy Allison
b07611f815 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.
-
Andrew Tridgell
2a34ee95f3 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.
-
Andrew Tridgell
b9d78738bb allow posix locking database to be opened read-only (for smbstatus) -
Andrew Tridgell
bf67721ef5 add some brackets -
Jeremy Allison
07872298e3 Fixed misunderstanding found during CIFS conference. Overlapping lock
ranges (not just included lock ranges) should be handled correctly.
UNIT test still needed.
Jeremy.
-
Herb Lewis
f2a5ba3f09 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.
-
Jeremy Allison
df87259a35 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.
-
Jeremy Allison
82681edda1 Two fixes. Added missong logic & case in lock split code.
Fixed range split into two, as DLIST_ADD has the wrong semantics...
Jeremy.
-
Jeremy Allison
9bdfe0f502 Updated to fix overlapping problem.
Jeremy.
-
Jeremy Allison
57bf92d901 Fix for debug statement crash.
Jeremy.
-
Jeremy Allison
09e92a61a9 Fix based on Elrond's code to reduce the store size on removing dead records.
Jeremy.
-
Jeremy Allison
65150c408a Fixed the bug locktest.c found, it was an off-by-one error in the non-overlap
case.
Jeremy.
-
Jeremy Allison
d4dcefd12d Fixed silly bug where I wasn't checking for matching fd's in closing a file.
This caused smbd crashes on SIGKILL.
Jeremy.
-
Jeremy Allison
91f038356b Added range info to the panic message to track down the bug with
locktest.
Jeremy.
-
Andrew Tridgell
51624a3a2f - clear dead locks at startup
- fixed a bug which caused lock records to not decrease in size
-
Jeremy Allison
74d42644e6 Fix for stacking locks in brlock and POSIX. Windows only allows a read lock
to overlay a write lock on the same fnum. When overlaying read locks onto
a write lock, the number of locks is counted, and the first unlock removes
the write lock and downgrades this to a read lock. Do the same when mapping
to POSIX.
Jeremy.
-
Jeremy Allison
6eb4fb6eef Implemented the last (I hope:-) part of the locking puzzle, the reference
counting when Windows downgrades a write lock to a read lock, then reference
counts the unlocks to match the locks.
With this code the POSIX unlock isn't done until the final Windows unlock.
Jeremy.
-
Andrew Tridgell
ee8546342d split the username in the vuser structure into a separate
userdom_struct. As the name implies this also contains a domain
(unused at the moment).

This will be important shortly, as operation in appliance mode needs
the domain to be always carried with the username.
-
Jeremy Allison
46092ee141 Moved uglyness needed in fcntl locking (64->32 bit mapping, NFS
errors etc.) into locking/posix.c, where it is needed. fcntl_lock in lib/util.c
is now very small and clean.
Added (*lock) op to vfs layer.
Jeremy.
-
Jeremy Allison
148628b616 Added sys_fork() and sys_getpid() functions to stop the overhead
of doing a system call every time we want to just get our pid.
Jeremy.
-
Jeremy Allison
3b25f7368b locking/posix.c: Fixed double-free nasty crash bug found by insure.
utils/make_smbcodepage.c:
utils/make_unicodemap.c: Insure 'make install' fixes.
Jeremy.
-
Andrew Tridgell
8ec815920d added TDB_INTERNAL, TDB_NOLOCK and TDB_NOMMAP flags.
TDB_INTERNAL replaces the old method of passing a null filename
-
Andrew Tridgell
03e9cea004 - removed all our old wildcard matching code and replaced it with a
call to ms_fnmatch(). This also removes all the Win9X semantics stuff
and a bunch of other associated cruft.

- moved the stat cache code into statcache.c

- fixed the uint16 alignment requirements of ascii_to_unistr() and
  unistr_to_ascii()

- trans2 SMB_FIND_FILE_BOTH_DIRECTORY_INFO returns the short name as
  unicode always (at least thats what NT4 does)

- fixed some errors in the in-memory tdb code. Still ugly, but doesn't
  crash as much
-
Jeremy Allison
6bded3b74e Removed tdb locking calls (picky Andrew...:-) -
Jeremy Allison
3f655de1c7 Ok - this is the *third* implementation of this (third time's the charm :-).
This implementation keeps all POSIX lock records in a separate in memory
tdb database only known about in locking/posix.c. In addition, the pending
close fd's are also held in a tdb which has an array of fd's indexed by
device and inode.

The walk-split code uglyness has been moved to posix.c from brlock.c,
which is the only place that needs to know about it, and the extra
functions hacked into brlock to expose internal state have been removed.

This implementation passes smbtorture locktest4, the only thing I need
to check now for completeness is what to do about lock upgrade/downgrades
which Win32 allows under some *very* strange circumstances.

Jeremy.
-
Jeremy Allison
31a57be658 Split off of POSIX locking into separate unit as Andrew requested.
Done so I don't lose my edits... :-).
Jeremy.
-
Jeremy Allison
b812f09ba8 Forgot to close when "posix locking" is set to False.
Jeremy.
-
Jeremy Allison
a2deb91128 Added optimization where we are single opener (don't free POSIX locks).
Jeremy.
-