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

665 Commits

Author SHA1 Message Date
Volker Lendecke
e00df42a37 s3: Remove a SMB_ASSERT
With the simplified logic this became unnecessary
2012-09-29 08:42:50 -07:00
Volker Lendecke
8b7e75b358 s3: Close the now opened file descriptor in error paths 2012-09-29 08:42:50 -07:00
Volker Lendecke
64c4940039 s3: No code change, just re-indent
Look at this with "git diff -b" if you don't believe me :-)
2012-09-29 08:42:50 -07:00
Volker Lendecke
173e808ed4 s3: Remove share mode handling before we open the file
This is a significant behaviour change: We do not open the file under
the share mode lock anymore. This might lead to more open calls in case
of oplock breaks or sharing violations, but those are slow error paths
and as such might be not too performance sensitive. The benefit of this
patch is a significant reduction of complexity of open_file_ntcreate()
2012-09-29 08:42:49 -07:00
Volker Lendecke
590d3138be s3: Fix fcb_or_dos_open after logic change
With the new behaviour, we call fcb_or_dos_open after open_file(). It
is open_file() that sets up the fsp so that fcb_or_dos_open can find it
in the list of fsps. Avoid finding the fsp we are just setting up.
2012-09-29 08:42:49 -07:00
Volker Lendecke
8be0f4d30f s3: Copy share mode handling from before to after open_file
This is a 1:1 copy&paste of the oplock/sharemode code that we do before
an existing file is opened. It is a prerequiste for a patch that removes
all of that handling before we open the file.
2012-09-29 08:42:49 -07:00
Volker Lendecke
4666dec416 s3: Fix rejecting mkdir on read-only shares
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-09-27 01:07:08 +02:00
Volker Lendecke
36ec31336f s3: Slightly simplify open_file()
The "else" is not necessary. In the if-branch we just returned.

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Sep 26 18:08:03 CEST 2012 on sn-devel-104
2012-09-26 18:08:03 +02:00
Volker Lendecke
1fa730deba s3: Slightly simplify calculate_open_access_flags 2012-09-26 16:29:28 +02:00
Volker Lendecke
cc58a19565 s3: Slightly simplify calculate_open_access_flags 2012-09-26 16:29:28 +02:00
Volker Lendecke
7600fd8b0c s3: Factor out calculate_open_access_flags
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Sep 26 00:22:56 CEST 2012 on sn-devel-104
2012-09-26 00:22:56 +02:00
Volker Lendecke
11af163df8 s3: Fix a typo 2012-09-25 22:41:51 +02:00
Volker Lendecke
c034ff7b15 s3: Slightly simplify is_stat_open
The "access_bits" clause is redundant. is_stat_open says that exactly
at least one of the stat_open_bits must be set and none else.

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Sep 25 20:05:06 CEST 2012 on sn-devel-104
2012-09-25 20:05:06 +02:00
Volker Lendecke
34f2d18984 s3: Make is_stat_open() a bit more readable 2012-09-25 09:23:28 -07:00
Volker Lendecke
456f821626 s3: Fix indentation of if-expressions
To me this makes open_file_ntcreate a little easier to understand

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Sep 25 10:08:15 CEST 2012 on sn-devel-104
2012-09-25 10:08:15 +02:00
Jeremy Allison
aef862c7b0 Fix bug #9189 - SMB2 Create doesn't return correct MAX ACCESS access mask in blob.
If we aren't already granted DELETE access, check if we have
DELETE_CHILD in the containing directory.
2012-09-25 03:07:50 +02:00
Stefan Metzmacher
7a493fd867 s3:smbd: release the share mode lock before calling exit_server() (bug #9191)
metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Sep 21 22:36:57 CEST 2012 on sn-devel-104
2012-09-21 22:36:57 +02:00
Jeremy Allison
8de46eac65 Add 'bool use_privs' to smbd_calculate_access_mask().
Replaces blanket root allow if set. Set to 'false' for
all current callers.

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Sep 15 00:37:49 CEST 2012 on sn-devel-104
2012-09-15 00:37:49 +02:00
Jeremy Allison
6d82976597 Fix bad string in debug message (remove it). 2012-09-14 22:54:29 +02:00
Jeremy Allison
aa0a7cf51a Add bool use_privs parameter to smbd_check_access_rights()
If this is set we should use it in preference to blindly assuming
root can do anything. Currently set to 'false' in (most) callers.
2012-09-14 22:54:29 +02:00
Volker Lendecke
ab709544f4 s3: delete requests are not special
The only difference between batch and exclusive oplocks is the time of
the check: Batch is checked before the share mode check, exclusive after.

Signed-off-by: Jeremy Allison <jra@samba.org>
2012-09-10 14:58:51 -07:00
Michael Adam
ba011c1de0 s3:smbd: make fd_open() public 2012-09-08 19:42:55 +02:00
Michael Adam
f5a6b7b301 s3:smbd: don't set kernel flock if "kernel share modes = no"
Signed-off-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Sat Sep  8 13:05:05 CEST 2012 on sn-devel-104
2012-09-08 13:05:05 +02:00
Stefan Metzmacher
eb1a05f783 s3:smbd: add disconnected checks to the open code.
(delay_for_batch_oplocks, open_mode_check, and delay_for_exclusive_oplocks)

Pair-Programmed-With: Michael Adam <obnox@samba.org>
2012-09-08 03:39:06 +02:00
Jeremy Allison
d7fb237810 Remove an unncessary FTRUNCATE call in the open path. We can rely on O_TRUC.
Suggested by Volker.
2012-09-05 20:43:31 +02:00
Volker Lendecke
084978f3d0 s3: Slightly simplify fd_open_atomic
Replace an if-statement by a direct assignment

Signed-off-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Sep  5 01:56:46 CEST 2012 on sn-devel-104
2012-09-05 01:56:46 +02:00
Volker Lendecke
d95d32606b s3: Put a comment into the right place
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-09-04 15:15:00 -07:00
Volker Lendecke
63279e374a s3: Factor out disposition_to_open_flags
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-09-04 15:15:00 -07:00
Volker Lendecke
f67a6c463c s3: Factor out calculation of clear_ads
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-09-04 15:15:00 -07:00
Volker Lendecke
0d869327ed s3: Slightly simplify open_file_ntcreate
We have not set flags2 before, so do direct assignment and not |=

Signed-off-by: Jeremy Allison <jra@samba.org>
2012-09-04 15:15:00 -07:00
Volker Lendecke
93e10db3dd s3: Make "open_match_attributes" static
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-09-04 15:15:00 -07:00
Volker Lendecke
d5f845c0d3 s3: Make an if statement a bit easier to read
Fix indentation a bit

Signed-off-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Sep  1 07:07:12 CEST 2012 on sn-devel-104
2012-09-01 07:07:12 +02:00
Jeremy Allison
46455642a7 Change the S3 fileserver over to se_file_access_check().
Don't set the priv_open_requested yet until the open-for-backup
request is correctly passed in.
2012-08-31 20:29:13 -07:00
Jeremy Allison
795920cf4a Change the other two places where we set a security descriptor given by the client to got through set_sd(),
the canonicalize sd function.
2012-08-30 10:08:50 -07:00
Volker Lendecke
d2eb26cfbd s3: Make request_timed_out() static
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-07-31 11:40:22 +02:00
Rusty Russell
fe72740e82 loadparm: make the source3/ lp_ functions take an explicit TALLOC_CTX *.
They use talloc_tos() internally: hoist that up to the callers, some
of whom don't want to us talloc_tos().

A simple patch, but hits a lot of files.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-07-18 15:07:23 +09:30
Jeremy Allison
a7c63ac1b7 Set fsp->initial_allocation_size before calling open_file_ntcreate().
Allows an SMB_VFS_OPEN() vfs module to do something interesting with
the request.
2012-07-12 22:46:07 +02:00
Jeremy Allison
775014bd9c Make sure we reset fsp->initial_allocation_size to zero if we didn't create the file.
This will become important as we set fsp->initial_allocation_size before
create.
2012-07-12 22:46:07 +02:00
Jeremy Allison
6d903bf189 Cope with a (non-security) open race we've had for ever as NTCreateX isn't atomic on POSIX.
On open without create, the file did exist, but some
other (local or NFS) process either renamed/unlinked
and re-created the file with different dev/ino after
we walked the path, but before we did the open. We
could retry the open but it's a rare enough case it's
easier to just fail the open to prevent creating any
problems in the open file db having the wrong dev/ino
key.

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jul 10 21:57:33 CEST 2012 on sn-devel-104
2012-07-10 21:57:33 +02:00
Jeremy Allison
69a3e947b6 Now we have a guaranteed indication of a file being created, use it to set the create disposition correctly. 2012-07-10 09:39:36 -07:00
Jeremy Allison
02d42be258 Add function fd_open_atomic() which uses O_CREAT|O_EXCL to return a guaranteed indication of creation of a new file. 2012-07-10 09:39:29 -07:00
Jeremy Allison
3aa186f1d4 Simplify the logic in open_file() some more.
Move the inheritance work into the if block
where we created the file. We can never have
created the file (and thus need no inheritance)
for a stat-open.

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jul 10 03:30:22 CEST 2012 on sn-devel-104
2012-07-10 03:30:22 +02:00
Jeremy Allison
3a705e5f3d Simplify the logic in open_file().
Move the fstat call into the block which opens a file descriptor.
Remove the stat() call in the stat-open case. We already failed
the open if !file_existed.
2012-07-09 16:20:45 -07:00
Jeremy Allison
9d5e026bde Make check_same_stat() and check_same_dev_ino() common functions. 2012-07-09 12:26:56 -07:00
Jeremy Allison
1f37ed7a52 Factor out check_same_dev_ino() from check_same_stat() so it can be called separately. 2012-07-09 11:35:20 -07:00
Andreas Schneider
d0878b3b81 s3-smbd: Remove deprecated 'share modes' option. 2012-07-03 21:56:49 +02:00
Jeremy Allison
5679ba1018 Don't allow asynchronous creates to be canceled in SMB2.
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Jun 30 04:10:02 CEST 2012 on sn-devel-104
2012-06-30 04:10:02 +02:00
Jeremy Allison
b004121d9b Allow for async opens.
If the SMB_VFS_OPEN() function returns -1, EINTR -> NT_STATUS_RETRY,
then queue the open up to be completed when the async open completes.
2012-06-30 02:23:39 +02:00
Jeremy Allison
d1e1aa552d Add new bool field async_open to struct deferred_open_record. Not used yet. 2012-06-30 02:23:39 +02:00
Jeremy Allison
0362dcbd09 Fix defer_open() fuction in the open code path to cope with a NULL lck parameter. 2012-06-30 02:23:39 +02:00