summaryrefslogtreecommitdiffstats
path: root/source/smbd/files.c
Commit message (Collapse)AuthorAgeFilesLines
* more merging voodooAndrew Tridgell2000-05-101-0/+2
| | | | | | 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
* Fix for misunderstanding of fsync added when vfs layerHerb Lewis2000-05-101-1/+1
| | | | | was done. Samba was doing fsync's (bleagh). Jeremy.
* Added sys_fork() and sys_getpid() functions to stop the overheadJeremy Allison2000-05-021-1/+1
| | | | | of doing a system call every time we want to just get our pid. Jeremy.
* Now that fsp's are created on successful file open, the structure memberJeremy Allison2000-04-241-10/+23
| | | | | | | | | | | | 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-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* initialise fsp->fd to -1Andrew Tridgell2000-04-101-0/+1
|
* the bulk of the changes to get rid of fd_ptr and move print openAndrew Tridgell2000-04-101-106/+12
| | | | | | | | | 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-1/+1
| | | | | Synopsis: change every disk access function to work through a vfs_ops structure contained in the connection_struct.
* use string_set() instead of string_init()Andrew Tridgell2000-01-161-1/+1
| | | | bug pointed out by Richard
* first pass at updating head branch to be to be the same as the SAMBA_2_0 branchAndrew Tridgell1999-12-131-12/+6
|
* spelling mistake.Luke Leighton1999-08-131-1/+1
|
* Changed arguments to fsync() function to break dependency onTim Potter1999-04-201-2/+3
| | | | connection_struct.
* Use VFS operations for file I/O.Tim Potter1999-04-041-3/+2
|
* Fixed crash bug which was assuming that fd_ptr was always non-nullJeremy Allison1998-11-181-2/+5
| | | | | (which is not the case with open directories). Jeremy.
* Reasonably large change to give us *exactly* correct NT delete on close ↵Jeremy Allison1998-10-231-0/+35
| | | | | | | | | | | | | | 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.
* Re-added code to tell the user how many open files theyJeremy Allison1998-10-161-5/+15
| | | | | have. Needed for server diagnosis purposes... Jeremy.
* - fixed a bunch of warnings and minor errorsAndrew Tridgell1998-10-081-1/+1
| | | | | | - got smbtorture to compile - removed %D from some of lukes code - Luke, what is %D? it ain't portable anyway
* added a function set_maxfiles() to set our file rlimit to the maxAndrew Tridgell1998-10-051-27/+8
| | | | possible and return the max.
* got rid of USE_FILES_ARRAY code (it was unused)Andrew Tridgell1998-10-011-106/+4
|
* (Finally) implemented "max open files" as a global smb.conf parameter.Jeremy Allison1998-09-301-22/+44
| | | | | | Sets up the files array correctly - limited by the smb.conf parameter and by the max fd's per process as found by getrlimit(). Jeremy.
* First cut at kernel oplocks. This should have no effect unless runninJeremy Allison1998-09-231-13/+15
| | | | | | | | | on a machine that supports them in autoconf. Move various functions out of lib/util.c into smbd/process.c and smbd/oplock.c where they belong. Jeremy.
* smb.h: Removed fdnum from file_fd_struct. Not needed.Jeremy Allison1998-09-101-29/+109
| | | | | | | files.c: Removed fd bitmap - not needed. Added code to do use arrays rather than linked list - disabled by default but can be enabled to check performance. Jeremy.
* some cleanups to use ZERO_STRUCT() and friendsAndrew Tridgell1998-09-051-4/+4
|
* tridge the destroyer returns!Andrew Tridgell1998-09-051-2/+3
| | | | | | | | | | | | | | | | | | | | | | prompted by the interpret_security() dead code that Jean-Francois pointed out I added a make target "finddead" that finds potentially dead (ie. unused) code. It spat out 304 function names ... I went through these are deleted many of them, making others static (finddead also reports functions that are used only in the local file). in doing this I have almost certainly deleted some useful code. I may have even prevented compilation with some compile options. I apologise. I decided it was better to get rid of this code now and add back the one or two functions that are needed than to keep all this baggage. So, if I have done a bit too much "destroying" then let me know. Keep the swearing to a minimum :) One bit I didn't do is the ubibt code. Chris, can you look at that? Heaps of unused functions there. Can they be made static?
* Bugfix for leak in reference counted file struct.Jeremy Allison1998-09-051-3/+3
| | | | | Added "nt smb support" parameter to allow NT SMB's to be turned off. Jeremy.
* Modified dev_t and ino_t code to be 64 bit clean (including changesJeremy Allison1998-09-041-1/+7
| | | | | | | | | | to oplock break message passing). I think that smbd/nmbd are now inode and offset size independent (at least for 32 bit and 64 bit systems). Now to expose all this new functionality to NT clients..... Jeremy.
* More abstraction of file system data types, to move to a 64Jeremy Allison1998-09-011-1/+1
| | | | | | | | | | | | | | | | | | | | | bit file interface for the NT SMB's. Created a new define, SMB_STRUCT_STAT that currently is defined to be struct stat - this wil change to a user defined type containing 64 bit info when the correct wrappers are written for 64 bit stat(), fstat() and lstat() calls. Also changed all sys_xxxx() calls that were previously just wrappers to the same call prefixed by a dos_to_unix() call into dos_xxxx() calls. This makes it explicit when a pathname translation is being done, and when it is not. Now, all sys_xxx() calls are meant to be wrappers to mask OS differences, and not silently converting filenames on the fly. Jeremy.
* configure.in, configure: include/config.h.in: Added stropts and poll.Jeremy Allison1998-08-311-5/+5
| | | | | | | | | | | 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.
* Turning on blocking locking code. NB. Blocking lock requests that are notJeremy Allison1998-08-201-2/+2
| | | | | | | | | | | | | | | | | | the head of an SMB request (ie. are part of a chain) will not be queued - this will be fixed when we move to the new chain code. In practice, this doesn't seem to cause much of a problem (in my admittedly limited testing) bug a debug level zero message will be placed in the log when this happens to help determine how real the problem is. smbd/locking.c: New debug messages. smbd/blocking.c: New blocking code - handles SMBlock, SMBlockread and SMBlockingX smbd/chgpasswd.c: Fix for master fd leak. smbd/files.c: Tidyup comment. smbd/nttrans.c: Added fnum to debug message. smbd/process.c: Made chain_reply() use construct_reply_common(). Added blocking lock queue processing into idle loop. smbd/reply.c: Added queue pushes for SMBlock, SMBlockread and SMBlockingX. Jeremy.
* Fixed bug introduced by the recent changes where the chain_fnumJeremy Allison1998-08-171-1/+19
| | | | | could be overwritten in oplock processing code. Jeremy.
* added some optimisation for the case where the number of open files isAndrew Tridgell1998-08-171-33/+14
| | | | | | | | | very large. files.c now promotes a files_struct to the top of the list if it is used when it is more than 10 elements from the top. also moved common linked list code for the 5 sets of linked lists that I've created over the past few days into dlinklist.h (I've explained to Chris why I didn't use the ubiqx code)
* moved connection_struct handling code into smbd/conn.c and changed itAndrew Tridgell1998-08-171-8/+12
| | | | to a linked list with bitmap format.
* much cleaner chain pointer handling for both files and pipes.Andrew Tridgell1998-08-171-15/+40
| | | | | | the chain pointer is now stored as a static and is set whenever a handle is created or extracted. This also makes the code less error prone.
* some cleanups from the conversion of Pipes[] to a linked list. I alsoAndrew Tridgell1998-08-171-11/+8
| | | | | | | | removed most cases where a pnum is used and substituted a pipes_struct*. in files.c I added a offset of 0x1000 to all file handles on the wire. This makes it much less likely that bad parsing will give us the wrong field.
* - some tidying up in files.cAndrew Tridgell1998-08-161-3/+3
| | | | | | | | - handle null fsp in DEBUG() at end of reply_ntcreate_and_X(). Jeremy, can you fix this properly? - get snum right in print queue code in ipc.c (it was broken by my connections_struct changes).
* got rid of the Files[] array completely (previously I'd just made itAndrew Tridgell1998-08-161-146/+207
| | | | | | | | | | | | | | | | | private to files.c) It now is a doubly linked list with a bitmap for allocated file numbers. Similarly for the fd_ptr code. I also changed the default maximum number of open files to 4096. The static cost is 1 bit per file. It all seems to work, and it passes the "does Sue scream" test, but if you see weird behaviour then please investigate. With the volume of new code that has gone in there are bound to be one or two bugs lurking. note that you must do a "make clean" before building this as many data structures have changed in size.
* changed find_free_file() to file_new().Andrew Tridgell1998-08-161-1/+1
|
* this checkin gets rid of the global Files[] array and makes it localAndrew Tridgell1998-08-151-0/+321
in files.c it should now be faily easy to expand the default MAX_OPEN_FILES to many thousands.