summaryrefslogtreecommitdiff
path: root/source3/smbd/open.c
AgeCommit message (Collapse)AuthorFilesLines
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.
2008-12-03s3: Add SMB_VFS_CREATE_FILE to the vfs layerTim Prouty1-17/+17
Modify all callers of create_file to go through SMB_VFS_CREATE_FILE
2008-12-01s3:smbd: close the low level fd of the base_fsp, if the file was createdStefan Metzmacher1-0/+2
metze
2008-12-01s3:smbd: only try and fallback to open a directory if it's not a stream openStefan Metzmacher1-0/+7
metze
2008-12-01s3:smbd: wildcard characters are allowed in stream namesStefan Metzmacher1-1/+11
We only check the filename of the basefile now. metze
2008-11-21Rever 83ff6979f504d50caf725ee62549604630b69be7 - "Fix the logic bug that ↵Jeremy Allison1-7/+1
caused us to run into kernel oplocks on an open for a stream inside a file with stream_xattr module. On opening the base_fsp we must break existing oplocks." as it broke make test. Jeremy.
2008-11-21Fix the logic bug that caused us to run into kernel oplocks on an open for a ↵Jeremy Allison1-1/+7
stream inside a file with stream_xattr module. On opening the base_fsp we must break existing oplocks. Jeremy.
2008-11-21Second part of the fix for bug #5903 - vfs_streams_xattr breaks contents of ↵Jeremy Allison1-15/+46
the file (also fix a bad merge of the previous patch from 3.3). Jeremy.
2008-11-21First part of fix for bug #5903 - vfs_streams_xattr breaks contents of the file.Jeremy Allison1-61/+82
Restructures parts of open code so that fsp must be allocated before calling open_file_ntcreate(_internal). Also fix up file ref-counting inside files.c. Jeremy.
2008-11-06Don't call FSET_NT_ACL on file create if there's no SD to set. Leave the ↵Jeremy Allison1-1/+6
default ACL in place. Jeremy.
2008-11-04Pass all of RAW-ACLS except for inheritence. Working on that next.Jeremy Allison1-2/+79
Jeremy.