summaryrefslogtreecommitdiff
path: root/source3/locking/posix.c
AgeCommit message (Collapse)AuthorFilesLines
2007-10-10r19668: Convert the locking params to use struct share_param instead of snumVolker Lendecke1-1/+1
(This used to be commit 609dbec600048718b86cd1ecdc2ce49bbdeb803c)
2007-10-10r17452: Some C++ warningsVolker Lendecke1-1/+1
(This used to be commit e4b8c79a9d6f7323953121887af4f482d04a9228)
2007-10-10r17041: Trying to track down a *big* memory leak in the new lock code.Jeremy Allison1-0/+1
Fix a small one first.... (easy to valgrind). Jeremy (This used to be commit 43d24fbd41ed745a5b21514b526e655663c509ee)
2007-10-10r17000: Allow CIFS POSIX locks to coexist with Windows locks.Jeremy Allison1-1/+1
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 2f8cabe98d3776cb0bdf6b4ef1490fe0119e260a)
2007-10-10r16992: Fix bug #3922 reported by jason@ncac.gwu.edu, correctlyJeremy Allison1-1/+1
look at the return code. Jeremy. (This used to be commit f11933b3ac91c6fbacd6b410f4d2c0d400df23ee)
2007-10-10r16987: Fix the logic errors in ref-counting Windows locks.Jeremy Allison1-7/+8
Hopefully will fix the build farm. Still a few errors in RAW-LOCK to look at though... Jeremy. (This used to be commit edd72d37de570fdad09f7ee983b5b22a1613e558)
2007-10-10r16973: Fix subtle logic error in lock ref counting found byJeremy Allison1-7/+7
cifsfs client code. Jeremy. (This used to be commit 53094435d89088124041d57078c21a12e761e2bf)
2007-10-10r16945: Sync trunk -> 3.0 for 3.0.24 code. Still needJeremy Allison1-667/+624
to do the upper layer directories but this is what everyone is waiting for.... Jeremy. (This used to be commit 9dafb7f48ca3e7af956b0a7d1720c2546fc4cfb8)
2007-10-10r16307: Make sure we know we must pass a valid pointer here.Jeremy Allison1-3/+2
Klocwork #1129. Jeremy. (This used to be commit e8d86362ba8762a5e4180e7320f5ac8bb37c203d)
2007-10-10r15018: Merge Volker's ipc/trans2/nttrans changes overJeremy Allison1-16/+75
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 08e52ead03304ff04229e1bfe544ff40e2564fc7)
2007-10-10r14703: Clarify the return codes for the POSIX locking case. ThisJeremy Allison1-2/+6
was confusing. Jeremy. (This used to be commit bc1a605a39e58a7dbdcd4d132345e957e3ed9d5e)
2007-10-10r13915: Fixed a very interesting class of realloc() bugs found by Coverity.Jeremy Allison1-11/+6
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 1d710d06a214f3f1740e80e0bffd6aab44aac2b0)
2007-10-10r8219: Merge the new open code from HEAD to 3.0. Haven't yet run the tortureJeremy Allison1-17/+21
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 c7fe18761e2c753afbffd3a78abff46472a9b8eb)
2007-10-10r7975: One more tidyup to ensure we're using "struct posix_lock".Jeremy Allison1-1/+2
Jeremy. (This used to be commit 960a5d37d1cfa25e4f7491b175dab68ac9f37c43)
2007-10-10r7972: Tidy up the posix locking in memory db code whilst I'm waiting for jhtJeremy Allison1-20/+21
to get back to me with a backtrace. Jeremy. (This used to be commit f2bcfdddc769a2939b03a1a6742fec86712c9097)
2007-10-10r6502: add LOCKING debug class - pull PRINTINGDB class definition from trunkHerb Lewis1-0/+3
so our numbers don't get out of sync (This used to be commit 58e307664e02ebf0415f19ed625d2f166d9cb1cc)
2007-10-10r5625: Reformat (tidy).Jeremy Allison1-4/+4
(This used to be commit b94db3a75806f1b09a8a0366029812ba2195727c)
2007-10-10r4088: Get medieval on our ass about malloc.... :-). Take control of all our ↵Jeremy Allison1-6/+5
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 620f2e608f70ba92f032720c031283d295c5c06a)
2007-10-10r3120: Fix bug #1955 reported by Love <lha@stacken.kth.se>. Inconsistent ↵Jeremy Allison1-3/+3
error return. Jeremy. (This used to be commit c6b144654ae544c86f7caa35483e25f0cfe5e904)
2003-05-14Prefix VFS API macros with SMB_ for consistency and to avoid problems with ↵Alexander Bokovoy1-5/+5
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 c2689ed118b490e49497a76ed6a2251262018769)
2003-05-11Fix VFS layer:Alexander Bokovoy1-6/+5
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 91984ef5caa2d13c5d52e1f535bd3bbbae1ec978)
2003-02-12Fixes for HPUX only having limited POSIX lock range from Michael Steffens ↵Jeremy Allison1-12/+7
<michael.steffens@hp.com> Jeremy. (This used to be commit e9b4fb8b9aedda9afc01af976264298002be3096)
2002-12-20Forward port the change to talloc_init() to make all talloc contextsJeremy Allison1-2/+2
named. Ensure we can query them. Jeremy. (This used to be commit 09a218a9f6fb0bd922940467bf8500eb4f1bcf84)
2002-11-23Lots of fixes for error paths where tdb_fetch() data need freeing.Jeremy Allison1-11/+14
Found via a post from Arcady Chernyak <Arcady.Chernyak@efi.com>. Jeremy. (This used to be commit 5d5762d1787db4392d2dff16024097c638b2d494)
2002-01-30Removed version number from file header.Tim Potter1-2/+1
Changed "SMB/Netbios" to "SMB/CIFS" in file header. (This used to be commit 6a58c9bd06d0d7502a24bf5ce5a2faf0a146edfa)
2001-10-02Removed 'extern int DEBUGLEVEL' as it is now in the smb.h header.Tim Potter1-1/+0
(This used to be commit 2d0922b0eabfdc0aaf1d0797482fef47ed7fde8e)
2001-09-17move to SAFE_FREE()Simo Sorce1-23/+15
(This used to be commit e61aec84edaf55b9ee087b076d2f1311033dc839)
2001-09-06Fix the 62bit locking onto 32 bit NFS mounts problem generically for HPUX.Jeremy Allison1-94/+21
Don. please check this out. Jeremy. (This used to be commit ce9f95996498f7795aaef069e1443ea1c7d524b3)
2001-09-05NFS v2 can return ENOLCK when greater than 31 bit offsets are used.Jeremy Allison1-2/+2
Treat this the same as an EFBIG error. Jeremy (This used to be commit 8fad5177701c1738a7f5bdd7c0082ef23a00b876)
2001-08-26Ignore locks of length zero as they mean different things in Win32Jeremy Allison1-5/+18
and POSIX. Jeremy. (This used to be commit bd9cbf4c6883c1a39f28db8afa7cc0bd04b1b09f)
2001-08-13Add printing of errno when POSIX lock requests fail.Jeremy Allison1-3/+3
Jeremy. (This used to be commit befbfea21035b0566fc6ba8674587fc44ad7bbdc)
2001-08-12this is a big global fix for the ptr = Realloc(ptr, size) bug.Simo Sorce1-4/+9
many possible mem leaks, and segfaults fixed. someone should port this fix to 2.2 also. (This used to be commit fa8e55b8b465114ce209344965c1ca0333b84db9)
2001-07-02Fixed the nastiest locking bug to track down.... smb_pids are sent in theJeremy Allison1-1/+0
lockingX calls - use that instead of smb_pid in the packet. Jeremy. (This used to be commit a3925cb9c6303ce24e5fecad6c8f3a0ba78b9ee0)
2001-06-04use LDSHFLAGS not -shared in several placesAndrew Tridgell1-2/+2
(This used to be commit 8ec9c87b5d1a7dae17d5b1a30f58effaf5e69e4b)
2001-04-13Merge of Andrew's changes in 2.2.Jeremy Allison1-3/+1
Jeremy. (This used to be commit fc76681812b1469208ad6c8847afdfc68bc6db49)
2000-10-06Herb's warning fixes. Also the POSIX locking fix.Jeremy Allison1-1/+1
We now use our own vfs layer to do get/set acl calls (hurrah!). Jeremy. (This used to be commit dfe77c7046cbd65ee52aea7439f21503c1eac41d)
2000-10-06Restructuring of vfs layer to include a "this" pointer - can be an fsp orJeremy Allison1-6/+6
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 b07611f8159b0b3f42e7e02611be9f4d56de96f5)
2000-06-13allow posix locking database to be opened read-only (for smbstatus)Andrew Tridgell1-10/+10
(This used to be commit b9d78738bb30da3d989dfacc95cfde529f2afca5)
2000-05-25Fixed misunderstanding found during CIFS conference. Overlapping lockJeremy Allison1-340/+278
ranges (not just included lock ranges) should be handled correctly. UNIT test still needed. Jeremy. (This used to be commit 07872298e3ee8b4b50b69cb4e49b88635792128e)
2000-05-10Using a structure for a tdb key can lead to insideous, hardHerb Lewis1-0/+2
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 f2a5ba3f0939f59097f0ef6a25f1cf9b5574f157)
2000-05-05Two fixes. Added missong logic & case in lock split code.Jeremy Allison1-4/+12
Fixed range split into two, as DLIST_ADD has the wrong semantics... Jeremy. (This used to be commit 82681edda14dcc3d58bb303cfac5452072de67df)
2000-05-04Updated to fix overlapping problem.Jeremy Allison1-68/+142
Jeremy. (This used to be commit 9bdfe0f5023988962f8a8b4d847de7a0ee27f85c)
2000-05-04Fix for debug statement crash.Jeremy Allison1-1/+1
Jeremy. (This used to be commit 57bf92d90147b207664152d44ce4bfb5235dc7d8)
2000-05-03Fixed the bug locktest.c found, it was an off-by-one error in the non-overlapJeremy Allison1-1/+1
case. Jeremy. (This used to be commit 65150c408a5254215de89c8c774c33c4d011c2c0)
2000-05-03Fixed silly bug where I wasn't checking for matching fd's in closing a file.Jeremy Allison1-7/+24
This caused smbd crashes on SIGKILL. Jeremy. (This used to be commit d4dcefd12d14df112f083c312acbea0196bc5c23)
2000-05-03Added range info to the panic message to track down the bug withJeremy Allison1-1/+5
locktest. Jeremy. (This used to be commit 91f038356b7efa04cf4bfa5e6afd8b144b6b4ad5)
2000-05-03Fix for stacking locks in brlock and POSIX. Windows only allows a read lockJeremy Allison1-91/+129
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. (This used to be commit 74d42644e6e52808037975e909aa56c850838b76)
2000-05-02Implemented the last (I hope:-) part of the locking puzzle, the referenceJeremy Allison1-23/+90
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. (This used to be commit 6eb4fb6eef367f68169d6ec1c816226b1ad9f110)
2000-05-02split the username in the vuser structure into a separateAndrew Tridgell1-1/+2
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. (This used to be commit ee8546342d5be90e730372b985710d764564b124)
2000-05-02Moved uglyness needed in fcntl locking (64->32 bit mapping, NFSJeremy Allison1-3/+121
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. (This used to be commit 46092ee1410faa4e3c143d80a960a8adaa19d7fc)