summaryrefslogtreecommitdiff
path: root/source3/smbd/close.c
AgeCommit message (Collapse)AuthorFilesLines
2007-10-10r13571: Replace all calls to talloc_free() with thye TALLOC_FREE()Gerald Carter1-2/+2
macro which sets the freed pointer to NULL. (This used to be commit b65be8874a2efe5a4b167448960a4fcf6bd995e2)
2007-10-10r13293: Rather a big patch I'm afraid, but this should fix bug #3347Jeremy Allison1-15/+51
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 23f16cbc2e8cde97c486831e26bcafd4ab4a9654)
2007-10-10r13274: Fix for bug #3467. Not a show stopper.Jeremy Allison1-2/+2
jason qian <jason@infrant.com> was a *fantastic* help in tracking this down. Jeremy. (This used to be commit 9f4a9c70fa232047868e5d8a3f132a2dd6bfee82)
2007-10-10r12877: Stop passing structs around in smb messages, insteadJeremy Allison1-1/+5
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 d01824b78576a034428e1cef73868d1169057991)
2007-10-10r12460: Fixes for bug 3349Volker Lendecke1-0/+2
(This used to be commit 040eda6bf0517204d5650702eea7e1d1c5eeb3d5)
2007-10-10r12213: Final fix for #3303 - send rename messages to smbd'sJeremy Allison1-11/+34
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 932e337db8788e75344e1c7cf1ef009d090cb039)
2007-10-10r12203: Add the share path into the sharemode db. This involvesJeremy Allison1-2/+2
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 9d93af713f8520ca506730dd32aa2b994937eaba)
2007-10-10r12160: The filename parameter to get_share_mode_lock is goingJeremy Allison1-2/+2
to become very important as we fix #3303, so make sure we don't accidently set it here. Jeremy. (This used to be commit d1a9d0587cd9a391f0193ca76cb319803c6e019f)
2007-10-10r11344: I don't think share mode conflicts occur on deletingJeremy Allison1-17/+6
a directory when you've got permissions. Need to write a smbtorture test for this. Jeremy. (This used to be commit e959a5be393eb59b8987eb6967a2ee5d11978f41)
2007-10-10r11341: Put directory opens into the share mode db so weJeremy Allison1-4/+34
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 1134abbbb3fd8e8b88e1a5817aae106476a4c126)
2007-10-10r10656: BIG merge from trunk. Features not copied overGerald Carter1-39/+48
* \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 939c3cb5d78e3a2236209b296aa8aba8bdce32d3)
2007-10-10r8531: Fix a memleakVolker Lendecke1-0/+1
(This used to be commit ebf0cda797da2c63aa0033f034573f6d5485b57a)
2007-10-10r8219: Merge the new open code from HEAD to 3.0. Haven't yet run the tortureJeremy Allison1-30/+16
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-10r7963: Add aio support to 3.0.Jeremy Allison1-0/+14
Jeremy. (This used to be commit 1de27da47051af08790317f5b48b02719d6b9934)
2007-10-10r5731: Get delayed write semantics closer to W2K3. We need to store 2 times.Jeremy Allison1-1/+3
This may fix bug #2382. Jeremy. (This used to be commit a27c351e6beafc6609790a9bb9a3d0a1331e8f35)
2007-10-10r3121: Bug #1956. Ensure errno is saved and restored consistently on a ↵Jeremy Allison1-8/+18
normal_close. Jeremy. (This used to be commit f08f437c736e44913b3eeb16d6e32da8975442a7)
2007-10-10r1263: Make "defer sharing violations" a global parameter.Jeremy Allison1-0/+4
Jeremy. (This used to be commit 42cdeccc36dc5f4bd133b84d4eaeb76f42f8043b)
2007-10-10r1085: Now it's had some proper user testing, merge in the deferred open ↵Jeremy Allison1-0/+30
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 894cc6d16296b934c112786eec896846156aee5d)
2007-10-10r370: The 'it does never happen -- error on close()' does happen when you exceedVolker Lendecke1-1/+1
your quota on an AFS file system. The specific errno was thrown away by close_normal_file(). Thus we returned NT_STATUS_UNSUCCESSFUL and not NT_STATUS_DISK_FULL as we should. Fix that. (Not that this gives more sane Windows app behaviour.... :-( ) Jerry, jra, could you please look over this one, it's been quite a while since I touch file server code. Volker (This used to be commit 588351d1b37a900eb90eddd80882170c201e9162)
2003-07-25More printf portability fixes. Got caught out by some gcc'isms lastTim Potter1-2/+2
time. )-: (This used to be commit 59dae1da66a5eb7e128263bd578f167d8746e9f0)
2003-07-24More printf fixes - size_t is long on some architectures.Tim Potter1-1/+1
(This used to be commit ba4d334b822248d8ab929c9568533431603d967e)
2003-05-14Prefix VFS API macros with SMB_ for consistency and to avoid problems with ↵Alexander Bokovoy1-1/+1
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-1/+1
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-04-22Tidyups of some dubious logic discovered whilst trying to track down aJeremy Allison1-1/+1
strange oplock related issue on the PSA. Jeremy. (This used to be commit 1dd274bf61aaaad3c475de93f53aac176678bc7c)
2003-04-04Re-fix regression noticed by Tom Schaefer <tom@umsl.edu> due toJeremy Allison1-0/+2
correct delete on close semantics change. Jeremy. (This used to be commit 7a45b45490e6001c17fc89aabfa802f76fa3fe5e)
2003-02-11Fix delete on close semantics to match W2K. I (think:-) I understand it now :-).Jeremy Allison1-0/+16
Thanks to Nir Livni <nirl@cyber-ark.com> for giving me the test case to track it down. Jeremy. (This used to be commit 41894489e82a474f4f8f66aa2c7a117ed05b33e1)
2003-01-03Fix problem with "hide unreadable". stat file opens are baaack :-).Jeremy Allison1-53/+72
Jeremy. (This used to be commit 62038a0abf193d4dc4f37c31ac77216a10f6f326)
2002-03-20Remove the "stat open" code - make it inline. This should fix theJeremy Allison1-23/+7
bugs with opening and renaming mp3 files, also the word rename problems that people have had for a while. Needs a make clean :-) make. Also added JohnR's printing fix. Jeremy. (This used to be commit 504e5ef0494c54efbd0357e334cb2aa5a9eb9c14)
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-12-17removed unused variableAndrew Tridgell1-1/+0
(This used to be commit bed269e6d4dc4c9622ec37f9a7e9e2b4dbbaee24)
2001-12-16Ensured filetimes set (by name) after close. Ignore errors. This is theJeremy Allison1-2/+11
correct way to ensure times set in 'pending modtime' and 'time close' are always set correctly. Inspired by patch from Juergen Hasch. Jeremy. (This used to be commit 24053858543fa6c22c0c3222570109fbfdabab9e)
2001-11-13Formatting fixes only.Jeremy Allison1-14/+14
Jeremy. (This used to be commit 27081355a97550b26c870907a471352a11921ffc)
2001-10-02Removed 'extern int DEBUGLEVEL' as it is now in the smb.h header.Tim Potter1-2/+0
(This used to be commit 2d0922b0eabfdc0aaf1d0797482fef47ed7fde8e)
2001-09-17move to SAFE_FREE()Simo Sorce1-1/+1
(This used to be commit a95943fde0ad89ae3f2deca2f7ba9cb5ab612b74)
2001-09-04Merge of transfer file code from 2.2, fix for readbraw.Jeremy Allison1-1/+1
Jeremy. (This used to be commit c05e79453655abb67fd47a2d3dba88b4c5377e35)
2001-08-27converted smbd to use NTSTATUS by defaultAndrew Tridgell1-4/+0
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 83d9896c1ea8be796192b51a4678c2a3b87f7518)
2001-08-22Fixed the (incorrect) paranioa fix I put in for the fcntl lock spin.Jeremy Allison1-0/+3
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 fe4aa720181a43f7a636ca029680fab0c836b968)
2001-07-04strchr and strrchr are macros when compiling with optimisation in gcc, so we ↵Andrew Tridgell1-1/+1
can't redefine them. damn. (This used to be commit c41fc06376d1a2b83690612304e85010b5e5f3cf)
2001-07-04The big character set handling changeover!Andrew Tridgell1-1/+1
This commit gets rid of all our old codepage handling and replaces it with iconv. All internal strings in Samba are now in "unix" charset, which may be multi-byte. See internals.doc and my posting to samba-technical for a more complete explanation. (This used to be commit debb471267960e56005a741817ebd227ecfc512a)
2001-04-14configure:Jeremy Allison1-1/+1
configure.in: include/config.h.in: include/profile.h: smbd/vfs-wrap.c: smbd/vfs.c: Added fchmod and fchown to VFS (sorry Gerald - but we needed them anyway). smbd/dosmode.c: smbd/files.c: printing/printfsp.c: smbd/close.c: smbd/open.c: Fixed "dos filemode" correctly so there are no race conditions. Forces test of open of file O_WRONLY before allowing fchmod as root. Afterwards, calls standard close function that preserves POSIX locks due to POSIX-me-harder braindamage. :-). Andrew please review this code. Also - in removing the tmpdir param in smbrun an extra NULL parameter was missed in each print_run_command() call (which is a varargs fn.). Now fixed. Jeremy. (This used to be commit 32397e5bc6d995ce7ca37c82d6aedc1e5b1b6fbd)
2001-04-13Merge of Andrew's changes in 2.2.Jeremy Allison1-1/+1
Jeremy. (This used to be commit fc76681812b1469208ad6c8847afdfc68bc6db49)
2001-04-13As Andrew suggested, make smbrun return a fd for a deleted file which can thenJeremy Allison1-2/+24
be read. Jeremy. (This used to be commit e7d59d6de89a5fdd201e4b5c6072dab08b1519db)
2001-03-30This is a big, rather ugly patch. Whilst investigating the files not truncatedJeremy Allison1-12/+33
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 51987684bd231c744da2e5f3705fd236d5616173)
2001-03-11Merge of new 2.2 code into HEAD (Gerald I hate you :-) :-). Allows new SAMRJeremy Allison1-4/+0
RPC code to merge with new passdb code. Currently rpcclient doesn't compile. I'm working on it... Jeremy. (This used to be commit 0be41d5158ea4e645e93e8cd30617c038416e549)
2001-01-29Changes from APPLIANCE_HEAD:David O'Neill1-2/+2
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. (This used to be commit 025f7a092ad258ff774e3f5e53737f8210cc8af6)
2000-10-06Restructuring of vfs layer to include a "this" pointer - can be an fsp orJeremy Allison1-1/+1
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-10-02Memleak fix for cache code.Jeremy Allison1-4/+20
Jeremy. (This used to be commit 1ebe54666b0fc6f224f17036063dfe0ef7ec9147)
2000-05-10more merging voodooAndrew Tridgell1-0/+4
this adds "#define OLD_NTDOMAIN 1" in lots of places. Don't panic - this isn't permanent, it should go after another few merge steps have been done (This used to be commit 92109d7b3c06f240452d39f669ecb8c9c86ab610)
2000-04-24Now that fsp's are created on successful file open, the structure memberJeremy Allison1-1/+1
fsp->open is no longer needed (if an fsp pointer is valid, then it's open :-). NB for Luke, this patch also did not apply to TNG. TNG is not yet identical w.r.t file serving with HEAD. This makes it impossible for me to help maintain TNG. Please fix asap. lib/substitute.c: Removed unused variable (pidstr). Jeremy. (This used to be commit 389b700a26e8a308a0dff6fc038c38068aa0119a)
2000-04-22This is a *big* checkin that may break some things, but implements theJeremy Allison1-8/+5
new open mechanism Andrew & I discussed. config.sub: configure: Included the QNX patch. include/vfs.h: smbd/vfs-wrap.c: smbd/vfs.c: Added ftruncate vfs call (needed). Note that we will also need locking calls in the vfs (to be added). lib/util_unistr.c: nmbd/nmbd_processlogon.c: Fix for NT domain logons causing nmbd to core dump. Also fix for sidsize DOS bug. locking/locking.c: Check value of ret before using it for memdup. printing/printing.c: Convert print_fsp_open to return an allocated fsp. rpc_server/srv_lsa.c: Fix for NT domain logons. I have removed all use of lp_share_modes() from the code (although I left the parameter in the table for backwards compatibility). It no longer makes sense for this to exist. smbd/close.c: Removed lp_share_modes(). smbd/fileio.c: Fixed parameters to unlock_share_entry call in panic code. smbd/files.c: Correctly set the unix_ERR_code to ERRnofids on fsp allocation fail. smbd/nttrans.c: smbd/reply.c: smbd/trans2.c: Changed all occurrences of open_file_shared/open_directory/ open_file_stat to return an fsp from the call. smbd/open.c: Changed all occurrences of open_file_shared/open_directory/ open_file_stat to return an fsp from the call. In addition I have fixed a long standing race condition in the deny mode processing w.r.t. two smbd's creating a file. Andrew, please note that your original idea of using open with O_EXCL in this case would not work (I went over the races very carefully) and so we must re-check deny modes *after* the open() call returns. This is because there is a race between the open with O_EXCL and the lock of the share mode entry. Imagine the case where the first smbd does the open with O_EXCL and a deny mode of DENY_ALL, but is pre-empted before it locks the share modes and creates the deny mode entry for DENY_ALL. A second smbd could then come in with O_RDONLY and a deny mode of DENY_NONE and the two opens would be allowed. The *only* way to fix this race is to lock the share modes after the open and then do the deny mode checks *after* this lock in the case where the file did not originally exist. This code will need extensive testing but seems to initially work. Jeremy. (This used to be commit ab0ecc39d688f16b9692fe90b991f0b89287070a)