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

7298 Commits

Author SHA1 Message Date
Andrew Bartlett
ddcaac99f0 vfs: Implement a sys_acl_blob_get_{fd,file} for POSIX ACL backends
This simply linearlises the SMB_ACL_T (default and access acl for
directories) and the file owner, group and mode into a blob.

It will be useful for an improved vfs_acl_common.c that uses this sets
that, rather than the hash of the NT ACL, in the xattr

This will in turn insulate the stored hash from changes in the ACL
mapping.

Andrew Bartlett
2012-10-11 12:25:11 +11:00
Andrew Bartlett
1f36ec1293 vfs: Remove type parameter from sys_acl_blob_get_{fd,file}
This interface actually needs to match the get_nt_acl interface in
that the system ACL implmenetation may not be posix ACLs, and the blob
is not meant to be enforced to be of a particular system ACL
structure.

Andrew Bartlett
2012-10-11 12:25:11 +11:00
Andrew Bartlett
c8ade07760 smbd: Add mem_ctx to {f,}get_nt_acl VFS call
This makes it clear which context the returned SD is allocated on, as
a number of callers do not want it on talloc_tos().

As the ACL transformation allocates and then no longer needs a great
deal of memory, a talloc_stackframe() call is used to contain the
memory that is not returned further up the stack.

Andrew Bartlett
2012-10-11 12:25:11 +11:00
Andrew Bartlett
9158974540 smbd: Add mem_ctx to sys_acl_init() and all callers
This changes from allocation on NULL to allocation on the supplied
memory context.

Currently that supplied context is talloc_tos() at the the final consumer of
the ACL.

Andrew Bartlett
2012-10-11 12:25:11 +11:00
Jeremy Allison
828793852f We should never just assign an st_mode to an ace->perms field, theoretically
they are different so should go through a mapping function. Ensure this is so.

Practically this does not matter, as for user permissions the mapping
function is an identity, and the extra bits we may add are ignored
anyway, but this makes the intent clear.

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Oct  6 03:04:14 CEST 2012 on sn-devel-104
2012-10-06 03:04:14 +02:00
Jeremy Allison
47ebc8fbc9 Modify ensure_canon_entry_valid() into ensure_canon_entry_valid_on_set() - makes the logic clearer. 2012-10-05 15:48:07 -07:00
Jeremy Allison
9466cd189d Simplify ensure_canon_entry_valid by splitting out the _get codepath. 2012-10-05 15:09:06 -07:00
Jeremy Allison
7622aa16ad Remove all uses of lp_security_mask/lp_force_security_mode/lp_dir_security_mask/lp_force_dir_security_mode
and replace with the normal masks. Now these parameters can be removed.
2012-10-04 09:52:38 -07:00
Jeremy Allison
3f5a3b60e2 Revert "When creating a new file/directory, we need to obey the create mask/directory mask parameters."
This reverts commit c251a6b044.

Remove this as we're planning to remove the security mask,
directory security mask parameters and only use create mask/directory mask.
2012-10-04 09:52:38 -07:00
Andreas Schneider
50de2c9bbb s3fs-smbd: Make sure the registry is set up before we init printing.
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Oct  4 12:06:29 CEST 2012 on sn-devel-104
2012-10-04 12:06:29 +02:00
Jeremy Allison
49a335731a Revert "Fix bug #9222 - smbd ignores the "server signing = no" setting for SMB2."
This reverts commit dfd3c31a3f.

As Metze pointed out:

From MS-SMB2 section 2.2.4:

SMB2_NEGOTIATE_SIGNING_ENABLED

When set, indicates that security signatures are enabled
on the server. The server MUST set this bit, and the client MUST return
STATUS_INVALID_NETWORK_RESPONSE if the flag is missing.

I'll submit a documentation bug to fix #9222 that way.
2012-10-03 12:50:42 -07:00
Jeremy Allison
c2f5b2466b Fix bug #9214 - Bad user supplied SMB2 credit value can cause smbd to call smb_panic.
Terminate the connection cleanly instead.
2012-10-03 12:49:15 -07:00
Jeremy Allison
dfd3c31a3f Fix bug #9222 - smbd ignores the "server signing = no" setting for SMB2.
Still sign if client request is signed, just don't negotiate it in
negprot or sessionsetup.

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Oct  3 00:59:42 CEST 2012 on sn-devel-104
2012-10-03 00:59:42 +02:00
Jeremy Allison
c251a6b044 When creating a new file/directory, we need to obey the create mask/directory mask parameters.
Currently we call FSET_NT_ACL to inherit any ACLs on create. However
FSET_NT_ACL uses the security mask/directory security mask parameters
instead of the create mask/directory mask parameters.

Swap them temporarily when creating to ensure the correct masks
are applied.

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Oct  2 22:27:17 CEST 2012 on sn-devel-104
2012-10-02 22:27:17 +02:00
Jeremy Allison
6575d1d34f When setting a non-default ACL, don't forget to apply masks to SMB_ACL_USER and SMB_ACL_GROUP entries. 2012-10-02 11:41:35 -07:00
Jeremy Allison
5d5ddbd624 Only apply masks on non-default ACL entries when setting the ACL. 2012-10-02 11:41:35 -07:00
Jeremy Allison
82e7132bdf Use is_default_acl variable in canonicalise_acl(). 2012-10-02 11:41:35 -07:00
Jeremy Allison
efb446a38c Reformat spacing to be even. 2012-10-02 11:41:34 -07:00
Björn Baumbach
7a76762c68 s3: make recursive_rmdir function non-static 2012-10-01 17:06:06 +02:00
Volker Lendecke
e576bf5310 s3: Fix opening a file under kernel oplocks
With the prior code we assumed that we do not have kernel oplocks around
when we open a file because we handled samba-internal oplock breaks
before the open attempt.

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Sat Sep 29 19:29:36 CEST 2012 on sn-devel-104
2012-09-29 19:29:36 +02:00
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
4544c52fc4 s3: For read-only shares, filter out write bits from conn->access_mask
Signed-off-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Sep 27 02:51:42 CEST 2012 on sn-devel-104
2012-09-27 02:51:41 +02: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
Andreas Schneider
50d324b7e0 s3-smbd: Don't segfault if user specified ports out for range.
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Sep 26 16:28:44 CEST 2012 on sn-devel-104
2012-09-26 16:28:44 +02:00
Stefan Metzmacher
4604219ceb s3:smb2_create: don't take 'state->te' as indication for "was_deferred" (bug #9196)
We always set state->te = NULL of TALLOC_FREE(state->te),
before calling smbd_smb2_request_dispatch(), so
open_was_deferred_smb2() always returned false, while dispatching
it again.

But it's remove_deferred_open_message_smb2_internal() which
should reset this state.

In developer mode validate_my_share_entries() did call smb_panic()
before.

metze
2012-09-26 06:16:06 +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
e0de443af8 s3: Slightly simplify smbd_smb2_request_process_negprot
Remove a nested if-statement
2012-09-25 22:41:51 +02:00
Volker Lendecke
1b403d46c7 s3: Fix some blank line endings 2012-09-25 22:41:51 +02:00
Volker Lendecke
11af163df8 s3: Fix a typo 2012-09-25 22:41:51 +02:00
Volker Lendecke
0feb341502 pysmbd: Fix cut&paste errors 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
Christian Ambach
9f589ea406 s3:printing only do printing_subsystem_update when printing is enabled
no point in calling this if printing was disabled and no spoolss service was started
this hurts CTDB clusters as the smbds on the cluster nodes will fight for the single record in the TDB

This fixes Bug 9197 - Disabling printing still makes smbd create and access printer_list.tdb
2012-09-23 17:10:29 -07:00
Michael Adam
93bee9b3e3 s3:smbd:smb2: initialize variable in vfs_default_durable_reconnect()
Found by Ambi's state-of-the-art compiler!
2012-09-22 10:19:02 +02:00
Michael Adam
88d051f7f1 s3:smbd: remove struct member smbd_smb2_request.cancelled - it was only written 2012-09-22 10:19:00 +02:00
Stefan Metzmacher
603f9bfa4c s3:smb2_lock: let smbd_smb2_create_cancel() trigger NT_STATUS_CANCELED
Instead of violating the tevent_req layers.

metze
2012-09-22 10:19:00 +02:00
Stefan Metzmacher
65a8106009 s3:smb2_lock: smbd_smb2_notify_recv() can already return NT_STATUS_CANCELED
That's why we can remove the code that violates the tevent_req layers.

metze
2012-09-22 10:19:00 +02:00
Stefan Metzmacher
882cee0acb s3:smb2_notify: make use of tevent_req_defer_callback() instead of custom tevent_immediate
metze
2012-09-22 10:18:59 +02:00
Stefan Metzmacher
1f0dfd42f1 s3:smb2_notify: don't call tevent_req_done() from smbd_smb2_notify_cancel()
smbd_notify_cancel_by_smbreq() will already trigger this via
smbd_smb2_notify_reply() and smbd_smb2_notify_reply_trigger().

metze
2012-09-22 10:18:59 +02:00
Stefan Metzmacher
1f8e4732c5 s3:smb2_lock: let smbd_smb2_lock_cancel() trigger NT_STATUS_CANCELED
Instead of violating the tevent_req layers.

metze
2012-09-22 10:18:59 +02:00