summaryrefslogtreecommitdiffstats
path: root/source3/smbd/filename.c
Commit message (Collapse)AuthorAgeFilesLines
* smbd: Simplify dropbox special case in unix_convertVolker Lendecke2013-08-261-6/+23
| | | | | | | | | | | | | | | | EACCESS needs special treatment: If we want to create a fresh file, return OBJECT_PATH_NOT_FOUND, so that the client will continue creating the file. If the client wants us to open a potentially existing file, we need to correctly return ACCESS_DENIED. This patch makes this behaviour hopefully a bit clearer than the code before did. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Mon Aug 26 12:14:26 CEST 2013 on sn-devel-104
* smbd: Fix a profile problemVolker Lendecke2013-07-091-1/+2
| | | | | | | | | | | | | | | | | | | | | When trying to read a profile, under certain circumstances Windows tries to read with its machine account first. The profile previously written was stored with an ACL that only allows access for the user and not the machine. Windows should get an NT_STATUS_ACCESS_DENIED when using the machine account, making it retry with the user account (which would then succeed). Samba under these circumstances erroneously gives NT_STATUS_OBJECT_PATH_NOT_FOUND, which makes Windows give up and not retry. The reasons is the "dropbox" patch in unix_convert, turning EACCESS on the last path component to OBJECT_PATH_NOT_FOUND. This patch makes the dropbox behaviour only kick in when we are creating a file. I think this is an abstraction violation. unix_convert() should not have to know about the create_disposition, but given that we have pathname resolution separated from the core open code right now this is the best we can do. Signed-off-by: Volker Lendecke <Volker.Lendecke@SerNet.DE> Reviewed-by: Jeremy Allison <jra@samba.org>
* check_parent_exists() can change errno. Ensure we preserve it across calls.Anand Avati2013-04-301-1/+8
| | | | | | | | Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Tue Apr 30 11:00:11 CEST 2013 on sn-devel-104
* smbd: Convert filename_convert_internal to synthetic_smb_fnameVolker Lendecke2013-04-171-4/+6
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* Check error returns on strnorm().Jeremy Allison2012-08-091-3/+12
|
* s3:smbd/msdfs: pass allow_broken_path to resolve_dfspath_wcard()Stefan Metzmacher2012-05-241-0/+2
| | | | | | | metze Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Thu May 24 16:14:01 CEST 2012 on sn-devel-104
* s3: Fix a typoVolker Lendecke2012-04-241-1/+1
|
* Add the implementation of check_reduced_name_with_privilege(). Now to plumb intoJeremy Allison2012-02-291-3/+2
| | | | SMB1 requests.
* Add check_reduced_name_with_privilege(), filename_convert_with_privilege() ↵Jeremy Allison2012-02-291-5/+77
| | | | | | (currently unimplemented) in order to prepare for adding SeBackup/SeRestore code to the main fileserver. Not yet plumbed into the main SMB1/SMB2 code.
* Second part of fix for bug #8541 - readlink() on Linux clients fails if the ↵Jeremy Allison2011-10-221-1/+1
| | | | | | | symlink target is outside of the share. The statcache has to do lstat instead of stat when returning cached posix pathnames.
* Fix bug #8541 - readlink() on Linux clients fails if the symlink target is ↵Jeremy Allison2011-10-221-7/+27
| | | | | | | | | | outside of the share. The key is to only allow the lookup to succeed if it's a UNIX level lookup or readlink, but disallow all other operations. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Sat Oct 22 01:37:41 CEST 2011 on sn-devel-104
* First part of fix for bug #8419 - Make VFS op "streaminfo" stackable.Frank Lahm2011-10-171-2/+2
| | | | | Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Mon Oct 17 21:39:32 CEST 2011 on sn-devel-104
* Add support for VFS op streaminfo chaining in all relevant VFS modules.Frank Lahm2011-10-141-1/+1
| | | | | Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Fri Oct 14 03:26:06 CEST 2011 on sn-devel-104
* Use existing ISDOT and ISDOTDOT macros.Jeremy Allison2011-07-281-2/+1
| | | | | Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Thu Jul 28 02:09:20 CEST 2011 on sn-devel-104
* More const fixes. Remove CONST_DISCARD.Jeremy Allison2011-05-061-1/+1
|
* Fix many const compiler warnings.Jeremy Allison2011-05-051-1/+1
|
* Move SET_STAT_INVALID call added by Volker as fix for bug 8042 - Newly ↵Jeremy Allison2011-04-041-3/+3
| | | | | | | | | | | create files are always failed with NT_STATUS_FILE_IS_A_DIRECTORY Ensure we do this for all cases where the stat fails. Jeremy Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Mon Apr 4 20:08:45 CEST 2011 on sn-devel-104
* Note that check_parent_exists() doesn't change the contents of smb_fname ↵Jeremy Allison2011-04-041-1/+1
| | | | (add const).
* s3: Fix bug 8042: File creation on OS/XVolker Lendecke2011-04-031-0/+3
| | | | | | | | | | | | | | | With a case insensitive file system the stat cache lookup leaked the parent directorys stat information from unix_convert into the smb_filename. This led open_file_ntcreate to believe it just created a directory. In the case where we do the search we already invalidate the stat struct. Thanks to TAKAHASHI Motonobu for insisting! :-) Volker Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Sun Apr 3 14:54:27 CEST 2011 on sn-devel-104
* s3: include smbd/smbd.h where needed.Günther Deschner2011-03-301-0/+1
| | | | Guenther
* s3-includes: only include system/filesys.h when needed.Günther Deschner2011-03-301-0/+1
| | | | Guenther
* Put OpenDir() back the way it was - don't overload with an fsp arg. Create ↵Jeremy Allison2011-02-101-1/+1
| | | | | | | OpenDir_fsp for new usage. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Thu Feb 10 02:43:31 CET 2011 on sn-devel-104
* Allow SMB2_FIND to actually use the open fd handle if we support fdopendir. ↵Jeremy Allison2011-02-091-1/+1
| | | | Fallback to pathname opendir if not.
* Fix bug #7863 - Unlink may unlink wrong file when hardlinks are involved.Jeremy Allison2011-01-251-1/+10
| | | | | | Do this by keeping a linked list of delete on close tokens, one for each filename that identifies a path to the dev/inode. Use the jenkins hash of the pathname to identify the correct token.
* Add uint32_t name_hash argument (currently unused) to get_file_infos().Jeremy Allison2011-01-251-0/+1
| | | | Will be used when we store more than one delete on close token.
* s3: Fix some typosVolker Lendecke2010-12-191-3/+3
|
* Add check missing from previous patch after talloc_strdup().Jeremy Allison2010-09-101-0/+3
| | | | Jeremy.
* Factor out the recent changes into a function - check_parent_exists().Jeremy Allison2010-09-101-77/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | Fix this to ensure that if "start" is manipulated, then "dirpath" is changed also. Ensures that when the path: /a/long/file/name/path.txt is processed, we first stat: /a/long/file/name/path.txt and if this fails, we try to stat: /a/long/file/name if this path exists (the normal case when creating a new entry in a directory) then we no longer do the individual path name walk, but only do case insensitive lookup on the last component. If the stat fails we do the full pathname walk as normal in 3.5.x and below. Metze, examine this change for your back-port. Jeremy.
* Optimization suggested by Metze. Without this patch,Jeremy Allison2010-09-081-1/+97
| | | | | | | | | | | | | | | | | | | | | | FindFirst with 'path\to\some\dir\with\files\*' triggers the following stat calls path\to\some\dir\with\files\* => ENOENT path\ path\to\ path\to\some\ path\to\some\dir\ path\to\some\dir\with\ path\to\some\dir\with\files\ path\to\some\dir\with\files\* => ENOENT With this patch we get : path\to\some\dir\with\files\* => ENOENT path\to\some\dir\with\files = OK Jeremy.
* s3-build: only include "fake_file.h" where needed.Günther Deschner2010-08-261-0/+1
| | | | Guenther
* Fix bug #7339 - MSDFS is non-functional in 3.5.xJeremy Allison2010-04-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | In the refactoring around filename_convert, the split between the functions resolve_dfspath() and resolve_dfspath_wcard() was lost, leaving us only with resolve_dfspath_wcard(). Internally resolve_dfspath_wcard() calls dfs_redirect() only with a "allow_wcards" flag of true, wheras the old resolve_dfspath() would call with a value of false. The loss of this case causes dfs_redirect to always masquerade DFS links as directories, even when they are being queried directly by a trans2 QPATHINFO call. We should only masquerade DFS links as directories when called from a SMBsearch or trans2 findfirst/findnext - which was the intent of the "allow_wcards" flag. This patch adds back an allow_wcards bool parameter to resolve_dfspath_wcard(). This bool is set from the state of the ucf_flags when filename_convert() is called. I will follow this up with a new smbclient-based torture test that will prevent us from ever regressing our DFS support again. Jeremy.
* Remove lp_safe_widelinks() -> convert to just lp_widelinks. Suggestion from ↵Jeremy Allison2010-02-111-1/+1
| | | | | | | | Volker. Create widelinks_warning(int snum) to cover the message needed in make_connection. Jeremy.
* Introduce lp_safe_widelinks()Simo Sorce2010-02-111-1/+1
| | | | | This way we avoid any chance that a configuration reload may turn back on wide links when unix extensions are enabled.
* Make us pass RAW-CHKPATH with a case sensitive share.Jeremy Allison2009-11-251-42/+105
| | | | | | | | | | | | | | | | | | | | I know Volker will look at this closely so here's the explaination :-). Originally on a case-sensitive share we simply did a stat (or lstat) call and returned success of fail based on the result. However this failed to take account of incoming paths with a wildcard (which must always fail, and with different error messages depending on whether the wildcard is the last component or in the path). Also it failed to take account of a stat fail with ENOENT due to a missing component of the path as the last component (which is ok as it could be a new file) or if the ENOENT was due to the missing component within the path (not the last component) - which must return the correct error. What this means is that with "case sensitive = yes" we do one more talloc call (to get the parent directory) and one more stat call (on the parent directory) in the case where the stat call fails. I think this is an acceptable overhead to enable case sensitive shares to return the correct error messages for applications. Volker please examine carefully :-). Jeremy.
* Remove call into reduce_name if case sensitive. This allows us to passJeremy Allison2009-11-241-2/+1
| | | | | | | | RAW-CHKPATH when case sensitive = yes, but isn't the correct way to do it. I'm testing a larger patch to smbd/filename.c that should fix this correctly, and will add a torture test to ensure RAW-CHKPATH is run against a case sensitive share once this is done. Jeremy.
* Allow us to pass RAW-CHKPATH with FILE_FLAG_POSIX_SEMANTICS set or withJeremy Allison2009-11-241-1/+2
| | | | | wide links = no. Jeremy.
* Proper fix for #6898 - Samba duplicates file content on appending. Pointed ↵Jeremy Allison2009-11-231-1/+2
| | | | out by Volker.Restores the pathname handling for FILE_FLAG_POSIX_SEMANTICS but still prevents the O_APPEND problems. Jeremy.
* Revert "s3: Make the implicit reference to Protocol in is_in_path() explicit"Volker Lendecke2009-11-231-2/+1
| | | | This reverts commit f7b4151a64d8c6851e62255a7139fd00a5fc63a3.
* Revert "s3: Move the global variable Protocol to struct smbd_server_connection"Volker Lendecke2009-11-231-1/+1
| | | | This reverts commit c85a4c9ba4a7de65a7850f6f9708df66bd24deea.
* s3: Move the global variable Protocol to struct smbd_server_connectionVolker Lendecke2009-11-211-1/+1
|
* s3: Make the implicit reference to Protocol in is_in_path() explicitVolker Lendecke2009-11-211-1/+2
|
* s3: Do not talloc in readdirVolker Lendecke2009-11-181-6/+7
| | | | This is a hot codepath (called from the stat cache)
* s3: Add more helpful debugging to some of the streams codeTim Prouty2009-09-241-1/+1
|
* s3: Add a new VFS op called SMB_VFS_TRANSLATE_NAMEAravind Srinivasan2009-08-281-1/+5
| | | | | | | | | | | 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>
* s3:smbd: teach filename_convert() about fake files (2nd fix for bug #6642)Stefan Metzmacher2009-08-271-0/+11
| | | | metze
* s3: Convert a few callers of unix_convert() over to filename_convert()Tim Prouty2009-07-241-10/+12
| | | | | | This patch also changes the unix convert flags to make sure the correct semantics are preservered for allowing/disallowing wildcards in the last component of the path.
* s3: Allow filename_convert() to pass through unix_convert_flags and let the ↵Tim Prouty2009-07-241-7/+34
| | | | | | caller know if the path has a wildcard This also eliminates the need for resolve_dfspath().
* s3: Change unix_convert to use an smb_filename struct internallyTim Prouty2009-07-221-137/+154
| | | | | | | | | | | | This allows SMB_VFS_[L]STAT to be called directly. Additionally, I changed NTSTATUS result to be named status for consistency. I also removed the stat_cache_add() from build_stream_path() because stat_cache_lookup() is never actually called on a file with a stream. There is no reason why the stat cache couldn't be consulted for streams in the future. Jeremy/Volker, please take a look at this one when you get a chance.
* s3: Remove the now unused fname parameter from filename_convert()Tim Prouty2009-07-211-12/+4
|
* s3: Separate out a new file: filename_utils.cTim Prouty2009-07-201-219/+0
| | | | This is to ease the linking pain of everything that links LOCKING_OBJ