summaryrefslogtreecommitdiffstats
path: root/source/smbd/close.c
Commit message (Collapse)AuthorAgeFilesLines
* Start of merge to 2_2_RELEASE branch for release.Jeremy Allison2002-04-301-24/+7
| | | | Jeremy.
* Move over to RELEASE branch.Jeremy Allison2002-02-011-22/+25
| | | | Jeremy.
* Sync-up with SAMBA_2_2 branch.Jeremy Allison2001-10-111-1/+4
| | | | Jeremy.
* configure:Jeremy Allison2001-04-131-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. Jeremy.
* - remove template from smbrun(). Now uses /tmp and mkstempAndrew Tridgell2001-04-131-1/+1
| | | | | | | - fixed some uninitialised variable warnings - removed smbrun utility (never used) - removed some incorrect varargs usage - removed smbrun smb.conf option
* As Andrew suggested, make smbrun return a fd for a deleted file which can thenJeremy Allison2001-04-121-2/+24
| | | | | be read. Jeremy.
* This is a big, rather ugly patch. Whilst investigating the files not truncatedJeremy Allison2001-03-301-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.
* But Doctor, I had to kill the patient in order to save him....Jeremy Allison2001-02-211-4/+0
| | | | | | | | | | | | | | | | | | | This will probably break 2.2 for a while. Do *NOT* checkout unless you like core dumps. This is the first merge of the TNG SAMR code into 2.2. It will eventually give us a wonderful PDC, but maybe painful in the short term. It had to be done however, and this touches almost every file (mostly just removing the OLD_NT_DOMAIN) stuff. I removed some SAMR functionality from rpcclient that would no longer compile. Also changed fstring to 256 bytes to better match an NT pathname. Jeremy.
* Mega-merge for fixes made in appliance-head.Jeremy Allison2001-01-271-2/+2
| | | | | | | | | | | | | | | | nmbd/nmbd.c: smbd/server.c: Inherited signal fix from John Reilly. printing/nt_printing.c: printing/printing.c: rpc_server/srv_spoolss_nt.c: Fix for PCL drivers not being able to save printer properties. printing/printfsp.c: smbd/close.c: Fix to allow cleanup of spool files on connection drop. tdb/tdb.c: malloc fix from Tim Potter. tdb/tdbtool.c: Free list viewer from John. smbd/lanman.c: Fix to stop a buffer overrun in Win9x from corrupting it's own parameter list. Sigh.... buffer overruns are-us (MS). Jeremy.
* Restructuring of vfs layer to include a "this" pointer - can be an fsp orJeremy Allison2000-10-061-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). 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.
* Memleak fix for cache code.Jeremy Allison2000-10-021-4/+20
| | | | Jeremy.
* more merging voodooAndrew Tridgell2000-05-101-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
* Now that fsp's are created on successful file open, the structure memberJeremy Allison2000-04-241-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 is a *big* checkin that may break some things, but implements theJeremy Allison2000-04-221-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.
* the changes to the main smb codeAndrew Tridgell2000-04-161-4/+6
| | | | | | | | | | | | | | | | | | | | | ------------ The following series of commits are for the new tdb based printing backend. This completely replaces our old printing backend. Major changes include: - all print ops are now done in printing/*.c rather than scattered all over the place - system job ids are decoupled from SMB job ids - the lpq parsers don't need to be nearly so smart, they only need to parse the filename, the status and system job id - we can store lots more info about a job, including the full job name - the queue cache control is much better I also added a new utility routine file_lines_load() that loads a text file and parses it into lines. This is used in out lpq parsing and I also want to use it to replace all of our fgets() based code in other places.
* The latest open() code changes broke the NT directory opens. Detect if aJeremy Allison2000-04-111-1/+1
| | | | | | read-only open on a directory was done and return an EISDIR from open_file(). Changed interface to fd_close to return error. Jeremy.
* the bulk of the changes to get rid of fd_ptr and move print openAndrew Tridgell2000-04-101-16/+6
| | | | | | | | | handling to printing/printing.c most of this was just replacing things like fsp->fd_ptr->fd with fsp->fd the changes in open.c are quite dramatic. Most of it is removing all the functions that handled the fd multiplexing
* Mega-VFS merge. Yeah baby!Tim Potter2000-02-031-4/+3
| | | | | Synopsis: change every disk access function to work through a vfs_ops structure contained in the connection_struct.
* we now pass all byte range locking testsAndrew Tridgell2000-01-141-0/+2
| | | | | the last piece was to use a smb timeout slightly larger than the locking timeout in bloking locks to prevent a race
* converted all our existing shared memory code to use a tdb databaseAndrew Tridgell1999-12-211-4/+3
| | | | | | | | | | | | | instead of either sysv or mmap shared memory or lock files. this means we can now completely remove locking_shm.c locking_slow.c shmem.c shmem_sysv.c and lots of other things also got simpler locking.c got a bit larger, but is much better compartmentalised now
* first pass at updating head branch to be to be the same as the SAMBA_2_0 branchAndrew Tridgell1999-12-131-24/+68
|
* delineation between smb and msrpc more marked. smbd now constructsLuke Leighton1999-12-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pdus, and then feeds them over either a "local" function call or a "remote" function call to an msrpc service. the "remote" msrpc daemon, on the other side of a unix socket, then calls the same "local" function that smbd would, if the msrpc service were being run from inside smbd. this allows a transition from local msrpc services (inside the same smbd process) to remote (over a unix socket). removed reference to pipes_struct in msrpc services. all msrpc processing functions take rpcsrv_struct which is a structure containing state info for the msrpc functions to decode and create pdus. created become_vuser() which does everything not related to connection_struct that become_user() does. removed, as best i could, connection_struct dependencies from the nt spoolss printing code. todo: remove dcinfo from rpcsrv_struct because this stores NETLOGON-specific info on a per-connection basis, and if the connection dies then so does the info, and that's a fairly serious problem. had to put pretty much everything that is in user_struct into parse_creds.c to feed unix user info over to the msrpc daemons. why? because it's expensive to do unix password/group database lookups, and it's definitely expensive to do nt user profile lookups, not to mention pretty difficult and if you did either of these it would introduce a complication / unnecessary interdependency. so, send uid/gid/num_groups/gid_t* + SID+num_rids+domain_group_rids* + unix username + nt username + nt domain + user session key etc. this is the MINIMUM info identified so far that's actually implemented. missing bits include the called and calling netbios names etc. (basically, anything that can be loaded into standard_sub() and standard_sub_basic()...)
* Use VFS operations for file I/O.Tim Potter1999-04-041-3/+2
| | | | | Modified invocations of fd_attempt_close as it now takes a fsp instead of a fd.
* debug string with no %s parameter. oopsLuke Leighton1998-10-271-1/+2
|
* Handle the case where multiple smbd have the file open, some of whomJeremy Allison1998-10-231-2/+11
| | | | | | don't have the ALLOW_DELETE_ON_CLOSE share flag enabled. Told you this was fiddly code :-). Jeremy.
* Reasonably large change to give us *exactly* correct NT delete on close ↵Jeremy Allison1998-10-231-0/+1
| | | | | | | | | | | | | | semantics. This was trickier than it looks :-). Check out the new DELETE_ON_CLOSE flag in the share modes and the new code that iterates through all open files on the same device and inode in files.c and trans2.c Also changed the code that modifies share mode entries to take generic function pointers rather than doing a specific thing so this sort of change should be easier in the future. Jeremy.
* include/smb.h: Added #defines for lots of things - makes our code a *lot* ↵Jeremy Allison1998-10-231-1/+2
| | | | | | | | | | | | | easier to read. lib/util.c: Fixed Luke's set_first_token() function - should return void. smbd/close.c: Move delete_on_close into file_fd_struct structure. smbd/ipc.c: Changed local_machine back to fstring. smbd/nttrans.c: Use defines for mapping share modes. smbd/open.c: Move delete_on_close into file_fd_struct structure, added code for ALLOW_SHARE_DELETE. smbd/reply.c: Use defines for mapping share modes. smbd/trans2.c: Move delete_on_close into file_fd_struct structure. Jeremy.
* Ok - this is the 'expose 64 bit to the clients' checkin.Jeremy Allison1998-09-111-1/+15
| | | | | | | | | | I have tested it by creating a 'holey' 20GB file - checking that it shows up correctl in the NT file view (it does) and am busily copying it to NULL: on the NT box. All good so far.... :-). Also implemented NT 'delete on close' semantics. Jeremy.
* Bugfix for leak in reference counted file struct.Jeremy Allison1998-09-051-1/+2
| | | | | Added "nt smb support" parameter to allow NT SMB's to be turned off. Jeremy.
* configure.in, configure: include/config.h.in: Added stropts and poll.Jeremy Allison1998-08-311-2/+2
| | | | | | | | | | | include/smb.h: Moved old typedefs of uint8 etc. into include/includes.h where all the other defines live (changed them from typedefs to defines). Other changes : changed from using uint32 to SMB_DEV_T and SMB_INO_T in preparation for moving to size independed (ie. 64 bit clean) device and inode access. Stat call wrapper comes next :-). Jeremy.
* Fixes for the problem in blocking locks with file_fsp returning theJeremy Allison1998-08-211-2/+2
| | | | | | chain_fsp on close (if you don't know what this means, consider yourself lucky - this one took a day to track down :-). Jeremy.
* Makefile.in: Moved blocking lock code into smbd/blocking.c for link purposes.Jeremy Allison1998-08-191-4/+2
| | | | | | | | | | | include/includes.h: Added nterr.h. locking/locking.c: Moved blocking lock code into smbd/blocking.c for link purposes. smbd/close.c: Added blocking lock removal to file close. smbd/filename.c: Tidied up unix_convert() so I could read it (:-) in preparation for the stat_cache code. smbd/nttrans.c: Added WRITE_ATTRIBUTES check. smbd/reply.c: Fixed multibyte char problem in wildcard mask. Jeremy.
* this completes the splitup of server.c.Andrew Tridgell1998-08-171-0/+170
the splitup was done with an axe, not a scalpel, so there are some rough edges. I mostly wanted to get the general form right with fine tuning of what goes where to come later. Still, this is better than what we had before where server.c was a general repository for anything that didn't fit elsewhere.