summaryrefslogtreecommitdiff
path: root/source3/smbd/trans2.c
AgeCommit message (Collapse)AuthorFilesLines
2009-05-22Ensure we return NT_STATUS_FILE_IS_A_DIRECTORY on a posix open on aJeremy Allison1-1/+1
directory name. Jeremy.
2009-05-20s3: Change unix_convert (and its callers) to use struct smb_filenameTim Prouty1-41/+87
This is the first of a series of patches that change path based operations to operate on a struct smb_filename instead of a char *. This same concept already exists in source4. My goals for this series of patches are to eventually: 1) Solve the stream vs. posix filename that contains a colon ambiguity that currently exists. 2) Make unix_convert the only function that parses the stream name. 3) Clean up the unix_convert API. 4) Change all path based vfs operation to take a struct smb_filename. 5) Make is_ntfs_stream_name() a constant operation that can simply check the state of struct smb_filename rather than re-parse the filename. 6) Eliminate the need for split_ntfs_stream_name() to exist. My strategy is to start from the inside at unix_convert() and work my way out through the vfs layer, call by call. This first patch does just that, by changing unix_convert and all of its callers to operate on struct smb_filename. Since this is such a large change, I plan on pushing the patches in phases, where each phase keeps full compatibility and passes make test. The API of unix_convert has been simplified from: NTSTATUS unix_convert(TALLOC_CTX *ctx, connection_struct *conn, const char *orig_path, bool allow_wcard_last_component, char **pp_conv_path, char **pp_saved_last_component, SMB_STRUCT_STAT *pst) to: NTSTATUS unix_convert(TALLOC_CTX *ctx, connection_struct *conn, const char *orig_path, struct smb_filename *smb_fname, uint32_t ucf_flags) Currently the smb_filename struct looks like: struct smb_filename { char *base_name; char *stream_name; char *original_lcomp; SMB_STRUCT_STAT st; }; One key point here is the decision to break up the base_name and stream_name. I have introduced a helper function called get_full_smb_filename() that takes an smb_filename struct and allocates the full_name. I changed the callers of unix_convert() to subsequently call get_full_smb_filename() for the time being, but I plan to eventually eliminate get_full_smb_filename().
2009-05-18s3: Always allocate memory in dptr_ReadDirNameAravind Srinivasan1-4/+18
This is a follow up to 69d61453df6019caef4e7960fa78c6a3c51f3d2a to adjust the API to allow the lower layers allocate memory. Now the memory can explicitly be freed rather than relying on talloc_tos(). Signed-off-by: Tim Prouty <tprouty@samba.org>
2009-04-14Rework Samba3 to use new libcli/auth code (partial)Andrew Bartlett1-0/+1
This commit is mostly to cope with the removal of SamOemHash (replaced by arcfour_crypt()) and other collisions (such as changed function arguments compared to Samba3). We still provide creds_hash3 until Samba3 uses the credentials code in netlogon server Andrew Bartlett
2009-03-25Ensure we never enter VFS_CREATE without having initializedJeremy Allison1-0/+2
sbuf as invalid (if not already read via stat()). Still trying to find the build farm RAW-STREAM errors and it's happening in a openX call.... Jeremy.
2009-03-23s3:smbd: use new simplified snb_signing code in the serverStefan Metzmacher1-2/+3
We keep the seqnum/mid mapping in the smb_request structure. This also moves one global variable into the smbd_server_connection struct. metze
2009-02-25Make test for open modes more robust against other bits.Jeremy Allison1-1/+1
Jeremy.
2009-02-25Fix bug in processing of open modes in POSIX open.Jeremy Allison1-0/+2
Was missing case of "If file exists open. If file doesn't exist error." Damn damn damn. CIFSFS client will have to have fallback cases for this error for a long time. Jeremy.
2009-02-24Allow set attributes on a stream fnum to be redirected to the base filename.Jeremy Allison1-2/+10
Fixes the new RAW-STREAMS torture test. Jeremy.
2009-02-13Add VFS ops for Windows BRL: Lock, Unlock and Cancel:Zack Kirsch1-1/+2
This patch adds 3 new VFS OPs for Windows byte range locking: BRL_LOCK_WINDOWS, BRL_UNLOCK_WINDOWS and BRL_CANCEL_WINDOWS. Specifically: * I renamed brl_lock_windows, brl_unlock_windows and brl_lock_cancel to *_default as the default implementations of the VFS ops. * The blocking_lock_record (BLR) is now passed into the brl_lock_windows and brl_cancel_windows paths. The Onefs implementation uses it - future implementations may find it useful too. * Created brl_lock_cancel to do what brl_lock/brl_unlock do: set up a lock_struct and call either the Posix or Windows lock function. These happen to be the same for the default implementation. * Added helper functions: increment_current_lock_count() and decrement_current_lock_count(). * Minor spelling correction in brl_timeout_fn: brl -> blr. * Changed blocking_lock_cancel() to return the BLR that it has cancelled. This allows us to assert its the lock that we wanted to cancel. If this assert ever fires, this path will need to take in the BLR to cancel, rather than choosing on its own. * Adds a small helper function: find_blocking_lock_record_by_id(). Used by the OneFS implementation, but could be useful for others.
2009-02-09s3: Added SMB_VFS_INIT_SEARCH_OP to initialize data at the beginning of SMB ↵Steven Danneman1-3/+9
search requests. By default this VFS call is a NOOP, but the onefs vfs module takes advantage of it to initialize direntry search caches at the beginning of each TRANS2_FIND_FIRST, TRANS2_FIND_NEXT, SMBffirst, SMBsearch, and SMBunique
2009-02-09S3: New module interface for SMB message statistics gatheringtodd stecher1-1/+4
This changelist allows for the addition of custom performance monitoring modules through smb.conf. Entrypoints in the main message processing code have been added to capture the command, subop, ioctl, identity and message size statistics.
2009-01-29s3: Add a new SMB_VFS_GET_ALLOC_SIZE vfs operationTim Prouty1-39/+13
This allows module implementors to customize what allocation size is returned to the client.
2009-01-23Extend NTIMES to allow setting create_timetodd stecher1-40/+59
1) Add in smb_file_time struct to clarify code and make room for createtime. 2) Get and set create time from SMB messages. 3) Fixup existing VFS modules + examples Some OS'es allow for the setting of the birthtime through kernel interfaces. This value is generically used for Windows createtime, but is not settable in the code today.
2009-01-15s3: make better use of ccache by not including version.h in every C-file.Michael Adam1-0/+1
version.h changes rather frequently. Since it is included via includes.h, this means each C file will be a cache miss. This applies to the following situations: * When building a new package with a new Samba version * building in a git branch after calling mkversion.sh after a new commit (i.e. virtually always) This patch improves the situation in the following way: * remove inlude "version.h" from includes.h * Use samba_version_string() instead of SAMBA_VERSION_STRING in files that use no other macro from version.h instead of SAMBA_VERSION_STRING. * explicitly include "version.h" in those files that use more macros from "version.h" than just SAMBA_VERSION_STRING. Michael
2009-01-08s3:smbd: move all globals and static variables in globals.[ch]Stefan Metzmacher1-3/+1
The goal is to move all this variables into a big context structure. metze
2009-01-08s3:smbd: make static const in mangle_hash2.c really static constStefan Metzmacher1-1/+1
const char *foo, means a non-const pointer to a const char. const char * const foo, means a const pointer to a const char. char * const foo, would mean a const pointer to a non-const char. metze
2009-01-01Add iconv_convenience argument to size functions.Jelmer Vernooij1-0/+2
2008-12-31Rename parent_dirname_talloc() to parent_dirname()Volker Lendecke1-2/+1
2008-12-31Use parent_dirname_talloc instead of parent_dirname in smb_unix_mknodVolker Lendecke1-3/+7
2008-12-23s3: Fix stream marshalling to return the correct streaminfo statusTim Prouty1-10/+1
When there are enough streams on a file to fill up the max_data_count when responding to a trans2 streaminfo, samba is returning NT_STATUS_BUFFER_TOO_SMALL. Windows handles this by returning NT_STATUS_BUFFER_OVERFLOW while still sending as much of the data that it can fit into the buffer. When the windows client sees BUFFER_OVERFLOW, it retries the streaminfo with a larger buffer (2x). The windows client starts at 2K and will continue increasing the buffer size by two until it reaches 64K. If the streams don't fit in 64K the windows client seems to give up. This patch fixes marshall_stream_info to overfill the buffer by 1 stream so that send_trans2_replies can properly detect the overflow and return the correct status.
2008-12-19Fix bug #5986 - Editing a stream is broken (rename problems).Jeremy Allison1-10/+11
Jeremy.
2008-12-04Fix bug #5937 - filenames with "*" char hide other filesJeremy Allison1-6/+4
Jeremy.
2008-12-03s3: Change SMB_VFS_CREATE_FILE to take a create_file_flags argumentTim Prouty1-6/+6
This replaces the is_dos_path bool with a more future-proof argument. The next step is to plumb INTERNAL_OPEN_ONLY through this flag instead of overridding the oplock_request.
2008-12-03s3: Modify direct callers of open_file_ntcreate and open_directory to call ↵Tim Prouty1-61/+98
SMB_VFS_CREATE_FILE
2008-12-03s3: Add new "is_dos_path" argument to SMB_VFS_CREATE_FILETim Prouty1-0/+1
Now unix paths can be differentiated from windows paths so the underlying create_file implementations can convert paths correctly.
2008-12-03s3: Add SMB_VFS_CREATE_FILE to the vfs layerTim Prouty1-16/+17
Modify all callers of create_file to go through SMB_VFS_CREATE_FILE
2008-12-01s3:smbd: write times should be set on the base file instead of the stream nameStefan Metzmacher1-1/+9
metze
2008-12-01s3:smbd: return DELETE_PENDING on path based operations on streams, when the ↵Stefan Metzmacher1-0/+40
main file was deleted. metze
2008-12-01s3:smbd: construct the correct newname for stream renamesStefan Metzmacher1-16/+32
The Windows Explorer creates temporary streams and renames them later via SFILEINFO_RENAME_INFO. The newname comes in as ":Stream:$DATA". metze
2008-12-01Fix a debug message, append the correct \nVolker Lendecke1-1/+1
2008-11-28Remove inbuf references from the trans2ioctl codeVolker Lendecke1-4/+4
2008-11-28Consolidate the buffer checks for the reply_trans style functionsVolker Lendecke1-57/+18
This is the one where I found the problem that led to 3.2.5. So if there is one checkin in the last year that I would like others to review and *understand*, it is this one :-) Volker
2008-11-28Remove an unused variableVolker Lendecke1-2/+0
2008-11-27Fix the offset checks in the trans routinesVolker Lendecke1-3/+3
This fixes a potential crash bug, a client can make us read memory we should not read. Luckily I got the disp checks right... Volker (cherry picked from commit 64a1d80851da5b05e70ec6c96f6e9bd473748369) (cherry picked from commit f04c5650a3aeca23591ddc781c4b297caaf9bb3f)
2008-11-08Do not write into inbuf for the transs requestVolker Lendecke1-6/+6
Instead, fix up the outbuf in send_xx_reply. In those routines, we know what we are returning.
2008-11-04Fix a const warningVolker Lendecke1-1/+1
2008-11-02Remove some inbuf references by adding "cmd" to smb_requestVolker Lendecke1-3/+3
2008-11-02Use "vwv" in trans parsingVolker Lendecke1-21/+21
2008-11-02Remove a bunch of direct inbuf references by adding "vwv" to smb_requestVolker Lendecke1-5/+5
2008-10-31Get closer to passing S4 RAW-ACLs.Jeremy Allison1-3/+6
Jeremy.
2008-10-16Cope with bad trans2mkdir requests from System i QNTC IBM SMB client.Jeremy Allison1-3/+4
If total_data == 4 Windows doesn't care what values are placed in that field, it just ignores them. The System i QNTC IBM SMB client puts bad values here, so ignore them. Jeremy.
2008-10-14Use {u,}int64_t instead of SMB_BIG_{U,}INT.Jelmer Vernooij1-57/+57
2008-10-13Use "struct files_struct" for pipes instead of smb_np_structVolker Lendecke1-3/+3
2008-10-13Pass struct smb_request to file_freeVolker Lendecke1-11/+11
on the way to get rid of chain_fsp
2008-10-13Pass struct smb_request to file_fspVolker Lendecke1-4/+4
The goal is to get rid of the chain_fsp global variable
2008-09-23Fix bug #5783 FindFirst fails where search pattern == mangled filename.Jeremy Allison1-6/+7
That was an old and subtle bug. Jeremy.
2008-09-10When requesting UNIX info levels on findfirst/findnext, don't play games ↵Jeremy Allison1-1/+5
with write time, just return what the underlying filesystem says. Trying not to confuse UNIX apps any more than necessary. Jeremy. (This used to be commit b81a4dd003957a611ea190979d828b75d07a1f80)
2008-09-08Fix calculation of useable_space for trans2 and nttrans repliesVolker Lendecke1-6/+9
When alignment was in place, we pretended to send more data/params according to the param_offset/param_length and data_offset/data_length parameters than would actually fit into the SMB according to the NBSS length field. (This used to be commit ef3c132b8455c6fe4d0bb9f0be881040a806a4ed)
2008-09-05Write times code update.Jeremy Allison1-5/+7
Ok, here's the fix for the write times breakage with the new tests in S4 smbtorture. The key is keeping in the share mode struct the "old_file_time" as the real write time, set by all the write and allocation calls, and the "changed_write_time" as the "sticky" write time - set by the SET_FILE_TIME calls. We can set them independently (although I kept the optimization of not setting the "old_file_time" is a "changed_write_time" was already set, as we'll never see it. This allows us to update the write time immediately on the SMBwrite truncate case, SET_END_OF_FILE and SET_ALLOCATION_SIZE calls, whilst still have the 2 second delay on the "normal" SMBwrite, SMBwriteX calls. I think in a subsequent patch I'd like to change the name of these from "old_file_time" to "write_time" and "changed_write_time" to "sticky_write_time" to make this clearer. I think I also fixed a bug in Metze's original code in that once a write timestamp had been set from a "normal" SMBwriteX call the fsp->update_write_time_triggered variable was set and then never reset - thus meaning the write timestamp would never get updated again on subsequent SMBwriteX's. The new code checks the update_write_time_event event instead, and doesn't update is there's an event already scheduled. Metze especially, please check this over for your understanding. Jeremy. (This used to be commit 6f20585419046c4aca1f7d6c863cf79eb6ae53b0)