summaryrefslogtreecommitdiff
path: root/source3/smbd/vfs.c
AgeCommit message (Collapse)AuthorFilesLines
2011-02-09Add fdopendir to the VFS. We will use this to reuse a directory fd already ↵Jeremy Allison1-0/+9
open by NtCreateX. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Wed Feb 9 00:55:22 CET 2011 on sn-devel-104
2011-02-08If possible (O_DIRECTORY exists) open an fd for a directory open.Jeremy Allison1-2/+2
Start of the move towards handle-based code for directory access. Currently makes fstat/fchown code work for directories rather than falling back to pathnames. Jeremy. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Tue Feb 8 06:34:41 CET 2011 on sn-devel-104
2011-02-05Fix try_chown code. Use new vfs_chown_fsp() which always trys fd first.Jeremy Allison1-0/+30
Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Sat Feb 5 03:33:59 CET 2011 on sn-devel-104
2010-12-21Added call out to a Linux-compatible fallocate() when we need to extend a fileJeremy Allison1-1/+12
allocation extent without changing end-of-file size. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Tue Dec 21 02:41:24 CET 2010 on sn-devel-104
2010-12-19s3: re-add some debugs to check_reduced_nameVolker Lendecke1-0/+2
2010-12-19s3: Fix some typosVolker Lendecke1-1/+1
2010-12-18Rename vfs operation posix_fallocate to just fallocate and add the ↵Jeremy Allison1-9/+12
vfs_fallocate_mode parameter. It turns out we need the fallocate operations to be able to both allocate and extend filesize, and to allocate and not extend filesize, and posix_fallocate can only do the former. So by defining the vfs op as posix_fallocate we lose the opportunity to use any underlying syscalls (like Linux fallocate) that can do the latter as well. We don't currently use the non-extending filesize call, but now I've changed the vfs op definition we can in the future. For the moment simply map the fallocate op onto posix_fallocate for the VFS_FALLOCATE_EXTEND_SIZE case and return ENOSYS for the VFS_FALLOCATE_KEEP_SIZE case. Jeremy. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Sat Dec 18 08:59:27 CET 2010 on sn-devel-104
2010-12-14Ensure we use vfs_fsp_stat(), not VFS_STAT directly, and store into ↵Jeremy Allison1-19/+20
fsp->fsp_name->st instead of a SMB_STRUCT_STAT on the stack. Jeremy. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Tue Dec 14 05:05:50 CET 2010 on sn-devel-104
2010-12-03Merge the two conflicting allocation codes into one function, ↵Jeremy Allison1-34/+45
vfs_slow_fallocate() and use that from both the truncate and fill_sparse functions. Jeremy.
2010-12-02Move posix_fallocate into the VFS where it belongs.Jeremy Allison1-2/+11
Jeremy.
2010-12-02Fix bug #7835 - vfs_fill_sparse() doesn't use posix_fallocate when strict ↵Jeremy Allison1-2/+30
allocate is on Tries posix_fallocate() and then falls back to old code. Jeremy.
2010-11-20Move the uglyness of #ifdef REALPATH_TAKES_NULL into the vfs_defaultJeremy Allison1-42/+10
module, change the signature of VFS_REALPATH to always return a malloc'ed string. Needed to make some privileges work I plan on doing shortly easier to code. Jeremy. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Sat Nov 20 02:15:50 CET 2010 on sn-devel-104
2010-09-13Fix bug 7409 - Thousands of reduce_name: couldn't get realpath.Jeremy Allison1-1/+1
Don't log this at level 1 - every EACCES will generate one. Thanks to muehlfeld@medizinische-genetik.de for pointing this out. Jeremy.
2010-08-26s3-build: only include memcache.h where needed.Günther Deschner1-0/+1
Guenther
2010-08-16s3: Remove smbd_server_fd from vfs_pwrite_dataVolker Lendecke1-1/+1
2010-08-16s3: Remove smbd_server_fd from vfs_write_dataVolker Lendecke1-1/+1
2010-07-13Revert "Remove the global char *LastDir."Jeremy Allison1-1/+20
Volker pointed out I'd missed the "last directory" cache part of this code. Return us to caching the directory we're in (reduces sys call load). Mea maxima culpa. Jeremy. This reverts commit 2f30aea3324f32f9b8555e961256fc1280da2871.
2010-03-28s3: Fix typos in a debug message in vfs_init_customVolker Lendecke1-1/+2
2010-03-05Fix for bug #7189 - Open txt files with notepad on samba shares creates problem.Jeremy Allison1-1/+3
Ensure we don't use any of the create_options for Samba private use. Add a new parameter to the VFS_CREATE call (private_flags) which is only used internally. Renumber NTCREATEX_OPTIONS_PRIVATE_DENY_DOS and NTCREATEX_OPTIONS_PRIVATE_DENY_FCB to match the S4 code). Rev. the VFS interface to version 28. Jeremy.
2010-02-11Remove lp_safe_widelinks() -> convert to just lp_widelinks. Suggestion from ↵Jeremy Allison1-1/+1
Volker. Create widelinks_warning(int snum) to cover the message needed in make_connection. Jeremy.
2010-02-11Introduce lp_safe_widelinks()Simo Sorce1-1/+1
This way we avoid any chance that a configuration reload may turn back on wide links when unix extensions are enabled.
2010-02-05Fix bug 7104 - "wide links" and "unix extensions" are incompatible.Jeremy Allison1-1/+1
Change parameter "wide links" to default to "no". Ensure "wide links = no" if "unix extensions = yes" on a share. Fix man pages to refect this. Remove "within share" checks for a UNIX symlink set - even if widelinks = no. The server will not follow that link anyway. Correct DEBUG message in check_reduced_name() to add missing "\n" so it's really clear when a path is being denied as it's outside the enclosing share path. Jeremy.
2010-01-12Remove the global char *LastDir.Jeremy Allison1-20/+1
This is no longer used for anything.
2009-11-24Allow us to pass RAW-CHKPATH with FILE_FLAG_POSIX_SEMANTICS set or withJeremy Allison1-3/+11
wide links = no. Jeremy.
2009-11-18s3: Do not talloc in readdirVolker Lendecke1-18/+24
This is a hot codepath (called from the stat cache)
2009-11-12s3: Fix debug messages in check_reduced_nameVolker Lendecke1-13/+24
2009-10-06s3: Add access_mask to the flock VFS callAbhidnya P Chirmule1-2/+4
2009-10-02Remove lots of duplicate code and move it into oneJeremy Allison1-0/+25
function vfs_stat_fsp(). Stops code looking at fsp->posix_open except for exceptional circumstances. Jeremy.
2009-10-02Fix more use of VFS_STAT when posix pathnames selected.Jeremy Allison1-1/+6
Jeremy.
2009-09-24vfs catia: Fix the double translation that was happening with createfile and ↵Aravind Srinivasan1-3/+5
open. Since the catia translation is implemented for open, it should not also be done in createfile. By removing createfile from catia, translation is now done correctly for the primary open path. In order to support systems that have custom createfile implementations that don't eventually call SMB_VFS_OPEN, SMB_VFS_TRANSLATE_NAME has been expanded to take an additional argument that specifies direction. Signed-off-by: Tim Prouty <tprouty@samba.org>
2009-08-28s3: Add a new VFS op called SMB_VFS_TRANSLATE_NAMEAravind Srinivasan1-2/+19
This vop is designed to work in tandem with SMB_VFS_READDIR to allow vfs modules to make modifications to arbitrary filenames before they're consumed by callers. Subsequently the core directory enumeration code in smbd is now changed to free the memory that may be allocated in a module. This vop enables the new version of catia in the following patch. Signed-off-by: Tim Prouty <tprouty@samba.org>
2009-08-24Second attempt at fix for bug 6529 - Offline files conflict with Vista and ↵Jeremy Allison1-2/+3
Office 2003. Confirmation from reporter that this fixes the issue in master on ext3/ext4. Back-ports to follow. Jeremy.
2009-07-25First patch for "new VFS" portabilityVolker Lendecke1-5/+5
2009-07-24add my copyright after the VFS rewriteVolker Lendecke1-0/+1
2009-07-24Make the smbd VFS typesafeVolker Lendecke1-32/+838
2009-07-24Fix some nonempty blank linesVolker Lendecke1-4/+4
2009-07-22s3: Convert some callers of vfs_lstat_smb_fname to SMB_VFS_LSTAT()Tim Prouty1-3/+16
2009-07-20s3: Separate out a new file: filename_utils.cTim Prouty1-0/+55
This is to ease the linking pain of everything that links LOCKING_OBJ
2009-07-20s3: Change fsp->fsp_name to be an smb_filename struct!Tim Prouty1-13/+23
2009-06-24s3: Plumb smb_filename through SMB_VFS_STAT and SMB_VFS_LSTATTim Prouty1-72/+38
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-10s3: Prepare the first set of SMB_VFS_CREATE_FILE callers to take an ↵Tim Prouty1-8/+18
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-02Add SMB_VFS_CONNECTPATH operationVolker Lendecke1-8/+22
This is required for the shadow_copy2 module and "wide links = no". The file system snapshots by nature are typically outside of share directory. So the REALPATH result fails the wide links = no test.
2009-06-02Remove a variable used just onceVolker Lendecke1-2/+3
2009-05-26Introduce "struct stat_ex" as a replacement for SMB_STRUCT_STATVolker Lendecke1-14/+14
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-04-29s3:vfs: untangle logic for loading and probing modules in vfs_init_custom()Michael Adam1-11/+23
This is to be able to provide more specific error messages. Michael
2009-02-19s3: Change the vfs_GetWd cache to use the file_id structTim Prouty1-12/+3
2009-02-09Add an optional SMB_STRUCT_SMB parameter to VFS_OP_READDIRSteven Danneman1-2/+2
* this allows VFS implementations that prefetch stat information on readdir to return it through one VFS call * backwards compatibility is maintained by passing in NULL * if the system readdir doesn't return stat info, the stat struct is set to invalid
2009-02-09s3 oplocks: Make the level2 oplock contention API more granularTim Prouty1-8/+25
This replaces release_level2_oplocks_on_change with contend_level2_oplock_begin/end in order to contend level2 oplocks throughout an operation rather than just at the begining. This is necessary for some kernel oplock implementations, and also lays the groundwork for better correctness in Samba's standard level2 oplock handling. The next step for non-kernel oplocks is to add additional state to the share mode lock struct that prevents any new opens from granting oplocks while a contending operation is in progress. All operations that contend level 2 oplocks are now correctly spanned except for aio and synchronous writes. The two write paths both have non-trivial error paths that need extra care to get right. RAW-OPLOCK and the rest of 'make test' are still passing with this change.
2009-02-09s3 vfs: Add a destructor to the fsp extension data APITim Prouty1-1/+7
I'm not certain if the dummy pointer is needed in struct vfs_fsp_data, but I added it to be consistent with the comment below.
2009-01-08s3:smbd: move all globals and static variables in globals.[ch]Stefan Metzmacher1-4/+1
The goal is to move all this variables into a big context structure. metze