1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00
Commit Graph

377 Commits

Author SHA1 Message Date
Jeremy Allison
553818add8 Fix bug #6082 - smbd_gpfs_getacl failed: Windows client can´t rename or delete file
This fixes the generic rename/delete problem for 3.3.0 and above.
Fixed slightly differently to discussions, user viewable modified
ACLs are not a good idea :-).
Jeremy.
2009-02-02 17:10:27 -08:00
Tim Prouty
f2269e6cc8 s3: Fix open path to delete streams depending on the create disposition
The new create disposition test in smbtorture RAW-STREAMS verifies
this fix.
2009-01-09 11:45:31 -08:00
Stefan Metzmacher
3dde0cbb76 s3:smbd: move all globals and static variables in globals.[ch]
The goal is to move all this variables into a big context structure.

metze
2009-01-08 12:22:21 +01:00
Volker Lendecke
9e1cabdd43 Fix a "nested extern" warning 2008-12-31 19:33:25 +01:00
Volker Lendecke
972295f80a Rename parent_dirname_talloc() to parent_dirname() 2008-12-31 19:33:25 +01:00
Volker Lendecke
ce2ff557bd Fix an ancient uninitialized variable read
The callers of open_file_ntcreate expect *psbuf to be filled correctly
2008-12-31 10:51:44 +01:00
Jeremy Allison
1a5fc6d4bc Fix bug #5979 - Level 2 oplocks being granted improperly,
Jeremy.
2008-12-17 17:23:13 -08:00
Volker Lendecke
627c844a13 Fix a valgrind error in get_relative_fid_filename
It doesn't really make sense to check the length of a not-yet-allocated string
:-)

Volker
2008-12-13 10:31:11 +01:00
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