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

218 Commits

Author SHA1 Message Date
Stefan Metzmacher
759416582c s3:smbd: only pass UCF_PREP_CREATEFILE to filename_convert() if we may create a new file
This fixes a regression introduced by commit
f98d10af2a
(smbd: Always use UCF_PREP_CREATEFILE for filename_convert calls to resolve a path for open)

The main problem was that Windows client seem to verify
the access to user.V2\ntuser.ini is rejected with NT_STATUS_ACCESS_DENIED,
using the machine credentials.

Passing UCF_PREP_CREATEFILE to filename_convert() triggers a code path
that implements a dropbox behaviour. A dropbox is a directory with only -wx permissions,
so get_real_filename fails with EACCESS, it needs to list the directory.
EACCESS is ignored with UCF_PREP_CREATEFILE.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=10297

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Oct 25 05:33:36 CEST 2016 on sn-devel-144
2016-10-25 05:33:36 +02:00
Christian Ambach
a9ccd50b63 s3:smbd/filename remove smelly code
not sure how this chunk ended up there, but I agree with
the statement in the comment that behavior should not depend
on developer mode

make test does not seem to depend on it anymore.

This piece had some bad influence on the tests I wrote
for case insensitivite behavior of SMB2/3, so let us
remove this technical debt.

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-05-04 01:28:23 +02:00
Jeremy Allison
b96ae7c69e s3: smbd: DFS: Pass uint32_t ucf_flags through into resolve_dfspath_wcard().
Eventually move this down to the call to unix_convert()
inside the DFS code.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
2016-03-25 20:40:10 +01:00
Jeremy Allison
dc5dad4813 s3: Filenames: Add uint32_t flags parameter to synthetic_smb_fname().
Get it from parent/deriving smb_filename if present.
Use 0 (as usually this a Windows-style lookup) if
not.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2016-03-24 22:57:16 +01:00
Jeremy Allison
2e302d7007 s3: smbd: Add uint32_t flags field to struct smb_filename.
Only one defined flag for now, SMB_FILENAME_POSIX_PATH.
Define as the same as FSP_POSIX_FLAGS_PATHNAMES to keep
the value consistent.

Set this inside unix_convert() when a posix path parse
is selected.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2016-03-24 22:57:16 +01:00
Jeremy Allison
b4246f863c s3:lib: Move internal lp_posix_pathnames() call out of utility function synthetic_smb_fname_split().
Make it a passed in parameter instead.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2016-03-10 20:55:09 +01:00
Jeremy Allison
153af65e44 s3:lib: Remove the const SMB_STRUCT_STAT * parameter from synthetic_smb_fname_split().
Only one caller uses this, and this can be handled externally.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2016-03-10 20:55:09 +01:00
Jeremy Allison
f4b4872982 s3: smbd: Change open_streams_for_delete() to take a struct smb_filename *.
Prepare for changing vfs_streaminfo to do the same.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon Mar  7 21:12:56 CET 2016 on sn-devel-144
2016-03-07 21:12:56 +01:00
Jeremy Allison
3203eb66d9 s3: smbd: Change OpenDir() to take a struct smb_filename *, not a char *.
Enhances plumbing to remove lp_posix_pathnames() later.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-03-01 15:25:22 +01:00
Volker Lendecke
657610a0e4 smbd: Fix 240393 Uninitialized pointer read
If we run into the "This is a stream on the root of the share" case,
in old line 409 (new line 417) we "goto done;". If then in old line 1027
(new line 1035) "build_stream_path" fails, "start" is uninitialized.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jan  8 05:44:15 CET 2016 on sn-devel-144
2016-01-08 05:44:15 +01:00
Jeremy Allison
035bd5feb8 s3: smbd: Remove lp_posix_pathnames() from filename.c
Now correctly passed in everywhere as the UCF_POSIX_PATHNAMES flag.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <rb@sernet.de>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Dec 23 06:31:28 CET 2015 on sn-devel-144
2015-12-23 06:31:28 +01:00
Jeremy Allison
c19eaf3e25 s3: smbd: Moving lp_posix_pathnames() out of the lower-level code.
Prepare to remove lp_posix_pathnames() out of ms_has_wild().
Check before calls to ms_has_wild().

Fixup unix_convert().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2015-12-13 22:59:27 +01:00
Jeremy Allison
cc13120a4c s3: smbd: Moving lp_posix_pathnames() out of the lower-level code.
Prepare to remove lp_posix_pathnames() out of ms_has_wild().
Check before calls to ms_has_wild().

Fixup check_parent_exists().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2015-12-13 22:59:26 +01:00
Jeremy Allison
a1deced2a4 s3: smbd: Moving lp_posix_pathnames() out of the lower-level code.
Prepare to remove lp_posix_pathnames() out of ms_has_wild().
Check before calls to ms_has_wild().

Fix determine_path_error().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2015-12-13 22:59:26 +01:00
Jeremy Allison
c808a63700 s3: smbd: Moving lp_posix_pathnames() out of the lower-level code.
Ensure we set posix_pathnames early.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2015-12-13 22:59:26 +01:00
Jeremy Allison
f9ceaf4439 s3: smbd: Fix NULL pointer bug introduced by previous 'raw' stream fix (bug #11522).
Ensure dirpath can never be NULL.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=11535

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Oct  1 08:58:36 CEST 2015 on sn-devel-104
2015-10-01 08:58:36 +02:00
Ralph Boehme
bec685fb13 s3: smbd: fix a crash in unix_convert()
Some error code paths may result in dirpath being NULL.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=11535

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-01 05:56:10 +02:00
Jeremy Allison
74fd4f93ef s3: smbd: Fix opening/creating :stream files on the root share directory.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11522

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2015-09-18 07:58:16 +02:00
Jeremy Allison
94e7e70778 s3: smbd: Remove unused parameter from build_stream_path().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2015-09-18 07:58:16 +02:00
Volker Lendecke
9b73a477f6 smbd: Fix a typo
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-03-23 16:04:18 +01:00
Volker Lendecke
72f3630e3f smbd: Fix a typo
http://www.oxfordlearnersdictionaries.com/definition/english/veto_2 says it's
vetoed, not vetod

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2015-02-10 17:58:07 +01:00
Volker Lendecke
71214665df smbd: Make "check_veto_path" static
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2015-02-10 17:58:07 +01:00
Garming Sam
5f4159b25b param: rename lp function and variable from "symlinks" to "follow_symlinks"
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-02-07 16:19:13 -08:00
Garming Sam
cfa64d20df param: rename lp function and variable from 'defaultcase' to 'default_case'
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-02-07 16:19:10 -08:00
Jeremy Allison
874318a978 smbd: change flag name from UCF_CREATING_FILE to UCF_PREP_CREATEFILE
In preparation to using it for all open calls.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=10297

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2013-12-09 09:48:48 -08:00
Volker Lendecke
5b49fe24c9 smbd: Fix regression for the dropbox case.
We need to allow to save a file to a directory with perm -wx.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=10297

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2013-12-09 09:48:48 -08:00
Volker Lendecke
76142780fb smbd: Simplify dropbox special case in unix_convert
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
2013-08-26 12:14:26 +02:00
Volker Lendecke
aef8aad638 smbd: Fix a profile problem
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>
2013-07-09 12:22:00 -07:00
Anand Avati
7e807934e6 check_parent_exists() can change errno. Ensure we preserve it across calls.
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
2013-04-30 11:00:11 +02:00
Volker Lendecke
1675bf379c smbd: Convert filename_convert_internal to synthetic_smb_fname
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-04-17 14:50:00 -07:00
Jeremy Allison
c13887defc Check error returns on strnorm(). 2012-08-09 12:07:32 -07:00
Stefan Metzmacher
a95b2ba043 s3:smbd/msdfs: pass allow_broken_path to resolve_dfspath_wcard()
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Thu May 24 16:14:01 CEST 2012 on sn-devel-104
2012-05-24 16:14:01 +02:00
Volker Lendecke
d1d0f1d11d s3: Fix a typo 2012-04-24 16:44:26 +02:00
Jeremy Allison
89c55485c3 Add the implementation of check_reduced_name_with_privilege(). Now to plumb into
SMB1 requests.
2012-02-29 17:04:08 -08:00
Jeremy Allison
442e79efbd Add check_reduced_name_with_privilege(), filename_convert_with_privilege() (currently unimplemented) in order to prepare for adding SeBackup/SeRestore code to the main fileserver.
Not yet plumbed into the main SMB1/SMB2 code.
2012-02-29 15:57:49 -08:00
Jeremy Allison
d1a4ee604f Second part of fix for bug #8541 - readlink() on Linux clients fails if the symlink target is outside of the share.
The statcache has to do lstat instead of stat when returning cached
posix pathnames.
2011-10-22 04:57:10 +02:00
Jeremy Allison
662e9c04fb Fix bug #8541 - readlink() on Linux clients fails if the symlink target is 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
2011-10-22 01:37:41 +02:00
Frank Lahm
c3bdcab516 First part of fix for bug #8419 - Make VFS op "streaminfo" stackable.
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Mon Oct 17 21:39:32 CEST 2011 on sn-devel-104
2011-10-17 21:39:32 +02:00
Frank Lahm
7a0b5d6fc5 Add support for VFS op streaminfo chaining in all relevant VFS modules.
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Fri Oct 14 03:26:06 CEST 2011 on sn-devel-104
2011-10-14 03:26:06 +02:00
Jeremy Allison
d82256ca11 Use existing ISDOT and ISDOTDOT macros.
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Thu Jul 28 02:09:20 CEST 2011 on sn-devel-104
2011-07-28 02:09:20 +02:00
Jeremy Allison
7d6ebe0de7 More const fixes. Remove CONST_DISCARD. 2011-05-06 01:44:07 +02:00
Jeremy Allison
4f41be356a Fix many const compiler warnings. 2011-05-05 10:41:59 -07:00
Jeremy Allison
2ec48260ee Move SET_STAT_INVALID call added by Volker as fix for bug 8042 - Newly 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
2011-04-04 20:08:45 +02:00
Jeremy Allison
074239ac2e Note that check_parent_exists() doesn't change the contents of smb_fname (add const). 2011-04-04 10:15:16 -07:00
Volker Lendecke
2b94169cda s3: Fix bug 8042: File creation on OS/X
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
2011-04-03 14:54:27 +02:00
Günther Deschner
8c24ebf371 s3: include smbd/smbd.h where needed.
Guenther
2011-03-30 01:13:08 +02:00
Günther Deschner
0e771263ee s3-includes: only include system/filesys.h when needed.
Guenther
2011-03-30 01:13:07 +02:00
Jeremy Allison
0122a4f417 Put OpenDir() back the way it was - don't overload with an fsp arg. Create 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
2011-02-10 02:43:31 +01:00
Jeremy Allison
1607ebfe86 Allow SMB2_FIND to actually use the open fd handle if we support fdopendir. Fallback to pathname opendir if not. 2011-02-09 15:13:40 -08:00
Jeremy Allison
44732734cc Fix bug #7863 - Unlink may unlink wrong file when hardlinks are involved.
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.
2011-01-25 14:23:19 -08:00