summaryrefslogtreecommitdiff
path: root/source3/smbd
AgeCommit message (Collapse)AuthorFilesLines
2000-05-03Insure uninitialized memory read fixes.Jeremy Allison1-0/+2
Jeremy. (This used to be commit 577ddbfbec857dec3ade811f735ec6b183566435)
2000-05-02split the username in the vuser structure into a separateAndrew Tridgell4-17/+18
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-02fixed a memory leak (calling hash_table_init twice)Andrew Tridgell1-1/+7
(This used to be commit 610fcef4d33db2b62e6298bdb68546a2411d03b1)
2000-05-02Moved uglyness needed in fcntl locking (64->32 bit mapping, NFSJeremy Allison2-2/+12
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)
2000-05-02Added sys_fork() and sys_getpid() functions to stop the overheadJeremy Allison11-19/+19
of doing a system call every time we want to just get our pid. Jeremy. (This used to be commit 148628b616b5c29ba6340d65fc3ddbcabba6e67a)
2000-04-30 - added some error checkingAndrew Tridgell1-8/+0
- removed the VTP hook in smbd (This used to be commit 09355fcd50e6c9c0c81e5f70ab9b7ff88aa897bf)
2000-04-30fixed dptr_wcard handling (need to use strdup)Andrew Tridgell1-1/+1
(This used to be commit 0bab0300748a22b4b861fa443be2014bcd7b348c)
2000-04-30removed more cruft from our old wildcard matching codeAndrew Tridgell1-37/+0
(This used to be commit 4a15924ffe36ed37ec193a0ef5a0487238edc311)
2000-04-30go back to ascii in SMB_FIND_FILE_BOTH_DIRECTORY_INFOAndrew Tridgell1-10/+4
NT gives out unicode, but NT clients can't handle a unicode response! (This used to be commit 85d634974f4f8841bf68cd2b22d134fbc010b568)
2000-04-30fixed our smbsearch code. We now store the mask with the dptr, thisAndrew Tridgell2-32/+19
turns out to be essential for a correct implementation (there ins't enough room to store all possible masks in the status return structure!) (This used to be commit 38f5e133670ada6e5799a16cf1a0e2e3ee1d9afd)
2000-04-30- removed all our old wildcard matching code and replaced it with aAndrew Tridgell6-306/+282
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 (This used to be commit 03e9cea004bbba72161a5323cf3b4556c94aed8e)
2000-04-28Moved deletion of vfs handle into smbd/conn.c as it was being done tooJeremy Allison2-16/+15
soon in smbd/service.c (file operations were being done after the handle was closed). It looks cleaner in smbd/conn.c as it is part of the closing of a conn struct anyway. Jeremy. (This used to be commit 858eb53dc510d1b27c4f91045fa932a3ef546754)
2000-04-28Made changes suggested by Andrew review.Jeremy Allison1-15/+1
fd_close now calls fd_close_posix() directly. set_posix_lock/release_posix_lock() now handle the reference counting. More changes due when this gets moved to the file locking/posix.c Jeremy. (This used to be commit 239abd48f049c6a8d2bbc0636eacf347ab77588c)
2000-04-27Ok - this is more subtle than it looks :-).Jeremy Allison2-5/+1
When a file is being closed, once it passes the fnum and tid tests then the locking context should be ignored when removing all locks. This is what is done in the brl close case, but when you have outstanding POSIX locks, then you cannot remove all the brl locks in one go, you have to get the lock list and call do_unlock individually. As this uses global_smbpid as the locking context, you need to make sure that this is set correctly for the specific lock being removed. I now do this by storing the smbpid in each entry in the unlock list returned from the query call. I removed the smbpid from fsp (not needed) and things seem ok (even with the stupid smbpid tricks that smbtorture plays :-). Jeremy. (This used to be commit 6baa96bb466915cc17e8cbad50254d6bd47b967b)
2000-04-27Fixed subtle unlocking bug when a file is closed. We need to store theJeremy Allison2-1/+5
smbpid used when a file was opened in the files_struct. Else we use the wrong global_smbpid when we are closing the file and trying to remove the brl locks - this causes the brl locks to be left when the file is closed as the samba_context check fails. Jeremy. (This used to be commit 2746e5602e493e5b022764b4b839eb4d2f14363b)
2000-04-27Did the rewrite Andrew wanted where all knowledge of POSIX locking isJeremy Allison1-114/+1
removed from the smbd/open.c code. We now use a dlink list of structures indexed by dev/inode to store all pending fd's for close. This could be rewritten to use lib/hash.c if this is discovered to be too slow in use. Andrew, please take a look and let me know if this is what you had in mind. Jeremy. (This used to be commit 0487841120a7584da9a2b83b9574562c415d7024)
2000-04-27Fixed crash bugs Andrew pointed out with LOCK4 smbtortureJeremy Allison1-4/+8
test. Was miscounting posix locks, plus was not taking into account the case where other_fsp == fsp in the 'move locks' case. DOH ! This code will be re-written anyway :-). Jeremy. (This used to be commit 5278ec016cb24d8263fe6e7c1d389f466270ef24)
2000-04-27Fixed range check on writeX.Jeremy Allison1-1/+4
Jeremy. (This used to be commit 9cde198108439358e99128fa9a1b3000e33f5414)
2000-04-27Tidyup of smbecho.Jeremy Allison1-2/+4
Jeremy. (This used to be commit 4a4b7a994bbe327216f736133edc51cf9a351716)
2000-04-25moved trans2.h and nterr.h into includes.h with all our other includesAndrew Tridgell7-8/+0
(This used to be commit d7cd7c88fdabb01d9e40ae8a657737907a21ac37)
2000-04-24Added the code that keeps fd's open across a close if there are other fsp'sJeremy Allison1-1/+119
open on the same dev/inode pair with existing POSIX locks. This is done at the smbd/open layer, so smbd just calls fd_close() and the transfer of any open fd's is done under the covers of fd_close(). When an fsp is closed and no other fsp's open on the same dev/inode pair have existing POSIX locks then all fd's associated with this fsp are closed. Now only the hard part of doing the POSIX range unlock code when read locks overlap remains for full POSIX/SMB lock integration.... Jeremy. (This used to be commit 1df48ed55ee303b6d84d7277fd79761cfe5f7052)
2000-04-24Now that fsp's are created on successful file open, the structure memberJeremy Allison7-27/+36
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-24moved INSURE hook into util.cAndrew Tridgell1-23/+0
(This used to be commit 2fba24ef0e4cae64c5a179370c83d8bbf4e70bb8)
2000-04-23fixed two uninitialised memory referencesAndrew Tridgell1-2/+2
(This used to be commit e4ddd1a4a96b7f723d3d92e4334f4033e1dbc8a8)
2000-04-23trick to get full stack trace when using the free version of insureAndrew Tridgell1-0/+24
(This used to be commit bb9b3e03deebe23cf3fe10c2cb9b67a730e086a2)
2000-04-23insure caught an uninitialised memory reference - ensure it starts asAndrew Tridgell1-0/+2
zero (This used to be commit 53077295b76487a6eafc6b14b69a91074a02aa35)
2000-04-23avoided a memory leak in the ubi code by deleting a mangled cacheAndrew Tridgell1-1/+11
entry before adding to ensure that we don't ever add a duplicate entry this code can be removed when ubi gets fixed (This used to be commit 062d79bf8ba5308803393c7b9140d1f77db3690f)
2000-04-22don't copy a null groups listAndrew Tridgell1-2/+6
(This used to be commit d0fc1675df35e65488a19d7f5929792fba347b07)
2000-04-22fixed overlapping strcpy() found by insureAndrew Tridgell1-9/+6
(This used to be commit 1106fa7f24d229c3877263b7a7dde359556435e6)
2000-04-22fixed uninitialised snumAndrew Tridgell1-0/+1
(This used to be commit 14251aab2ec00aa7f3e6a6e791e78732cb5a9eda)
2000-04-22This is a *big* checkin that may break some things, but implements theJeremy Allison9-527/+547
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)
2000-04-19split fsusage() into a separate module (to fix linking problems withAndrew Tridgell1-127/+2
spoolssd in tng) (This used to be commit e2eacdd74c369fbbcd118148149321e36f3d0010)
2000-04-19patch from luke to split out lanman code from ipc.c into lanman.cAndrew Tridgell2-3147/+3181
(This used to be commit 95246a8432e04bcdeed962d1a6112dfd90518941)
2000-04-19- got rid of the "passive" optionAndrew Tridgell3-21/+13
- cleaned up the standard_sub_*() calls a lot (This used to be commit 2c2d95d77d3667eaa9252506a82b9054b0d0e01c)
2000-04-18locking/locking.c: Fixed placeholder code for POSIX locking.Jeremy Allison1-0/+1
printing/printing.c: Cast tdb_delete to (tdb_traverse_func) to stop warning. tmpfile gives mirror warning. smbd/groupname.c: Remember to file_lines_free() on exit. tdb/tdb.h: Add tdb_traverse_func typedef. Jeremy (This used to be commit 204ca1195c86499bd9beb273ce573db7a56ccead)
2000-04-18ReadDirName calls vfs->readdirname calls dos_readdirname.Luke Leighton1-5/+5
replaced with readdirname. ditto for OpenDir and CloseDir. (This used to be commit a0afe0d5f8378463b1e47cd779aee3af98c1940a)
2000-04-16converted a couple more functions to use a fd instead of a FILE*Andrew Tridgell2-15/+17
added a new utility fn file_lines_slashcont() which is used to handle files that treat a \ followed by a newline as a blank (This used to be commit 384ecd9d66ccd31ee85000c0ca55d413d8f2cc53)
2000-04-16converted a bunch more functions to use a fd instead of a FILE*Andrew Tridgell2-102/+68
to support some of this I added the following functions in util_file.c file_lines_pload : load lines from a pipe file_pload : load a pipe into memory (This used to be commit a09470817c5b21dba42f9ef4ce5e8b768a254c0b)
2000-04-16removed old commentsAndrew Tridgell1-2/+0
(This used to be commit 9f49d17d4cf904034ce3718626450dc25541b420)
2000-04-16use some symbolic names for print queue statusAndrew Tridgell1-11/+17
(This used to be commit e8418ab73667e011b15e00a844240723ff4a8cd6)
2000-04-16added helper fns to change from internal status codes to nt spoolss codesAndrew Tridgell1-5/+41
(This used to be commit 8af879b3f513e7e8ca5f63848d22824b05e68398)
2000-04-16the changes to the main smb codeAndrew Tridgell6-358/+318
------------ 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. (This used to be commit d870542c2884510bd45fd5b54ff2157434d53f4c)
2000-04-15Log file check patch from Mattias Gronlund <Mattias.Gronlund@sa.erisoft.se>.Jeremy Allison1-0/+6
Modified to do checks in timeout processing not in main loop. This (IMHO) is the correct place as (a) we are already root, and (b) it is guarenteed to be called every 200 smb requests. Jeremy. (This used to be commit c3794fd29fdc4e5a0dbd725cdc24fe210934caf2)
2000-04-12Implmented mapping of lock offset/count from 64 bit MS rangesJeremy Allison1-1/+1
to either 63 or 31 bit POSIX ranges. Code to get these locks not yet added. Jeremy. (This used to be commit 9c3b9146a3baff4b2e403ae8fac6c48df1b7e642)
2000-04-12Code to map tdb locks onto POSIX. Mainly placeholder code at the moment,Jeremy Allison1-0/+3
but the structure is done enough so that Andrew can look it over and give a yea/nay decision. Jeremy. (This used to be commit db96f83e34a139f47776fcbb5c1624fbf9d9943b)
2000-04-12Roll back to using static MACHINE.SID after consultation with Andrew. ThisJeremy Allison1-14/+1
code will be removed soon and a SID auto-generated from (probably) primary hostname and never stored in a file will replace it. Jeremy. (This used to be commit fbfe94a799cda7f728bc920d4f0655d4f537e3b6)
2000-04-11The latest open() code changes broke the NT directory opens. Detect if aJeremy Allison2-9/+27
read-only open on a directory was done and return an EISDIR from open_file(). Changed interface to fd_close to return error. Jeremy. (This used to be commit df4302f3911447fcebe9342f6cbf3b89bd3bafba)
2000-04-11include/byteorder.h: ALIGN4/ALIGN2 macros.Jeremy Allison2-111/+59
include/includes.h: Added SMB_BIG_UINT_BITS. lib/util.c: Removed align2/align4 - use macros. libsmb/namequery.c: Use ALIGN2. locking/locking.c: Replace do_lock, do_unlock, args with SMB_BIG_UINT, not SMB_OFF_T. Needed to move to hiding POSIX locks at a lower layer. nmbd/nmbd_processlogon.c: Use ALIGN2/ALIGN4 macros. smbd/blocking.c: Replace do_lock, do_unlock, args with SMB_BIG_UINT, not SMB_OFF_T. smbd/reply.c: Replace do_lock, do_unlock, args with SMB_BIG_UINT, not SMB_OFF_T. Jeremy. (This used to be commit 491eea8a20bf80d426625479326211dc975857a6)
2000-04-11finally got sick of the "extern int Client" code and the stupidAndrew Tridgell12-86/+81
assumption that we have one socket everywhere while doing so I discovered a few bugs! 1) the clientgen session retarget code if used from smbd or nmbd would cause a crash as it called close_sockets() which closed our main socket! fixed by removing close_sockets() completely - it is unnecessary 2) the caching in client_addr() and client_name() was bogus - it could easily get fooled and give the wrong result. fixed. 3) the retarget could could recurse, allowing an easy denial of service attack on nmbd. fixed. (This used to be commit 5937ab14d222696e40a3fc6f0e6a536f2d7305d3)
2000-04-10Fix for soft quotas not being set fromJeremy Allison1-0/+24
Norbert Püschel <Pueschel.Norbert@Walzbarren-VAW.ne.uunet.de> Jeremy. (This used to be commit 5480ecf24bc7c97f25a5a6aee7e24eba7e87a458)