summaryrefslogtreecommitdiff
path: root/source3/smbd/filename.c
AgeCommit message (Collapse)AuthorFilesLines
2009-05-05s3: Fix trans2 path to use case-insensitive stat optimizationtprouty1-6/+34
Often times before creating a file, a client will first query to see if it already exists. Since some systems have a case-insensitive stat that is called from unix_convert, we can definitively return STATUS_NO_SUCH_FILE to the client without scanning the whole directory. This code path is taken from trans2querypathinfo, but trans2findfirst still does a full directory scan even though the get_real_filename (the case-insensitive stat vfs call) can prevent this. This patch adds the get_real_filename call to the trans2find* path, and also changes the vfs_default behavior for SMB_VFS_GET_REAL_FILENAME. Previously, in the absence of a get_real_filename implementation, we would fallback to the full directory scan. The default behavior now returns -1 and sets errno to EOPNOTSUPP. This allows SMB_VFS_GET_REALFILENAME to be called from trans2* and unix_convert.
2009-04-23Revert "Do not use the file system GET_REAL_FILENAME for mangled names"Volker Lendecke1-23/+7
This reverts commit b5b6ecb58aeba196c28370cde21a0826f81d8da6.
2009-04-20Do not use the file system GET_REAL_FILENAME for mangled namesVolker Lendecke1-7/+23
2009-02-09Pass stat buffer down through all levels of VFS_READDIR wrappersSteven Danneman1-1/+1
* VFS_OP_READDIR can now provide stat information, take advantage of it if it's available * is_visible_file(): optimistically expect the provided stat buffer is already valid * dptr_ReadDirName(): refactor code for easier readability, functionality is the same
2009-02-04Fix bug #Bug 6090 renaming or deleting a "not matching/resolving" symlink is ↵Jeremy Allison1-4/+26
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.
2008-12-10Pass the get_real_filename operation through the VFSVolker Lendecke1-4/+1
This is done to help file systems that can tell us about the real upper/lower case combination given a case-insensitive file name. The sample I will soon push is the gpfs module (recent gpfs has a get_real_filename function), others might have a similar function to help alleviate the 1million files in a single directory problem. Jeremy, please comment! Thanks, Volker
2008-12-10Change get_real_filename() to unix syscall conventions, make it non-staticVolker Lendecke1-13/+14
It sets errno, so it might as well return 0/-1.
2008-12-10Apply some constVolker Lendecke1-2/+2
2008-12-10Rename "scan_directory" to "get_real_filename"Volker Lendecke1-12/+12
2008-11-18Re-structure Volker's patch to "Fix trans2findfirst for the large directory ↵Jeremy Allison1-26/+21
optimization". Makes the change clearer. Jeremy.
2008-11-18Fix trans2findfirst for the large directory optimizationVolker Lendecke1-0/+5
With case sensitive = yes preserve case = no short preserve case = no default case = upper a "dir FOO.txt" would not find "FOO.TXT" because FOO.txt ends up unconverted in the mask for mask_match. Jeremy, please check! Volker
2008-09-23Fix bug #5783 FindFirst fails where search pattern == mangled filename.Jeremy Allison1-2/+1
That was an old and subtle bug. Jeremy.
2008-08-12Fix unix_convert() for "*" after changing map_nt_error_from_unix().Michael Adam1-1/+1
map_nt_error_from_unix() now assumes that it is called in an error path and returns an error even for a given errno == 0. The original behaviour of unix_convert() used the mapping of errno == 0 ==> NT_STATUS_OK to return success through an error path. I think this must have been an oversight, and unix_convert() worked only by coincidence (or because explicitly using the knowledge of the conceptually wrong working of map_nt_error_from_unix(). This patch puts this straight by not interpreting errno == 0 as an error condition and proceeding in that case. Jeremy - please check! Michael (This used to be commit ec5956ab0df1b3f567470b2481b73da9c3c67371)
2008-04-07locking: combine get_delete_on_close_flag() and get_write_time() into ↵Stefan Metzmacher1-5/+13
get_file_infos() This means we need to fetch the record only once. metze (This used to be commit 4130b873291d39e363184fe4e38dc1f24ebe5056)
2008-01-19Couple of minor fixes for POSIX pathname processing in theJeremy Allison1-8/+10
new stream code. (1) In smbd/filename, don't split the name at ':' if we know it's a posix path (this should be parameterized....). (2). When calling posix_mkdir, we get the flag FILE_FLAG_POSIX_SEMANTICS passed to open_directory(). I know for a posix client lp_posix_pathnames should be true (which is checked for in is_ntfs_stream_name() but we have an explicit flag here, so let's use it. Jeremy. (This used to be commit 7bb7a0def6518784befa75e5303289d2b4d36dd4)
2008-01-19Add streams supportVolker Lendecke1-0/+121
This is the core of the streams support. The main change is that in files_struct there is now a base_fsp pointer that holds the main file open while a stream is open. This is necessary to get the rather strange delete semantics right: You can't delete the main file while a stream is open without FILE_SHARE_DELETE, and while a stream is open a successful unlink of the main file leads to DELETE_PENDING for all further access on the main file or any stream. (This used to be commit 6022873cc155bdbbd3fb620689715f07a24d6ed1)
2008-01-12Convert OpenDir to talloc, use talloc_tos()Volker Lendecke1-3/+3
This cuts some mallocs on NtCreate&X (This used to be commit 8e64107b7846d8f9cce71aabc95b28b7488d01ce)
2007-12-22If we detect a case insensitive filesystem makeJeremy Allison1-4/+11
sure we don't search directories on name misses for non-mangled names. Jeremy (This used to be commit 120048d2f40cf1a0ace2ecde205cbc694d263d69)
2007-12-22Use filesystem capabilities to support case-insensitive filesystems.James Peach1-0/+9
If we know the underlying filesystem is case-insensitive, then we know that it won't help to search for case variations of the requested name. Jeremy, please review (and revert if you disagree). (This used to be commit 9e8b8f8c16612d8a08b55802f4fd9afca5498a7c)
2007-10-18RIP BOOL. Convert BOOL -> bool. I found a few interestingJeremy Allison1-10/+10
bugs in various places whilst doing this (places that assumed BOOL == int). I also need to fix the Samba4 pidl generation (next checkin). Jeremy. (This used to be commit f35a266b3cbb3e5fa6a86be60f34fe340a3ca71f)
2007-10-10r25167: Fix breakage from mangling rewrite. Use theJeremy Allison1-1/+2
new name if unmangling succeeded, not if it failed. Jerry - please re-test, this should fix your bug. Jeremy. (This used to be commit c215d6e84929b70e4472e19f32ec4f1db7449d90)
2007-10-10r25138: More pstring elimination. Add a TALLOC_CTX parameterJeremy Allison1-2/+2
to unix_convert(). Jeremy. (This used to be commit 39c211a702e91c34c1a5a689e1b0c4530ea8a1ac)
2007-10-10r25111: Move to talloced pathnames on most code paths.Jeremy Allison1-2/+1
There are now ony 17 pstrings left in reply.c, and these will be easy to remove (and I'll be doing that shortly). Had to fix an interesting bug in pull_ucs2_base_talloc() when a source string is not null terminated :-). Jeremy. (This used to be commit 0c9a8c4dff10974dbffd2a302ae982896122fcc0)
2007-10-10r25009: Large patch discussed with Volker. Move unix_convert to a talloc-basedJeremy Allison1-77/+112
interface. More development will come on top of this. Remove the "mangled map" parameter. Jeremy. (This used to be commit dee8beba7a92b8a3f68bbcc59fd0a827f68c7736)
2007-10-10r24811: Simple reformatting to fit the 80 columns rule.Jeremy Allison1-63/+96
Jeremy. (This used to be commit 0cdf046dae8ba0741bb7786aa4e85c34fc35dade)
2007-10-10r24595: Fix Coverity ID 393Volker Lendecke1-2/+1
In this error case we would have used "start" not having it initialized (This used to be commit 751834fff92e85a424152c1642b238daa3060dbd)
2007-10-10r24549: Fix unix_convert to return the already converted partVolker Lendecke1-4/+10
This API will change anyway when moving away from pstrings. It took so long to fix, because that rename bug I just fixed gave make test failures that had nothing to do with this one. I have samba4 tests for both bugs, will check them in when the build farm has caught up (This used to be commit d4f442ed9b145990af4db26859663954ddd70926)
2007-10-10r24497: Revert r24485 -- this needs more thoughtVolker Lendecke1-1/+1
(This used to be commit 01f701ba1ea9859b090aaf8f4ae9722c5502316c)
2007-10-10r24485: Even in the failure case unix_convert must pass the already convertedVolker Lendecke1-1/+1
part of the string to the caller. (This used to be commit 301ae3d68bc64c9526eb7d4458584a5ebb151137)
2007-10-10r24120: add a file_id_create() hook into the VFS layerStefan Metzmacher1-1/+2
it's needed for some cluster filesystems to overload this function. metze (This used to be commit cdaa24e8047399002e4b287a31a8340a665e580f)
2007-10-10r23879: Fix two memleaks, found by the IBM checkerVolker Lendecke1-2/+4
(This used to be commit 4d1b33f51308c95293fa2494b47ba1255af8d216)
2007-10-10r23878: Fix an error return, found by the IBM checkerVolker Lendecke1-0/+1
(This used to be commit a369c67f6678bdcc0689929238bc96f45cdeeb25)
2007-10-10r23846: Belt-and-braces on the msdfs bug. Ensure ELOOP mapsJeremy Allison1-6/+15
correctly. Jeremy. (This used to be commit f2cf4b6b9d1ce561fdf9f6815564d5b4f033dd10)
2007-10-10r23844: Add patch series from Volker (after review and consultation).Jeremy Allison1-99/+207
0001-Save-a-strdup-in-stat_cache_add.patch 0002-Use-ISDOT-and-ISDOTDOT.patch 0003-Move-fname_equal-around.patch 0004-unix_convert-pstring-dirpath-char.patch 0005-Ignore-.o-files.patch 0006-Get-rid-of-pstrings-inside-unix_convert.patch 0007-revert-pstring-unix_convert.patch 0008-Make-name-an-allocated-pstring-inside-unix_convert.patch 0009-Pass-explicit-pstring-to-mangle_check_cache.patch 0010-Don-t-overwrite-orig_path-unnecessarily.patch 0011-Defer-allocating-name.patch 0012-Make-sure-dirpath-is-always-correctly-allocated.patch 0013-Remove-one-pstring-dependency-in-unix_convert.patch 0014-Remove-more-name-pstring-dependencies.patch 0015-Hide-the-nasty-API-of-mangle_check_cache-in-mangle_c.patch 0016-name-does-not-need-to-be-pstring-size-anymore.patch 0017-Make-use-of-ISDOT-and-ISDOTDOT.patch 0018-Remove-pstring-from-stat_cache_lookup.patch 0019-Add-my-copyright.patch To remove pstrings from statcache and unix_convert. Jeremy. (This used to be commit ea6ef368891af24164d2e76700c405a82b3dfc19)
2007-10-10r23784: use the GPLv3 boilerplate as recommended by the FSF and the license textAndrew Tridgell1-2/+1
(This used to be commit b0132e94fc5fef936aa766fb99a306b3628e9f07)
2007-10-10r23779: Change from v2 or later to v3 or later.Jeremy Allison1-1/+1
Jeremy. (This used to be commit 407e6e695b8366369b7c76af1ff76869b45347b3)
2007-10-10r23761: Rename reduce_name to check_reduced_nameVolker Lendecke1-2/+2
The function name reduce_name is misleading, making the user believe it changes an argument. (This used to be commit 68234f0bc6fb4d6d99ae94ff067db118c60804aa)
2007-10-10r23183: Check in a change made by Tridge:Volker Lendecke1-1/+1
This replaces the internal explicit dev/ino file id representation by a "struct file_id". This is necessary as cluster file systems and NFS don't necessarily assign the same device number to the shared file system. With this structure in place we can now easily add different schemes to map a file to a unique 64-bit device node. Jeremy, you might note that I did not change the external interface of smb_share_modes.c. Volker (This used to be commit 9b10dbbd5de8813fc15ebbb6be9b18010ffe8139)
2007-10-10r20916: Add in the delete on close final fix - but only enabledJeremy Allison1-0/+6
with -DDEVELOPER. Jeremy. (This used to be commit 7f817067a70930ee3502ea3373173e0c23733253)
2007-10-10r20844: Somewhat radical change - this may break the build (I willJeremy Allison1-12/+9
watch carefully - so I'm doing it in one transaction so I can roll back). Change check_name(), reduce_name() and dptr_create() to return NTSTATUS. This helps a lot in error path processing and especially in reduce_name() allows us to ditch the flaky and error-prone saving of errno and return errors directly. Jeremy. (This used to be commit 6133a694aa429d638320e39ffe1c49d172583ccf)
2007-10-10r20722: RAW-CHKPATH should now pass, build farm shouldJeremy Allison1-4/+13
go back to normal. Sorry about that. Jeremy. (This used to be commit d4127034fb89185fe7464d57c9f56f7914da6141)
2007-10-10r20721: Fix the search unix_convert error returns. Only openJeremy Allison1-25/+35
to go... Jeremy. (This used to be commit 89f03a8db40365f99c6755ff19a4bfbf8d1bd316)
2007-10-10r20720: Fix the chkpath problem, still looking at findfirst.Jeremy Allison1-1/+6
Jeremy. (This used to be commit c5be0082ef60cd041121a9c36f4af934cd60562d)
2007-10-10r20718: Sync up the filename path parsing changes from SAMBA_3_0_24.Jeremy Allison1-41/+119
The only difference between the two trees now w.r.t file serving are the changes to smbd/open.c in this branch I need to review. Jeremy. (This used to be commit f4474edf6a0c71001dbd01429ef70bafad6abd74)
2007-10-10r16945: Sync trunk -> 3.0 for 3.0.24 code. Still needJeremy Allison1-10/+12
to do the upper layer directories but this is what everyone is waiting for.... Jeremy. (This used to be commit 9dafb7f48ca3e7af956b0a7d1720c2546fc4cfb8)
2007-10-10r11945: Make us follow the newly documented pathname processing rules:Jeremy Allison1-0/+13
"As a special case for directories with large numbers of files, if the case options are set as follows, "case sensitive = yes", "case preserve = no", "short preserve case = no" then the "default case" option will be applied and will modify all filenames sent from the client when accessing this share." This is needed as fixing the case preserve rules to only apply to new filenames broke the large directory fix. Glad we caught this before release. Thanks to jht for this one. Jeremy. (This used to be commit abc21cc7322d695cf77b6fb18f4ecdb16288c19b)
2007-10-10r11861: Fix inspired by Thomas Neumann <t.neumann@iku-ag.de> to ensure thatJeremy Allison1-10/+8
default case applies only to new files and correctly examines 8.3 and long names. Jeremy. (This used to be commit ba931a015132f7e8fffa52c617cd8345a1da35d2)
2007-10-10r11346: Fix for bug found by Dina Fine. If in case sensitive mode thenJeremy Allison1-1/+10
the mangle cache is no good (3 letter extension could be wrong case - so don't demangle in this case - leave as mangled and allow the mangling of the directory entry read (which is done case insensitively) to match instead. This will lead to more false positive matches but we fail completely without it. Jeremy. (This used to be commit 238b35d2e6e21d0e07d500d446f08ec128ea7720)
2007-10-10r7893: Add in the extra parameters to opendir() to fix the large ↵Jeremy Allison1-1/+1
directory/insane app problem. Rev vfs version. Doesn't change the normal codepath. Jeremy. (This used to be commit 0f03a6bdcdbdf60da81e0aeffa84ac6e48fc6a04)
2007-10-10r7210: Fix my own mistakes up, sorry.Jeremy Allison1-1/+1
Jeremy. (This used to be commit 53c3a954ee0e1c9dc61950f1a9d0a654de9382c6)