1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-28 07:21:54 +03:00
Commit Graph

126 Commits

Author SHA1 Message Date
Steven Danneman
25d345eb39 Pass stat buffer down through all levels of VFS_READDIR wrappers
* 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-09 23:56:16 -08:00
Jeremy Allison
e7c09d8b10 Fix bug #Bug 6090 renaming or deleting a "not matching/resolving" symlink is 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-04 16:33:52 -08:00
Volker Lendecke
21b9dec990 Pass the get_real_filename operation through the VFS
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-10 18:05:26 +01:00
Volker Lendecke
31543640e6 Change get_real_filename() to unix syscall conventions, make it non-static
It sets errno, so it might as well return 0/-1.
2008-12-10 17:45:43 +01:00
Volker Lendecke
c7521b25e9 Apply some const 2008-12-10 17:45:43 +01:00
Volker Lendecke
6bb2fff0c1 Rename "scan_directory" to "get_real_filename" 2008-12-10 17:45:43 +01:00
Jeremy Allison
93fd28a350 Re-structure Volker's patch to "Fix trans2findfirst for the large directory optimization". Makes the change clearer.
Jeremy.
2008-11-18 10:57:54 -08:00
Volker Lendecke
6ce29dc9ad Fix trans2findfirst for the large directory optimization
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-11-18 17:04:47 +01:00
Jeremy Allison
d275cc762d Fix bug #5783 FindFirst fails where search pattern == mangled filename.
That was an old and subtle bug.
Jeremy.
2008-09-23 15:05:45 -07:00
Michael Adam
ac9f55b910 Fix unix_convert() for "*" after changing map_nt_error_from_unix().
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 ec5956ab0d)
2008-08-12 21:37:30 +02:00
Stefan Metzmacher
851cadba51 locking: combine get_delete_on_close_flag() and get_write_time() into get_file_infos()
This means we need to fetch the record only once.

metze
(This used to be commit 4130b87329)
2008-04-07 12:29:29 +02:00
Jeremy Allison
0bb6fb7b6f Couple of minor fixes for POSIX pathname processing in the
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 7bb7a0def6)
2008-01-19 21:53:49 -08:00
Volker Lendecke
1069cfe4ad Add streams support
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 6022873cc1)
2008-01-19 23:25:36 +01:00
Volker Lendecke
ec412b60ea Convert OpenDir to talloc, use talloc_tos()
This cuts some mallocs on NtCreate&X
(This used to be commit 8e64107b78)
2008-01-12 21:04:06 +01:00
Jeremy Allison
f980d3ea14 If we detect a case insensitive filesystem make
sure we don't search directories on name misses
for non-mangled names.
Jeremy
(This used to be commit 120048d2f4)
2007-12-22 17:38:18 -08:00
James Peach
596018455a Use filesystem capabilities to support case-insensitive filesystems.
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 9e8b8f8c16)
2007-12-22 14:55:37 -08:00
Jeremy Allison
30191d1a57 RIP BOOL. Convert BOOL -> bool. I found a few interesting
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 f35a266b3c)
2007-10-18 17:40:25 -07:00
Jeremy Allison
b91b785306 r25167: Fix breakage from mangling rewrite. Use the
new name if unmangling succeeded, not if it
failed. Jerry - please re-test, this should
fix your bug.
Jeremy.
(This used to be commit c215d6e849)
2007-10-10 12:30:47 -05:00
Jeremy Allison
eacd314057 r25138: More pstring elimination. Add a TALLOC_CTX parameter
to unix_convert().
Jeremy.
(This used to be commit 39c211a702)
2007-10-10 12:30:44 -05:00
Jeremy Allison
3a9d382164 r25111: Move to talloced pathnames on most code paths.
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 0c9a8c4dff)
2007-10-10 12:30:41 -05:00
Jeremy Allison
132ee3990a r25009: Large patch discussed with Volker. Move unix_convert to a talloc-based
interface. More development will come on top of this. Remove the
"mangled map" parameter.
Jeremy.
(This used to be commit dee8beba7a)
2007-10-10 12:30:32 -05:00
Jeremy Allison
3b0422ee01 r24811: Simple reformatting to fit the 80 columns rule.
Jeremy.
(This used to be commit 0cdf046dae)
2007-10-10 12:30:24 -05:00
Volker Lendecke
a9184f49d3 r24595: Fix Coverity ID 393
In this error case we would have used "start" not having it initialized
(This used to be commit 751834fff9)
2007-10-10 12:30:08 -05:00
Volker Lendecke
f5ab9ddd76 r24549: Fix unix_convert to return the already converted part
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 d4f442ed9b)
2007-10-10 12:29:56 -05:00
Volker Lendecke
bcc7bdcfe3 r24497: Revert r24485 -- this needs more thought
(This used to be commit 01f701ba1e)
2007-10-10 12:29:52 -05:00
Volker Lendecke
93fc3a0248 r24485: Even in the failure case unix_convert must pass the already converted
part of the string to the caller.
(This used to be commit 301ae3d68b)
2007-10-10 12:29:51 -05:00
Stefan Metzmacher
4b15f31f10 r24120: add a file_id_create() hook into the VFS layer
it's needed for some cluster filesystems to
overload this function.

metze
(This used to be commit cdaa24e804)
2007-10-10 12:29:08 -05:00
Volker Lendecke
d537225c4c r23879: Fix two memleaks, found by the IBM checker
(This used to be commit 4d1b33f513)
2007-10-10 12:28:37 -05:00
Volker Lendecke
e84f8662e6 r23878: Fix an error return, found by the IBM checker
(This used to be commit a369c67f66)
2007-10-10 12:28:37 -05:00
Jeremy Allison
b114d3dc70 r23846: Belt-and-braces on the msdfs bug. Ensure ELOOP maps
correctly.
Jeremy.
(This used to be commit f2cf4b6b9d)
2007-10-10 12:28:34 -05:00
Jeremy Allison
f01698027d r23844: Add patch series from Volker (after review and consultation).
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 ea6ef36889)
2007-10-10 12:28:34 -05:00
Andrew Tridgell
5e54558c6d r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text
(This used to be commit b0132e94fc)
2007-10-10 12:28:22 -05:00
Jeremy Allison
d824b98f80 r23779: Change from v2 or later to v3 or later.
Jeremy.
(This used to be commit 407e6e695b)
2007-10-10 12:28:20 -05:00
Volker Lendecke
ead70dc92e r23761: Rename reduce_name to check_reduced_name
The function name reduce_name is misleading, making the user believe it
changes an argument.
(This used to be commit 68234f0bc6)
2007-10-10 12:23:53 -05:00
Volker Lendecke
e8156439f2 r23183: Check in a change made by Tridge:
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 9b10dbbd5d)
2007-10-10 12:22:52 -05:00
Jeremy Allison
aacd16e7c4 r20916: Add in the delete on close final fix - but only enabled
with -DDEVELOPER.
Jeremy.
(This used to be commit 7f817067a7)
2007-10-10 12:17:19 -05:00
Jeremy Allison
83eb0d1d6d r20844: Somewhat radical change - this may break the build (I will
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 6133a694aa)
2007-10-10 12:17:12 -05:00
Jeremy Allison
50b3dacb52 r20722: RAW-CHKPATH should now pass, build farm should
go back to normal. Sorry about that.
Jeremy.
(This used to be commit d4127034fb)
2007-10-10 12:17:06 -05:00
Jeremy Allison
dd5e9e2ae7 r20721: Fix the search unix_convert error returns. Only open
to go...
Jeremy.
(This used to be commit 89f03a8db4)
2007-10-10 12:17:06 -05:00
Jeremy Allison
1a40a6e08a r20720: Fix the chkpath problem, still looking at findfirst.
Jeremy.
(This used to be commit c5be0082ef)
2007-10-10 12:17:05 -05:00
Jeremy Allison
db0ad252a0 r20718: Sync up the filename path parsing changes from SAMBA_3_0_24.
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 f4474edf6a)
2007-10-10 12:17:04 -05:00
Jeremy Allison
fbdcf2663b r16945: Sync trunk -> 3.0 for 3.0.24 code. Still need
to do the upper layer directories but this is what
everyone is waiting for....

Jeremy.
(This used to be commit 9dafb7f48c)
2007-10-10 11:19:14 -05:00
Jeremy Allison
defe1f3aa8 r11945: Make us follow the newly documented pathname processing rules:
"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 abc21cc732)
2007-10-10 11:05:38 -05:00
Jeremy Allison
056f06915e r11861: Fix inspired by Thomas Neumann <t.neumann@iku-ag.de> to ensure that
default case applies only to new files and correctly examines 8.3
and long names.
Jeremy.
(This used to be commit ba931a0151)
2007-10-10 11:05:31 -05:00
Jeremy Allison
f9b7505429 r11346: Fix for bug found by Dina Fine. If in case sensitive mode then
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 238b35d2e6)
2007-10-10 11:05:13 -05:00
Jeremy Allison
ff7e5c2673 r7893: Add in the extra parameters to opendir() to fix the large directory/insane app
problem. Rev vfs version. Doesn't change the normal codepath.
Jeremy.
(This used to be commit 0f03a6bdcd)
2007-10-10 10:58:02 -05:00
Jeremy Allison
0deab47cc6 r7210: Fix my own mistakes up, sorry.
Jeremy.
(This used to be commit 53c3a954ee)
2007-10-10 10:57:05 -05:00
Jeremy Allison
ed5e7ff9f1 r7200: Don't use memset, use SET_STAT_INVALID (has the same effect).
Jeremy.
(This used to be commit 0b6f87d5e1)
2007-10-10 10:57:05 -05:00
Jeremy Allison
5622d96cd6 r6631: More typo's. Sorry.
Jeremy.
(This used to be commit 2673ccd19f)
2007-10-10 10:56:48 -05:00
Jeremy Allison
02e3717ee9 r6625: Remove another global variable left over from a long time ago (magic char).
Jeremy.
(This used to be commit b1bfa9cb37)
2007-10-10 10:56:47 -05:00