summaryrefslogtreecommitdiff
path: root/source3/smbd/trans2.c
AgeCommit message (Collapse)AuthorFilesLines
2001-03-30This is a big, rather ugly patch. Whilst investigating the files not truncatedJeremy Allison1-134/+84
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-28Insure fix. Don't read 4 bytes from data area unless there are 4 bytes to read.Jeremy Allison1-1/+1
Jeremy. (This used to be commit 3f9cf2e07bb6d429858e47ab6989ea8cf30d0217)
2001-03-23Made the fixes Andrew suggested to asci string code to use srvstr_push.Jeremy Allison1-2/+2
Jeremy. (This used to be commit 1391aa6a6fbe8391a4421f5770da40556f011bb8)
2001-03-23Two OS/2 printer fixes from Jim McDonough @ IBM.Jeremy Allison1-5/+62
First one adds a new info level into the lanman printing and an ioctl to the trans2 code. Andrew - this uses ASCII only. It looks ok to me but please check ! Second one adds a parameter "os2 driver map" that allows OS/2 driver names to be mapped. Jeremy. (This used to be commit da79b519e0b6b4317d7fb5260d74e0e74a7e0b46)
2001-03-16don't need to force unicode strings in flg2 anymoreAndrew Tridgell1-4/+3
(This used to be commit 899ca6e832c72ea68b0ac76205d18a80c87b34d9)
2001-03-16finished the conversion to unicode of the last of the trans2 fnsAndrew Tridgell1-18/+6
(This used to be commit 1d145a37860f7256a081c893e3640f5e18943518)
2001-03-14converted a bunch more trans2 calls for unicode. This got quite tricky :(Andrew Tridgell1-179/+145
(This used to be commit ddee55087756db2a2ac0ee92471d9fea53f38bee)
2001-03-13simpler and more correct srvstr_push()Andrew Tridgell1-9/+9
it now uses outbuf not inbuf for the unicode flag, which allows for some server fns to be ascii and means one less parameter in push calls (This used to be commit a6dd6662267eeddf368ff0ffba76b45761bf4eeb)
2001-03-13converted findnext to unicodeAndrew Tridgell1-1/+1
(This used to be commit 84fc5a7795fe6e3b993649ecc05f6685f8295c02)
2001-03-13this patch does a number of things:Andrew Tridgell1-59/+94
- removes SMB_ALIGNMENT. That macro caused all sorts of problems with getting unicode aligned right in sub-protocols (such as SMBtrans and SMBtrans2). I believe the performance reasons for having SMB_ALIGNMENT has gone away with the new variants of the SMB protocol anyway, as newer commands tend to have their own internal alignment. - fix the locations where we set smb_flg2 to absolute values. We must never do this if we want a hope of coping with unicode. - add initial support for unicode on the wire in smbd. Currently enabled using SMBD_USE_UNICODE environment variable. (This used to be commit b98b1435e9d8f8622444c9ff33082977e661f16b)
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-02-22Fixed file descriptor leak in error processing of print jobs.Jeremy Allison1-3/+17
NT sends "delete on close" to cancel a print job copied from the command line. Deal with this. Merged JohnR's fixes for print job errors. Jeremy. (This used to be commit 2060d74e48d62c99a1689ee02ac435b71918ddf0)
2001-02-08reverted *.* patch until someone explains to me what the test case isAndrew Tridgell1-5/+0
that requires this. i _know_ that this isn't the right solution and it breaks things, which is why I am reverting now. (This used to be commit c2a82a33da1b717b16fb71e597587c806bcf68b3)
2001-02-08merge from SAMBA_2_2Gerald Carter1-2/+8
(This used to be commit 9347121ce6888afeae3cdf256b5f0c5b9c58b0bc)
2001-01-23Fix from Kenichi Okuyama for memory leak on Realloc fail.Jeremy Allison1-21/+51
Jeremy. (This used to be commit 6e568332254cf60d6a1f411df960ac2ec5f4bf8e)
2000-12-11Fix for short names not being returned correctly with non-mangled shares.Jeremy Allison1-1/+2
Jeremy. (This used to be commit bcf0a5c316ee8cf333d9d838b041e44a11cb5f1b)
2000-11-16Ok - fixed a bug in our levelII oplock code. We need to break a level II onJeremy Allison1-8/+23
a byte range lock (write lock only, but Win2k breaks on read lock also so I do the same) - if you think about why, this is obvious. Also fixed our client code to do level II oplocks, if requested, and fixed the code where we would assume the client wanted level II if it advertised itself as being level II capable - it may not want that. Jeremy. (This used to be commit 213cd0b5192307cd4b0026cae94b2f52fb1b0c02)
2000-10-19Ok - this is a big patch - and it may break smbd a bit (althoughJeremy Allison1-31/+27
I hope not). If you encounter strange file-serving behavior after this patch then back it out. I analysed our stat() usage and realised we were doing approx. 3 stat calls per open, and 2 per getattr/setattr. This patch should fix all that. It causes the stat struct returned from unix_convert() (which now *must* be passed a valid SMB_STRUCT_STAT pointer) to be passed through into the open code. This should prevent the multiple stats that were being done so as not to violate layer encapsulation in the API's. Herb - if you could run a NetBench test with this code and do a padc/par syscall test and also run with the current 2.2.0 code and test the padc/par syscalls I'd appreciate it - you should find the number of stat calls reduced - not sure by how much. The patch depends on unix_convert() actually finding the file and returning a stat struct, or returning a zero'd out stat struct if the file didn't exist. I believe we can guarentee this to be the case - I just wasn't confident enough to make this an assertion before. Ok ok - I did write this whilst at the Miami conference..... sometimes you get a little free time at these things :-). Jeremy. (This used to be commit 66a5c05ec46b641224fbe01b30bd7e83571a2a1b)
2000-10-11changes to sync with 2.2. treeHerb Lewis1-5/+42
.cvsignore remove config.h - not in this directory include/profile.h profile changes lib/messages.c added message to return debug level libsmb/clierror.c cast to get rid of compiler warning libsmb/smbencrypt.c cast to get rid of compiler warning profile/profile.c add flush profile stats changes for profile struct rpc_parse/parse_samr.c fix for compiler warning rpc_server/srv_samr.c cast to get rid of compiler warning smbd/ipc.c profile stats message.c profile stats smbd/negprot.c profile stats smbd/nttrans.c profile stats smbd/trans2.c profile stats utils/smbcontrol.c new flush stats command (This used to be commit bbb24daa25dca4e4b6b1f8942cd84ee3aa1bed8e)
2000-10-06Restructuring of vfs layer to include a "this" pointer - can be an fsp orJeremy Allison1-14/+14
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-03Fixes for the fact that UNICODE sizes are no always 2*no of chars whenJeremy Allison1-8/+9
in multibyte codepages. Fix from Hiroshi MIURA, Samba User Group Japan staff. Jeremy. (This used to be commit f2f373df67a3c6b0bd431c19e3494d45ef0a263c)
2000-10-03utf-8 and EUC3 patch from Hiroshi Miura Samba User Group Japan staff.Jeremy Allison1-2/+1
mkdir high bits patch from Robert Dahlem" <Robert.Dahlem@gmx.net>. jeremy. (This used to be commit b40191d27180ab1e59935086073c4d312552f717)
2000-05-26Changed MS_DFS to WITH_MSDFS throughout.Shirish Kalele1-2/+3
Fixed trans2 calls on IPC$ to let dfs referral calls through. (This used to be commit e0965a80bdca5239886b11ef55dc29fed261bfc0)
2000-05-23Did a proper fix for the file access on IPC$. Denied all pipe opens onJeremy Allison1-0/+4
trans2 open calls as we don't have the pipe open response coded up yet. Jeremy. (This used to be commit 8142e27c9c32aba5a7dabc48a676b93cf680151b)
2000-05-23Fixed bug where file access was allowed on IPC$ share.Jeremy Allison1-0/+3
Return correct error codes on invalid share name. Jeremy. (This used to be commit 420d6bc4809cef9d74354175d0fa956ab4e8ac3c)
2000-05-16The new msdfs implementation that uses symlinks to point to otherShirish Kalele1-2/+13
servers. Very intuitive. Removed the dfs map parsing code and tdb maintenance code (files msdfs/parse_dfs_map.c & msdfs/msdfs_tdb.c), dfs map loading and unloading calls (param/loadparm.c smbd/server.c). Added code to display msdfs format symlinks as directories in a transact2_findfirst/findnext. (smbd/trans2.c) Modified msdfs/msdfs.c to use the msdfs symlinks to create dfs referrals. Changed msdfs/README to reflect new operability. (This used to be commit 6803d2574fab9e5931786d5c9aa5dc5867bb5f05)
2000-05-10lib/util_unistr.c:Jeremy Allison1-1/+1
libsmb/clilist.c: rpc_server/srv_spoolss_nt.c: smbd/trans2.c: Changed unistr_to_ascii to unistr_to_dos - do codepage conversion. msdfs/msdfs.c: Removed stub unistr_to_dos. libsmb/pwd_cache.c: Removed obfuscation functions as they don't do anything and don't add any security. Jeremy. (This used to be commit 1ed146467e764e6a81d8f78cd58fb5765ebf5d21)
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-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-30- removed all our old wildcard matching code and replaced it with aAndrew Tridgell1-38/+29
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-25moved trans2.h and nterr.h into includes.h with all our other includesAndrew Tridgell1-1/+0
(This used to be commit d7cd7c88fdabb01d9e40ae8a657737907a21ac37)
2000-04-24Now that fsp's are created on successful file open, the structure memberJeremy Allison1-2/+2
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-23fixed two uninitialised memory referencesAndrew Tridgell1-2/+2
(This used to be commit e4ddd1a4a96b7f723d3d92e4334f4033e1dbc8a8)
2000-04-22This is a *big* checkin that may break some things, but implements theJeremy Allison1-87/+78
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-11finally got sick of the "extern int Client" code and the stupidAndrew Tridgell1-4/+3
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-10the bulk of the changes to get rid of fd_ptr and move print openAndrew Tridgell1-11/+11
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 (This used to be commit d1827a3648009fd0a0d165055015d9aeda7a1037)
2000-04-04Removed strange optimisation (paranoia fix maybe ?) that stopped smbdJeremy Allison1-6/+0
from returning '.' and '..' in a top level listing of a trans2 directory scan. NT does return these entries. Jeremy. (This used to be commit 7325059a0940909ddd98b32d62423700545ef87e)
2000-03-28Win2k will only accept volume labels in UNICODE. Fixed.... :-(.Jeremy Allison1-1/+2
Jeremy. (This used to be commit 676db02f1cd7cb81c58cbbdd3bc94da17dad5227)
2000-03-28Moved common code to set parameter offset field correctly oout of 'if'Jeremy Allison1-10/+8
statement into main function code path. Jeremy. (This used to be commit f15ca0d9273d718534ba2fdd2ccd14ab90a95c8b)
2000-03-27changed the definition of dos_PutUniCodeAndrew Tridgell1-4/+4
the previous definition could result is us overflowing a buffer. The null termination was always added yet the size returned did not include the null termination. the new function takes a BOOL null_terminate, and always returns the total number of bytes consumed by the string. (This used to be commit 426c90433396a95033eefcc4af97603abc934221)
2000-03-13Cleaning up call_trans2getdfsreferral.Shirish Kalele1-1/+0
Instead of a #ifdef MS_DFS in call_trans2getdfsreferral()... , now using a generic call leading to some #define problems.. hopefully I've corrected the last of them. (This used to be commit b5a489fbb808cc7c8ff2338344ef2dae8e351e44)
2000-03-13Cleaned up call_trans2getdfsreferral for when MS_DFS is not defined.Shirish Kalele1-1/+1
(This used to be commit 2b99318341a3f3a3ac138fe96ad271726bf1552c)
2000-03-13moved #endif to end of function to compile when dfs is disabled.Jean-François Micouleau1-1/+1
J.F. (This used to be commit b534fb03b1ef39e5362c29a05cca53782cd157f7)
2000-03-10Cleaning up the warnings from configure.developer.Shirish Kalele1-6/+3
Found that Jeremy had already made some of the changes. (This used to be commit ca02d9f8219265f80fe11236c8c146db1dbb1ae2)
2000-03-10Fixups for compiles with gcc flags -Wall -Wshadow -Wstrict-prototypes ↵Jeremy Allison1-0/+2
-Wpointer-arith -Wcast-qual Partially implemented rpc daemon redirect (needs more work). Jeremy. (This used to be commit a462191698fa589ceac4afd14c652adf699eccad)
2000-03-08dded Microsoft Dfs services.Shirish Kalele1-3/+56
* added a new msdfs/ directory under source/ * added msdfs sources under this directory. * modified configure setup to add a --with-msdfs configure time option Modified Files: Makefile.in acconfig.h configure configure.in include/config.h.in include/includes.h include/proto.h include/smb.h include/smb_macros.h param/loadparm.c smbd/negprot.c smbd/nttrans.c smbd/process.c smbd/reply.c smbd/server.c smbd/trans2.c Added Files: include/msdfs.h msdfs/README msdfs/msdfs.c msdfs/msdfs_tdb.c msdfs/parse_dfs_map.c ---------------------------------------------------------------------- (This used to be commit 4684b4a188b54493dbe7f0de2909a8d3c5c3ebf9)
2000-02-18Fix for reporting file system attributes correctly.Jeremy Allison1-1/+2
Jeremy. (This used to be commit 801ed2389b97f921aa855513696d304c542fda04)
2000-02-03Mega-VFS merge. Yeah baby!Tim Potter1-17/+21
Synopsis: change every disk access function to work through a vfs_ops structure contained in the connection_struct. (This used to be commit 3aad500c0fb61232ed3431ff4b743b5d18ec852f)
2000-01-14useable_space does not include the alignment offset calculations.Jeremy Allison1-1/+8
Bugfix from Marc_Jacobsen@hp.com. Jeremy. (This used to be commit eb06c199163232453e2d9ca50d00765c90f8f3e2)
2000-01-14Added "inherit permissions" patch.Jeremy Allison1-2/+2
Fixed locking bug found by Andrew. Jeremy. (This used to be commit 38dffd360dc2e44bfc9e751f017e24f81ff0f2fa)