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

649 Commits

Author SHA1 Message Date
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
Volker Lendecke
754b925ccd s3: Fix a typo
Signed-off-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Mon Jun 25 17:13:59 CEST 2012 on sn-devel-104
2012-06-25 17:13:59 +02:00
Michael Adam
73b200064f s3:util: rename procid_equal() to serverid_equal()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-21 08:27:32 +02:00
Volker Lendecke
985dbedf27 s3: Slightly simplify grant_fsp_oplock_type
The "else" is not necessary, we did a return in the if-branch

Signed-off-by: Jeremy Allison <jra@samba.org>
2012-06-15 21:07:55 -07:00
Michael Adam
cdfc301da9 s3:smbd: change open.c to use fsp_fnum_dbg() for fsp->fnum logging.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-15 03:28:14 +02:00
Björn Jacke
f97ca7d643 s3: fix build on systems without O_NOFOLLOW 2012-06-10 21:38:08 +02:00
Björn Jacke
f75f1d6233 s3: handle non-POSIX compliant Tru64, NetBSD and FreeBSD errno on O_NOFOLLOW symlink open calls
or should we leave the NetBSD and FreeBSD platforms just broken? Actually these
two *want* to have broken platforms as they use different errno's than POSIX
demands *interntionally*. The POSIX errno ELOOP for O_NOFOLLOW open calls on
symlinks is clear and unambiguous. See http://gnats.netbsd.org/43154 for the
interesting NetBSD discussion on that.

Autobuild-User(master): Björn Jacke <bj@sernet.de>
Autobuild-Date(master): Sun Jun 10 16:10:02 CEST 2012 on sn-devel-104
2012-06-10 16:10:01 +02:00
Michael Adam
8a338c65a1 s3:smbd: change set_file_oplock() to return NTSTATUS
Pair-Programmed-With: Volker Lendecke <vl@samba.org>
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Fri Jun  8 23:20:20 CEST 2012 on sn-devel-104
2012-06-08 23:20:20 +02:00
Volker Lendecke
088ca00b92 s3: Replace an if with a boolean short circuit
Signed-off-by: Michael Adam <obnox@samba.org>
2012-06-08 21:29:20 +02:00
Volker Lendecke
a3b4a5d779 s3: Assigning ?True:False to a bool is a bit pointless
Signed-off-by: Michael Adam <obnox@samba.org>
2012-06-08 21:29:20 +02:00
Volker Lendecke
4aea0c1fa1 s3: Remove unnecessary ()
Signed-off-by: Michael Adam <obnox@samba.org>
2012-06-08 21:29:19 +02:00
Stefan Metzmacher
c535668f7b s3:smbd: let fcb_or_dos_open() take a uint64_t vuid
metze
2012-06-06 10:18:41 +02:00
Stefan Metzmacher
37bfadf4a3 s3:include: change files_struct->vuid to uint64_t
metze
2012-06-06 10:18:40 +02:00
Stefan Metzmacher
145fe2ac4c s3:smbd: fcb_or_dos_open() can be static
metze
2012-06-06 10:18:37 +02:00
Jeremy Allison
4accd2396e Fix bug #8972 - Directory group write permission bit is set if unix extensions are enabled
We can't manipulate file_attributes if it's a posix call. I'll look
at adding a test for this asap.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Tue Jun  5 04:26:11 CEST 2012 on sn-devel-104
2012-06-05 04:26:10 +02:00
Stefan Metzmacher
85e6dcf49c s3:smbd/open: avoid procid_is_me()
metze
2012-06-03 17:23:27 +02:00
Jeremy Allison
50fdb32a4d Ensure we only return NT_STATUS_DELETE_PENDING if the share modes are valid.
Ensure we only return *file_existed = true if there were valid share modes.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-05-25 09:19:38 -07:00