summaryrefslogtreecommitdiff
path: root/source3/smbd/open.c
AgeCommit message (Collapse)AuthorFilesLines
2009-06-25s3: Remove get_full_smb_filename() from open_directory()Tim Prouty1-19/+9
This is possible because open_directory() returns an error if the fname is a stream, so the base_name can be used.
2009-06-25s3: Change set_ea() and its callers to use smb_filenameTim Prouty1-9/+2
2009-06-25Fix bug #6506 - SMBD server doesn't set EAs when a file is overwritten in ↵Jeremy Allison1-1/+2
NT_TRANSACT_CREATE. Reported and verified by Long Li <longli@microsoft.com> Jeremy.
2009-06-24s3: Plumb smb_filename through SMB_VFS_STAT and SMB_VFS_LSTATTim Prouty1-53/+73
This patch introduces two new temporary helper functions vfs_stat_smb_fname and vfs_lstat_smb_fname. They basically allowed me to call the new smb_filename version of stat, while avoiding plumbing it through callers that are still too inconvenient. As the conversion moves along, I will be able to remove callers of this, with the goal being to remove all callers. There was also a bug in create_synthetic_smb_fname_split (also a temporary utility function) that caused it to incorrectly handle filenames with ':'s in them when in posix mode. This is now fixed.
2009-06-19Fix coverity #676. Forward NULL.Jeremy Allison1-0/+6
Jeremy.
2009-06-18Add some const to the stat struct in the dosmode calls.Jeremy Allison1-1/+0
Fix a couple more unix_convert uses to filename_convert. Fix bug in acl_group_override() where an uninitialized struct could be used. Move unix_convert with wildcard use in SMBsearch reply to boilerplate code. Jeremy.
2009-06-17s3: Change SMB_VFS_OPEN to take an smb_filename structTim Prouty1-4/+4
This was a little messy because of all of the vfs modules I had to touch. Most of them were pretty straight forward, but the streams modules required a little attention to handle smb_filename. Since the use of smb_filename enables the vfs modules to access the raw, over-the-wire stream, a little bit of the handling that was being done by split_ntfs_stream_name has now been shifted into the individual stream modules. It may be a little more code, but overall it gives more flexibility to the streams modules, while also allowing correct stream handling.
2009-06-17s3: Plumb smb_filename from create_file all of the way down to fd_openTim Prouty1-190/+245
I used the smb_filename struct everywhere that was feasible for the first pass. There are still some places in this path that need to be changed to use smb_filename, but this is a good start. I also: - Removed fname/path arguments from a few functions that weren't really using them. - Added a utility function for detecting whether an smb_filename is a stream.
2009-06-16Remove msdfs pathname processing from default create file.Jeremy Allison1-25/+0
No longer needed. Jeremy
2009-06-12s3: Plumb smb_filename through SMB_VFS_CREATE_FILETim Prouty1-60/+55
2009-06-10s3: Prepare the first set of SMB_VFS_CREATE_FILE callers to take an ↵Tim Prouty1-2/+10
smb_filename struct Some of the callers required minimal changes, while others (copy_internals) required significant changes. The task is simplified a little bit because we are able to do operations and checks on the base_name when a stream isn't used. This patch should cause no functional changes. Volker, Jeremy: Please check
2009-06-10s3: Remove unix_convert handling from createfile implementationsTim Prouty1-29/+4
2009-06-10s3: Remove unused stat structs being passed to SMB_VFS_CREATE_FILETim Prouty1-4/+1
2009-05-30Fix bug #6421 - POSIX read-only open fails on read-only shares.Jeremy Allison1-3/+3
The change to smbd/trans2.c opens up SETFILEINFO calls to POSIX_OPEN only. The change to first smbd/open.c closes 2 holes that would have been exposed by allowing POSIX_OPENS on readonly shares, and their ability to set arbitrary flags permutations. The O_CREAT -> O_CREAT|O_EXCL change removes an illegal combination (O_EXCL without O_CREAT) that previously was being passed down to the open syscall. Jeremy.
2009-05-26Introduce "struct stat_ex" as a replacement for SMB_STRUCT_STATVolker Lendecke1-28/+28
This patch introduces struct stat_ex { dev_t st_ex_dev; ino_t st_ex_ino; mode_t st_ex_mode; nlink_t st_ex_nlink; uid_t st_ex_uid; gid_t st_ex_gid; dev_t st_ex_rdev; off_t st_ex_size; struct timespec st_ex_atime; struct timespec st_ex_mtime; struct timespec st_ex_ctime; struct timespec st_ex_btime; /* birthtime */ blksize_t st_ex_blksize; blkcnt_t st_ex_blocks; }; typedef struct stat_ex SMB_STRUCT_STAT; It is really large because due to the friendly libc headers playing macro tricks with fields like st_ino, so I renamed them to st_ex_xxx. Why this change? To support birthtime, we already have quite a few #ifdef's at places where it does not really belong. With a stat struct that we control, we can consolidate the nanosecond timestamps and the birthtime deep in the VFS stat calls. At this moment it is triggered by a request to support the birthtime field for GPFS. GPFS does not extend the system level struct stat, but instead has a separate call that gets us the additional information beyond posix. Without being able to do that within the VFS stat calls, that support would have to be scattered around the main smbd code. It will very likely break all the onefs modules, but I think the changes will be reasonably easy to do.
2009-05-20s3: Change unix_convert (and its callers) to use struct smb_filenameTim Prouty1-2/+13
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-04-21s3-secdesc: use SEC_FLAG_SYSTEM_SECURITY instead of SEC_RIGHT_SYSTEM_SECURITY.Günther Deschner1-4/+4
Guenther
2009-04-09Fix bug #6254 - PUT/GET produces an error in IPv6 to a smb-server(3.3) has ↵Jeremy Allison1-18/+23
parameter "msdfs root = yes" This was broken by the refactoring around create_file(). MSDFS pathname processing must be done FIRST. MSDFS pathnames containing IPv6 addresses can be confused with NTFS stream names (they contain ":" characters. Jeremy.
2009-03-23s3:smbd: use new simplified snb_signing code in the serverStefan Metzmacher1-9/+0
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-03-12Fix bug #6186 - map readonly does not workJeremy Allison1-3/+25
Jeremy.
2009-03-05Fix bug #6160 - Office 2007 fails saving files to a Samba mapped drive.Jeremy Allison1-0/+22
Confirmed by reporters. Jeremy.
2009-03-04s3: Change open_streams_for_delete to call through the vfs layerTim Prouty1-5/+7
This eliminates the last direct caller of create_file_unixpath
2009-03-04Second part of fix for #6154, ensure we return max accessJeremy Allison1-0/+9
if admin user. Jeremy.
2009-02-28Fix bug #6082 - smbd_gpfs_getacl failed: Windows client can´t rename orJeremy Allison1-0/+19
delete file (directory fix). Jeremy.
2009-02-23More warning fixes for Solaris.Jeremy Allison1-1/+1
Jeremy.
2009-02-20S3: Detect max_open_files from systemtodd stecher1-0/+12
- Attempt to use syscalls to determine max-open-files value. - Add in periodic logging when max file limit reached
2009-02-19s3: Add extid to the dev/inode pairTim Prouty1-2/+2
This extends the file_id struct to add an additional generic uint64_t field: extid. For backwards compatibility with dev/inodes stored in xattr_tdbs and acl_tdbs, the ext id is ignored for these databases. This patch should cause no functional change on systems that don't use SMB_VFS_FILE_ID_CREATE to set the extid. Existing code that uses the smb_share_mode library will need to be updated to be compatibile with the new extid.
2009-02-18s3: Fix bug opening streams with truncating dispositionTim Prouty1-1/+1
Do not attempt to delete streams on a truncating open, if the name we're opening is itself a stream. Port 176e8857203944bc332844b700749120ce90c891 to standard open path
2009-02-04Fix bug #Bug 6090 renaming or deleting a "not matching/resolving" symlink is ↵Jeremy Allison1-20/+34
failing. Reported by Kukks. Make sure we correctly use LSTAT in all cases where POSIX pathnames are being used. This matters when dealing with symlinks pointing to invalid paths being renamed or deleted not all deletes and renames are done via an nt_create open. Jeremy.
2009-02-02Fix bug #6082 - smbd_gpfs_getacl failed: Windows client can´t rename or ↵Jeremy Allison1-10/+46
delete file This fixes the generic rename/delete problem for 3.3.0 and above. Fixed slightly differently to discussions, user viewable modified ACLs are not a good idea :-). Jeremy.
2009-01-09s3: Fix open path to delete streams depending on the create dispositionTim Prouty1-0/+14
The new create disposition test in smbtorture RAW-STREAMS verifies this fix.
2009-01-08s3:smbd: move all globals and static variables in globals.[ch]Stefan Metzmacher1-2/+1
The goal is to move all this variables into a big context structure. metze
2008-12-31Fix a "nested extern" warningVolker Lendecke1-1/+1
2008-12-31Rename parent_dirname_talloc() to parent_dirname()Volker Lendecke1-4/+2
2008-12-31Fix an ancient uninitialized variable readVolker Lendecke1-1/+1
The callers of open_file_ntcreate expect *psbuf to be filled correctly
2008-12-17Fix bug #5979 - Level 2 oplocks being granted improperly,Jeremy Allison1-65/+96
Jeremy.
2008-12-13Fix a valgrind error in get_relative_fid_filenameVolker Lendecke1-1/+1
It doesn't really make sense to check the length of a not-yet-allocated string :-) Volker
2008-12-12Fix error code when smbclient puts a file over an existing directoryVolker Lendecke1-1/+1
Windows returns NT_STATUS_FILE_IS_A_DIRECTORY, as does Samba 3.0. 3.2 and following returned NT_STATUS_INVALID_PARAMETER which is wrong. Before I converted reply_open_and_X to create_file() we called open_file_ntcreate directly. Passing through open&X for a filename that exists as a directory ends up in open_directory after having tried open_file_ntcreate. Some check in there returns NT_STATUS_INVALID_PARAMETER. With this additional FILE_NON_DIRECTORY_FILE flag we get the correct error message back from create_file_unixpath before trying open_directory(). Survives make test, but as this also touches the other open variants I would like others to review this. Volker
2008-12-09s3: [3/3]: Fix a delete on close divergence from windows and the associated ↵Tim Prouty1-3/+2
torture test This third patch cleans up by removing all of the code that is made obsolete by the first patch. It should cause no functional changes.
2008-12-09s3: [1/3] Fix a delete on close divergence from windows and the associated ↵Tim Prouty1-4/+2
torture test smbtorture4's BASE-DELETE:deltest17 was failing against win2k8, win2k3, and winXPsp2 but passing against samba. deltest17 does the following: 1. open file -> file is created 2. closes file 3. open file with DOC -> fnum1 4. check that DOC is not reported as being set from fnum1 5. opens file again Read Only -> fnum2 6. check that DOC is not reported as being set from either file handle 7. close fnum1 (the file handle that requested DOC to be set) 8. check if DOC is reported as being set from fnum2 * This is where windows and samba begin to diverge. Windows reports that the DOC bit is set, while samba reports that it is not set. 9. close fnum2 (the last remaining open handle for the file) 10.See if the file has been deleted. * On samba the file still exists. On windows the file was deleted. The way open_file_ntcreate is written now, if an open has the DOC bit set on the wire, DOC (fsp->initial_delete_on_close) is not set unless: a. the open creates the file, or b. there is an open file handle with a share_entry in the struct lck that has the SHARE_MODE_ALLOW_INITIAL_DELETE_ON_CLOSE bit set (let's call it SM_AIDOC). My understanding of SM_AIDOC is that it was added to differentiate between DOC being set on an open that creates a file vs an open that opens an existing. As described in step 8/10 above, it appears that windows does not make this differentiation. To resolve this issue there are three patches. This first patch is a simple proof of concept change that is sufficient to fix the bug. It removes the differentiation in open_file_ntcreate, and updates deltest17 to allow it to pass against win2k3/xp. This makes open_file_ntcreate more closely match the semantics in open_directory and rename_internals_fsp. This change also does not break any other tests in BASE-DELETE or "make test". Specifically test deltest20b which verifies the CIFSFS rename DOC semantics still passes :).
2008-12-09s3: Refactor calculating path from relative_fid into a separate functionTim Prouty1-78/+96
2008-12-09s3: Refactor getting sec_info from a security_descriptor into separate functionTim Prouty1-13/+2
2008-12-09s3: Make a few open utility functions non-staticTim Prouty1-16/+16
This allows vfs modules that implement SMB_VFS_CREATE_FILE to access some of the useful utility functions.
2008-12-03s3: Fix FILE_FLAG_POSIX_SEMANTICS handling underneath SMB_VFS_CREATE_FILETim Prouty1-2/+2
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: Simplify the create_file_unix_path->open_file_ntcreate pathTim Prouty1-93/+38
Also removed open_file_ntcreate/open_file from proto.h so they can no longer be called directly.
2008-12-03s3: Modify direct caller of open_file to call SMB_VFS_CREATE_FILETim Prouty1-4/+19
2008-12-03s3: Modify direct callers of open_file_ntcreate and open_directory to call ↵Tim Prouty1-8/+18
SMB_VFS_CREATE_FILE
2008-12-03s3: Modify direct callers of create_file_unix_path to call SMB_VFS_CREATE_FILETim Prouty1-16/+42
2008-12-03s3: Add new "is_dos_path" argument to SMB_VFS_CREATE_FILETim Prouty1-3/+4
Now unix paths can be differentiated from windows paths so the underlying create_file implementations can convert paths correctly.