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

369 Commits

Author SHA1 Message Date
Volker Lendecke
9391dad85d Fix error code when smbclient puts a file over an existing directory
Windows returns NT_STATUS_FILE_IS_A_DIRECTORY, as does Samba 3.0. 3.2 and
following returned NT_STATUS_INVALID_PARAMETER which is wrong.

Before I converted reply_open_and_X to create_file() we called
open_file_ntcreate directly. Passing through open&X for a filename that exists
as a directory ends up in open_directory after having tried open_file_ntcreate.
Some check in there returns NT_STATUS_INVALID_PARAMETER. With this additional
FILE_NON_DIRECTORY_FILE flag we get the correct error message back from
create_file_unixpath before trying open_directory().

Survives make test, but as this also touches the other open variants I would
like others to review this.

Volker
2008-12-12 17:56:41 +01:00
Tim Prouty
7b9f6dda13 s3: [3/3]: Fix a delete on close divergence from windows and the associated torture test
This third patch cleans up by removing all of the code that is made
obsolete by the first patch.  It should cause no functional changes.
2008-12-09 18:06:49 -08:00
Tim Prouty
a5651848b2 s3: [1/3] Fix a delete on close divergence from windows and the associated torture test
smbtorture4's BASE-DELETE:deltest17 was failing against win2k8,
win2k3, and winXPsp2 but passing against samba.

deltest17 does the following:

1. open file -> file is created
2. closes file
3. open file with DOC -> fnum1
4. check that DOC is not reported as being set from fnum1
5. opens file again Read Only -> fnum2
6. check that DOC is not reported as being set from either file handle
7. close fnum1 (the file handle that requested DOC to be set)
8. check if DOC is reported as being set from fnum2
 * This is where windows and samba begin to diverge.  Windows
   reports that the DOC bit is set, while samba reports that it is not set.
9. close fnum2 (the last remaining open handle for the file)
10.See if the file has been deleted.
 * On samba the file still exists.  On windows the file was deleted.

The way open_file_ntcreate is written now, if an open has the DOC bit
set on the wire, DOC (fsp->initial_delete_on_close) is not set unless:
a. the open creates the file, or b. there is an open file handle with
a share_entry in the struct lck that has the
SHARE_MODE_ALLOW_INITIAL_DELETE_ON_CLOSE bit set (let's call it
SM_AIDOC).

My understanding of SM_AIDOC is that it was added to differentiate
between DOC being set on an open that creates a file vs an open that
opens an existing.  As described in step 8/10 above, it appears that
windows does not make this differentiation.

To resolve this issue there are three patches.  This first patch is a
simple proof of concept change that is sufficient to fix the bug.  It
removes the differentiation in open_file_ntcreate, and updates
deltest17 to allow it to pass against win2k3/xp.  This makes
open_file_ntcreate more closely match the semantics in open_directory
and rename_internals_fsp.  This change also does not break any other
tests in BASE-DELETE or "make test".  Specifically test deltest20b
which verifies the CIFSFS rename DOC semantics still passes :).
2008-12-09 18:02:31 -08:00
Tim Prouty
2053f77b3c s3: Refactor calculating path from relative_fid into a separate function 2008-12-09 14:51:48 -08:00
Tim Prouty
6153f622af s3: Refactor getting sec_info from a security_descriptor into separate function 2008-12-09 14:51:48 -08:00
Tim Prouty
d5d9d3dc0e s3: Make a few open utility functions non-static
This allows vfs modules that implement SMB_VFS_CREATE_FILE to access
some of the useful utility functions.
2008-12-09 14:51:47 -08:00
Tim Prouty
dbfcd3f97c s3: Fix FILE_FLAG_POSIX_SEMANTICS handling underneath SMB_VFS_CREATE_FILE 2008-12-03 17:51:55 -08:00
Tim Prouty
5844012285 s3: Change SMB_VFS_CREATE_FILE to take a create_file_flags argument
This replaces the is_dos_path bool with a more future-proof argument.
The next step is to plumb INTERNAL_OPEN_ONLY through this flag instead
of overridding the oplock_request.
2008-12-03 17:51:44 -08:00
Tim Prouty
f79aae70dd s3: Simplify the create_file_unix_path->open_file_ntcreate path
Also removed open_file_ntcreate/open_file from proto.h so they can no
longer be called directly.
2008-12-03 17:51:35 -08:00
Tim Prouty
6f7f4b428a s3: Modify direct caller of open_file to call SMB_VFS_CREATE_FILE 2008-12-03 17:51:23 -08:00
Tim Prouty
08ce060475 s3: Modify direct callers of open_file_ntcreate and open_directory to call SMB_VFS_CREATE_FILE 2008-12-03 17:51:16 -08:00
Tim Prouty
2caa4fe08e s3: Modify direct callers of create_file_unix_path to call SMB_VFS_CREATE_FILE 2008-12-03 17:51:07 -08:00
Tim Prouty
f995a7af2a s3: Add new "is_dos_path" argument to SMB_VFS_CREATE_FILE
Now unix paths can be differentiated from windows paths so the
underlying create_file implementations can convert paths correctly.
2008-12-03 17:50:37 -08:00
Tim Prouty
f38d7f20a8 s3: Add SMB_VFS_CREATE_FILE to the vfs layer
Modify all callers of create_file to go through SMB_VFS_CREATE_FILE
2008-12-03 17:50:17 -08:00
Stefan Metzmacher
e605fdc81c s3:smbd: close the low level fd of the base_fsp, if the file was created
metze
2008-12-01 14:28:27 -08:00
Stefan Metzmacher
787b0536b7 s3:smbd: only try and fallback to open a directory if it's not a stream open
metze
2008-12-01 13:52:28 -08:00
Stefan Metzmacher
936037c7da s3:smbd: wildcard characters are allowed in stream names
We only check the filename of the basefile now.

metze
2008-12-01 13:27:47 -08:00
Jeremy Allison
338303eb37 Rever 83ff6979f5 - "Fix the logic bug that caused us to
run into kernel oplocks on an open for a stream inside a file with stream_xattr module. On
opening the base_fsp we must break existing oplocks." as it broke make test.
Jeremy.
2008-11-21 22:48:37 -08:00
Jeremy Allison
83ff6979f5 Fix the logic bug that caused us to run into kernel oplocks on an open for a stream inside a file with stream_xattr module. On opening the base_fsp we must break existing oplocks.
Jeremy.
2008-11-21 18:20:38 -08:00
Jeremy Allison
8d674e351a Second part of the fix for bug #5903 - vfs_streams_xattr breaks contents of the file
(also fix a bad merge of the previous patch from 3.3).
Jeremy.
2008-11-21 15:42:03 -08:00
Jeremy Allison
97fb05c2c0 First part of fix for bug #5903 - vfs_streams_xattr breaks contents of the file.
Restructures parts of open code so that fsp must be allocated before calling
open_file_ntcreate(_internal). Also fix up file ref-counting inside files.c.
Jeremy.
2008-11-21 12:14:53 -08:00
Jeremy Allison
24c598b1b9 Don't call FSET_NT_ACL on file create if there's no SD to set. Leave the default ACL in place.
Jeremy.
2008-11-06 01:40:21 -08:00
Jeremy Allison
bfc59f63f3 Pass all of RAW-ACLS except for inheritence. Working on that next.
Jeremy.
2008-11-04 01:34:08 -08:00
Jeremy Allison
6a37302b55 Pass the directory versions of the RAW-ACL (still not inheritance). Refactor some common code between open_file_ntcreate() and open_directory().
Jeremy.
2008-11-03 23:18:43 -08:00
Jeremy Allison
4f8fac1b8e Pass all the non-inherited S4 RAW-ACL tests.
Jeremy.
2008-11-03 22:42:53 -08:00
Jeremy Allison
54eaf2de74 Get closer to passing S4 RAW-ACLs.
Jeremy.
2008-10-31 18:04:53 -07:00
Jeremy Allison
8c1a90c2e3 Start moving us closer to passing S4 RAW-ACL test using the vfs_acl_xattr module. Inheritance fails at the moment though.
Jeremy.
2008-10-30 16:13:03 -07:00
Jelmer Vernooij
4746f79d50 Use {u,}int64_t instead of SMB_BIG_{U,}INT. 2008-10-14 01:59:36 +02:00
Volker Lendecke
c530009401 Pass struct smb_request to file_free
on the way to get rid of chain_fsp
2008-10-13 19:32:38 +02:00
Volker Lendecke
c3fedcddd5 Pass struct smb_request to file_new
Goal is to remove the chain_fsp global variable
2008-10-13 19:32:38 +02:00
Volker Lendecke
3bbe5e88e5 Pass struct smb_request to file_fsp
The goal is to get rid of the chain_fsp global variable
2008-10-13 19:32:37 +02:00
Jeremy Allison
543c6a02ae For the vfs_acl_xattr.c module, make sure we map GENERIC file and directory bits
to specific bits every time a security descriptor is set. The S4 torture suite proves
that generic bits are not returned when querying an ACL set using them (ie. only
the specific bits are stored on disk).
Jeremy.
2008-10-08 18:06:58 -07:00
Jeremy Allison
da8bebaa64 Fix bug #5797 - Moving readonly files fails. Reported by infomail@lordb.de.
We don't need to deny a DELETE open on a readonly file (I'm also adding a s4
torture test for this), the set_file_disposition call will return
NT_STATUS_CANNOT_DELETE if the delete-on-close bit is set
on a readonly file (and we already do this).
Jeremy.
2008-09-26 15:17:14 -07:00
Jeremy Allison
458101b577 Fix bug 5761 "open of mangled directory name results in 'is a stream name'"
reported by Regan Heath <Regan.Heath@BridgeHeadSoftware.com>.
Jeremy.
2008-09-15 14:21:28 -07:00
Stefan Metzmacher
eb8dd6a811 smbd: fix the handling of create_options to pass RAW-OPEN
Some of the bits generate INVALID_PARAMETER and some bits
are ignored when they come from a client, that's why we need
to use bits from the ignored range for our internal usage.

metze
(This used to be commit 7b4c8a4e39)
2008-08-20 15:50:26 +02:00
Jeremy Allison
f9223a7139 If we're not allowing streams on this conn ptr,
then don't allow create_file() to call down to
create_file_unixpath() with a stream name.
Jeremy.
(This used to be commit 167d611b52)
2008-07-24 18:12:12 -07:00
Volker Lendecke
c885ae01eb Remove current_user reference from printfsp.c
(This used to be commit 510f45d01a)
2008-06-26 13:13:23 +02:00
Volker Lendecke
40f5eab5eb Wrap the unix token info in a unix_user_token in auth_serversupplied_info
No functional change, this is a preparation for more current_user ref removal
(This used to be commit dcaedf345e)
2008-06-19 18:51:37 +02:00
Volker Lendecke
b6c125e4e0 Remove the current_user references from open.c
current_user_info was "only" used in a debug msg, and current_user.ut.uid is
also available via conn->server_info
(This used to be commit d0386914ff)
2008-06-15 13:41:16 +02:00
Volker Lendecke
d49de28f11 Remove the current_user reference from fake_file.c
The current vuid is not only available there, it is also in the current
smb_request structure.
(This used to be commit c8fd5eef32)
2008-06-15 13:37:53 +02:00
Volker Lendecke
5bda9a8af0 Remove "user" from connection_struct
(This used to be commit 368454a27c)
2008-05-10 11:17:01 +02:00
Jeremy Allison
b430b38220 Remove the "stat_open()" function, flag, and all associated code. It was only
being (correctly) used in the can_read/can_write checks for hide unreadable/unwritable
and this is more properly done using the functions in smbd/file_access.c.
Preparing to do NT access checks on all file access.
Jeremy.
(This used to be commit 6bfb06ad95)
2008-05-02 17:22:10 -07:00
Jeremy Allison
85dc0ad7be Rename inherit_access_acl() -> inherit_access_posix_acl() to make use clear.
Jeremy.
(This used to be commit b739c7f1cd)
2008-05-02 12:54:53 -07:00
Michael Adam
0db7aba8af Remove redundant parameter fd from SMB_VFS_CLOSE().
Now all those redundant fd's have vanished from the VFS API.

Michael
(This used to be commit 1429453551)
2008-04-21 00:22:42 +02:00
Michael Adam
3756467db6 Move the posix pending close functionality down into the VFS layer.
This hides the pending close fds from the outside. Call order
of SMB_VFS_CLOSE is reversed. Originally, it was:

fd_close -> fd_close_posix -> SMB_VFS_CLOSE -> close

And now it is:

fd_close -> SMB_VFS_CLOSE -> fd_close_posix -> close

This is in preparation of removing the fd parameter
from the SMB_VFS_CLOSE function. But it is also the right
place for the pending close calls anyways.

Michael
(This used to be commit 3cf56b124a)
2008-04-21 00:21:23 +02:00
Stefan Metzmacher
2ccf50256e locking: store the write time in the locking.tdb
This is needed to implement the strange write time update
logic later. We need to store 2 time timestamps to
distinguish between the time the file system had before
the first client opened the file and a forced timestamp update.

metze
(This used to be commit 6aaa2ce0ee)
2008-04-07 12:29:25 +02:00
Jeremy Allison
380fcfa600 Fix S3 to pass the test_raw_oplock_exclusive3 test.
Jeremy.
(This used to be commit 028302fac5)
2008-03-11 12:37:01 -07:00
Jeremy Allison
6cdd527fed Fix debug messages.
Jeremy.
(This used to be commit d265cedb55)
2008-02-22 16:12:57 -08:00
Volker Lendecke
2a78eb9c0d Fix a ton of IBM checker uninitialized variable warnings
SET_STAT_INVALID only sets nlink, not the other fields

We might consider to change SET_STAT_INVALID to always do ZERO_STRUCT
(This used to be commit 8cf8c5b203)
2008-01-22 09:23:34 +01:00
Volker Lendecke
b1017bb551 Free case_state earlier
Found by a "set but never used" warning. Thanks to talloc_tos() this was not
really a bug, but this way the code becomes much clearer.
(This used to be commit b326f11dc3)
2008-01-20 17:44:40 +01:00