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

7419 Commits

Author SHA1 Message Date
Stefan Metzmacher
f76436c6ea s3:smbd: fill tcon->global->session_global_id
metze

Signed-off-by: Michael Adam <obnox@samba.org>
2012-10-19 12:15:02 +02:00
Gregor Beck
ac5c8909a9 s3:lib: remove unused sessionid_*() functions
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
2012-10-19 12:15:01 +02:00
Gregor Beck
dbff58228e s3:smbd: don't use (fill) sessionid.tdb in session_claim/yield any more.
We use data from new smbXsrv_session instead.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
2012-10-19 12:15:00 +02:00
Gregor Beck
d9ea786c86 s3:smbd/connection: use smbXsrv_tcon_traverse to count connections
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
2012-10-19 12:15:00 +02:00
Gregor Beck
f588704640 s3:smbd:setup_new_vc_session: traverse sessions instead of connections to shutdown other smbds
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
2012-10-19 12:15:00 +02:00
Gregor Beck
89cc865cab s3:smbXsrv_tcon: add smbXsrv_tcon_global_traverse()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
2012-10-19 12:15:00 +02:00
Gregor Beck
c3a658f595 s3:smbXsrv_session: add smbXsrv_session_global_traverse()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
2012-10-19 12:15:00 +02:00
Gregor Beck
b288ddd5c0 s3:smbd: use session_global_id as session number for pam and utmp
Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-10-19 12:15:00 +02:00
Gregor Beck
e24b1041b1 s3:smbd: initialize session->global before calling session_claim
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
2012-10-19 12:14:59 +02:00
Gregor Beck
02b9b79447 s3:smbd: remove smbd_server_connection argument from session_claim()
retrieve the server connection from the smbXsrv_session  argument instead.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
2012-10-19 12:14:59 +02:00
Gregor Beck
4878769f8e s3:smbd: pass smbXsrv_session instead of user_struct to session_claim() and session_yield()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
2012-10-19 12:14:59 +02:00
Gregor Beck
77906e7cdf s3:count_current_connections: do not clear orphaned entries from connections.tdb
This removes one of the last callers of connetions_forall.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
2012-10-19 12:14:59 +02:00
Stefan Metzmacher
9b2a3ebf5c s3:smbd/utmp: remove ip address from utmp record
1. This was broken since Samba 3.2. when ipv6 support was
   added, it only worked for ipv6 addresses.
2. userspace tools only display the hostname field.
3. This is not really portable

metze

Signed-off-by: Michael Adam <obnox@samba.org>
2012-10-19 12:14:58 +02:00
Michael Adam
42b0398bde s3:smbd: remove duplicate prototypes for sys_utmp_claim() an sys_utmp_yield()
Signed-off-by: Michael Adam <obnox@samba.org>
2012-10-19 12:14:58 +02:00
Stefan Metzmacher
8a1c7a0a66 s3:smbd: add exit_server to the smbd_shim hooks
This is in preparation of moving sessionid_tdb and conn_tdb
to smbd exclusively.

metze

Signed-off-by: Michael Adam <obnox@samba.org>
2012-10-19 12:14:58 +02:00
Michael Adam
8eab264470 s3:smbd: move initialization of the smbd_shim from smbd_init_globals() to main()
This is in preparation of adding server exit hooks to the shim.

Signed-off-by: Michael Adam <obnox@samba.org>
2012-10-19 12:14:58 +02:00
Stefan Metzmacher
980191d189 s3:smbd: update sconn->remote_hostname after the netbios session request
Also update the info in the new smbXsrv structure.
This way we can log the remote name in status outputs.

metze

Signed-off-by: Michael Adam <obnox@samba.org>
2012-10-19 12:14:57 +02:00
Michael Adam
b557f34c80 s3:smbd: fix brace placements in validate_my_share_entries() for readability
according to coding guidelines

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

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Oct 17 14:37:58 CEST 2012 on sn-devel-104
2012-10-17 14:37:58 +02:00
Michael Adam
678cc4403f s3:smbd: also log the "offline" flag when debugging the dos-mode
Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-10-17 12:56:32 +02:00
Christian Ambach
bddd1182ea s3:smb2_getinfo ensure proper error for not yet present quota support
non-existing quota support needs to be signaled by NT_STATUS_NOT_SUPPORTED,
not NT_STATUS_INVALID_PARAMETER

Autobuild-User(master): Christian Ambach <ambi@samba.org>
Autobuild-Date(master): Fri Oct 12 13:37:37 CEST 2012 on sn-devel-104
2012-10-12 13:37:37 +02:00
Andrew Bartlett
1ec5486338 smbd: Always free the talloc_stackframe() before leaving smbd_do_query_security_desc
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Oct 11 15:20:54 CEST 2012 on sn-devel-104
2012-10-11 15:20:54 +02:00
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
Stefan Metzmacher
9249871f40 s3:smb2_server: avoid segfault in smbd_smb2_request_pending_queue()
Because we should not call smbd_smb2_request_error() on an
request that is still running.

If the subreq implementes a cancel function, this should
take care of triggering smbd_smb2_request_error.

metze

Signed-off-by: Michael Adam <obnox@samba.org>
2012-09-22 10:18:58 +02:00
Michael Adam
1ae6f9c626 s3:smbd:smb2: simplify smbd_smb2_request_validate() and smbd_smb2_request_dispatch()
removes unnneccary checks/assignments for compound_related and next_status
and duplicate setting of error status.

And remove (now) unused next_status from struct smbd_smb2_request.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
2012-09-22 10:18:58 +02:00
Michael Adam
27d38b5c27 s3:smbd:smb2: add check for session_status for compound requests 2012-09-22 10:18:57 +02:00
Stefan Metzmacher
4384485f82 s3:smb2_server: do the req->next_status check before the signing checks
Windows 2012 returns NT_STATUS_INVALID_PARAMETER to
the smb2.compound.invalid1 test if that uses signing
(instead of NT_STATUS_ACCESS_DENIED).

metze
2012-09-22 10:18:57 +02:00
Stefan Metzmacher
2552b66323 s3:smb2_server: reset req->last_session_id and req->last_tid after using it
If we can find a valid session or tcon we'll set it after the lookup,
but it need to make sure to reset it if we don't find the session.

This fixes a problem where a compound unrelated request between
related requests doesn't reset the session.

If we have 3 requests in a compound chain, request 3 should never
use the id's cached from request 1. It should only every inherit
handles from request 2.

metze
2012-09-22 10:18:57 +02:00
Ira Cooper
7595194619 s3: Compound requests should continue processing.
This patch addresses #9173.

Signed-off-by: Michael Adam <obnox@samba.org>
2012-09-22 10:18:56 +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
Stefan Metzmacher
bc77745cfa s3:smb2_server: fix usage of invalid memory in smb2_signing_check_pdu()
metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Sep 20 07:18:31 CEST 2012 on sn-devel-104
2012-09-20 07:18:31 +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
Jeremy Allison
1e34d58439 Add "backup_intent" bool. 2012-09-14 22:54:29 +02:00
Jeremy Allison
b66bcab58c Don't call can_write_to_file() if we already have 'fsp->can_write' set. 2012-09-14 22:54:29 +02:00
Jeremy Allison
56b7525125 Sigh :-(. Removing optimization prematurely is the root of all evil :-(.
Sorry for the mistake, but the LastDir singleton cache in vfs_ChDir()
actually plays an important role. When we're processing a stream of
SMB1/SMB2/SMB3 requests we don't want to add a chdir()/getcwd()
system call pair on every request if they're all on the same connection
and dealing with the same base path.

I did some testing with a program that times 1,000,000 chdir()
requests vs. 1,000,000 strcmp requests and it's a penalty of 10x
doing the system calls.

Just because it's old code, doesn't mean it's bad :-(.

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Sep 13 21:31:42 CEST 2012 on sn-devel-104
2012-09-13 21:31:42 +02:00
Jeremy Allison
b6636affaf Move cached cwd onto conn struct.
This enables us to make VFS modules safe for use in root called
code when we've changed directory under conn->connectpath.
2012-09-12 22:06:06 +02:00
Jeremy Allison
a8676e69a6 Remove ancient "optimization" global LastDir. 2012-09-12 22:06:06 +02:00
Björn Jacke
51a409455d s3: remove unneeded noquota.c file
Autobuild-User(master): Björn Jacke <bj@sernet.de>
Autobuild-Date(master): Wed Sep 12 16:50:50 CEST 2012 on sn-devel-104
2012-09-12 16:50:50 +02:00
Andreas Schneider
1f8c9ab88e s3-rap: Open printers with the right access mask.
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Sep 12 14:05:42 CEST 2012 on sn-devel-104
2012-09-12 14:05:42 +02:00
Andrew Bartlett
e8375ddf2d smbd: Add extra VFS hooks to get the posix ACL as a blob
This will allow us to hash this, rather than the NT ACL it maps to.
This will in turn allow us to know if the NT ACL is valid even if we
have to change the mapping code.

Andrew Bartlett

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Sep 12 07:06:01 CEST 2012 on sn-devel-104
2012-09-12 07:06:01 +02:00
Andrew Bartlett
6638d10366 smbd: Remove pre-allocation of ACL array in sys_acl_init()
Instead, this is just handled with realloc in sys_acl_create_entry()

This allows us to remove the size element from the SMB_ACL_T.

Andrew Bartlett
2012-09-12 05:26:16 +02:00
Jeremy Allison
bd2f1604d7 Make metze happy and the code clearer :-).
Ensure we know after the destructor fires we're never going to
look at this again.

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Sep 12 03:00:21 CEST 2012 on sn-devel-104
2012-09-12 03:00:20 +02:00
Björn Jacke
5de7a3d739 quota: move function again to its belonging ifdef block
Autobuild-User(master): Björn Jacke <bj@sernet.de>
Autobuild-Date(master): Tue Sep 11 04:44:28 CEST 2012 on sn-devel-104
2012-09-11 04:44:28 +02:00
Björn Jacke
da747faad2 s3:proto.h: remove duplicate disk_quotas prototypes 2012-09-11 03:05:17 +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
Jeremy Allison
ba5f557b5d Fix talloc memory heirarchy bug. If there's an SMB2 sessionsetup in flight when we're shut down, we end up freeing the struct smbXsrv_session *session pointer twice.
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Sep 10 23:34:06 CEST 2012 on sn-devel-104
2012-09-10 23:34:06 +02:00
Matthieu Patou
9eb91a5055 uid_t is a synonym for int on osX
This function is clearly osX oriented so we adapt the modifier to the
target
2012-09-10 05:57:21 +02:00
Michael Adam
eabe4c8fc4 s3:vfs_default: add basic support for durable handle request and reconnect
We only grant durable handles for CIFS/SMB2 only access,
that means "kernel oplocks", "kernel share modes" and "posix locking"
need to be set to "no".

For now we also don't grant durable handles if delete on close
is active on the handle.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Pair-Programmed-With: Volker Lendecke <vl@samba.org>
2012-09-08 19:48:20 +02: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
Michael Adam
9576638dba s3:smbd: add basic support for durable handle v2 request and reconnect
This does not yet cover persistent handle support which is also
negotiated through these create request blobs.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
2012-09-08 03:39:06 +02:00
Michael Adam
267b976d43 s3:smbd: add basic support for durable handle request and reconnect
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Pair-Programmed-With: Volker Lendecke <vl@samba.org>
2012-09-08 03:39:06 +02:00
Michael Adam
f935ebdf7a s3:smbd: initial durable handle support: special treatment of durable handles in close
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
2012-09-08 03:39:06 +02:00
Michael Adam
35260ae89e s3:vfs: add durable VFS operations
This allows a VFS module to implement durable handles in different ways.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
2012-09-08 03:39:06 +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
Michael Adam
42afa596d5 s3:smbd: also close durable file handles in a tdis
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
2012-09-08 03:39:06 +02:00
Stefan Metzmacher
bc296053cb s3:smbXsrv_open: add smb2srv_open_recreate() to support durable handles
metze
2012-09-08 03:39:06 +02:00
Volker Lendecke
4abccf0b65 s3: Fix a panic when shutting down
When a client disconnects while we have aio open, there is no close
request that cleans up. We can't send out the replies anymore, so
just drop the aio requests that are pending.

Found using the new python lib writing multiple files simultaneously

TODO: check tdis and logoff

Signed-off-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Sat Sep  8 01:27:34 CEST 2012 on sn-devel-104
2012-09-08 01:27:34 +02:00
Björn Jacke
1f61abd322 s3-smbd: Remove OSF1 support from old (pre-sysquotas) code
"recent" Tru64 releases had QUOTACTL_4B support
2012-09-07 14:15:57 +02:00
Björn Jacke
d6cc08b9ee s3:quota: don't force the block size to 512
there is no point in forcing the block size to 512 when curblocks is 1. This
will only lead to false quota reporting. See bug #3272
2012-09-06 15:08:22 +02:00
Andrew Bartlett
146ad30387 s3-smbd: Remove remaining references to removed OS support in old-style quota code
Signed-off-by: Björn Jacke <bj@sernet.de>

Autobuild-User(master): Björn Jacke <bj@sernet.de>
Autobuild-Date(master): Thu Sep  6 10:47:18 CEST 2012 on sn-devel-104
2012-09-06 10:47:18 +02:00
Andrew Bartlett
9bfab7ec8c s3-smbd: Remove IRIX support from old (pre-sysquotas) code
This should be essentially dead code, as while it is possible to disable sysquotas, the sysquotas has since 2003 supported the 4A varient used on IRIX.

Andrew Bartlett

Signed-off-by: Björn Jacke <bj@sernet.de>
2012-09-06 09:08:57 +02:00
Andrew Bartlett
79bc9e5ace s3-smbd: Remove HPUX support from old (pre-sysquotas) code
This should be essentially dead code, as while it is possible to disable sysquotas, the sysquotas has since 2003 supported the 4A varient used on HPUX.

Andrew Bartlett

Signed-off-by: Björn Jacke <bj@sernet.de>
2012-09-06 09:08:57 +02:00
Andrew Bartlett
8b90f6ace3 s3-smbd: Remove BSD support from old (pre-sysquotas) code
This is essentially dead code, as while it is possible to disable
sysquotas, the default for BSD is now to use sysquotas with the
addition of 4B support via the recent Darwin patch by James Peach.

NFS support has been in sysquotas for quite some time now.

Andrew Bartlett

Signed-off-by: Björn Jacke <bj@sernet.de>
2012-09-06 09:08:57 +02:00
Andrew Bartlett
28ccb67170 s3-smbd: Remove Linux support from old (pre-sysquotas) code
This is essentially dead code, as while it is possible to disable sysquotas, the default
for Linux has been to use sysquotas for quite some time now.

Andrew Bartlett

Signed-off-by: Björn Jacke <bj@sernet.de>
2012-09-06 09:08:57 +02:00
Andrew Bartlett
24013bda45 build: Remove Unicos support (quota in particular)
Unicos machines are long gone now (Cray now make Linux compute nodes),
so remove the quota support.

Andrew Bartlett

Signed-off-by: Björn Jacke <bj@sernet.de>
2012-09-06 09:08:57 +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
Stefan Metzmacher
92bd7b0db8 s3:smb2_create: check for SMB2_CREATE_TAG_DHNC first
metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Sep  5 12:27:25 CEST 2012 on sn-devel-104
2012-09-05 12:27:25 +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
Michael Adam
b1966f3118 s3:smbd: in sys_disk_free(), improve a debug message 2012-09-04 20:39:20 +02:00
Michael Adam
cc99189de1 s3:smbd: in sys_disk_free(), improve a debug message 2012-09-04 20:39:20 +02:00
Michael Adam
04ac781626 s3:smbd: in sys_disk_free(), fix line length and indentation of debug statement 2012-09-04 20:39:20 +02:00
Michael Adam
a56d2dea06 s3:smbd: in sys_disk_free(), fix a debug message 2012-09-04 20:39:20 +02:00
Björn Jacke
9dd0e1608e s3: remove some duplicate quota code 2012-09-02 21:44:54 +02: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
3d34406c7b Windows does canonicalization of inheritance bits. Do the same.
We need to filter out the
SEC_DESC_DACL_AUTO_INHERITED|SEC_DESC_DACL_AUTO_INHERIT_REQ
bits. If both are set we store SEC_DESC_DACL_AUTO_INHERITED
as this alters whether SEC_ACE_FLAG_INHERITED_ACE is set
when an ACE is inherited. Otherwise we zero these bits out.
See:

http://social.msdn.microsoft.com/Forums/eu/os_fileservices/thread/11f77b68-731e-407d-b1b3-064750716531

for details.
2012-08-30 10:08:50 -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
Jeremy Allison
70ebf1da67 Re-add set_sd(), called from set_sd_blob(). Allows us to centralize all ACL canonicalization. 2012-08-30 10:08:50 -07:00
Jeremy Allison
8c84ecef89 Rename set_sd() to set_sd_blob() - this describes what it does. 2012-08-30 10:08:50 -07:00
Andreas Schneider
ba862f47d7 s3-smbd: Fix flooding the logs with records we don't find in pcap.
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Aug 28 16:38:55 CEST 2012 on sn-devel-104
2012-08-28 16:38:55 +02:00
Andrew Bartlett
dc8d29cdae s3-vfs: Indicate the symlink destination when failing check_reduced_name 2012-08-28 15:47:37 +10:00
Andrew Bartlett
0aed29105e s3-smbd: Add security_info_wanted argument to get_nt_acl_no_snum
I need to get at the owner, group, DACL and SACL when testing correct
ACL storage.

Andrew Bartlett
2012-08-23 15:02:26 +02:00
Andrew Bartlett
e058dfb3b0 s3-pysmbd: Fix return type of smbd.get_nt_acl
The security_ prefix is stripped off in the python bindings.

Andrew Bartlett
2012-08-23 15:02:26 +02:00
Andrew Bartlett
e8e24a251b s3-smbd: Add talloc_stackframe() to get_nt_acl_no_snum()
This is required because the functions it calls use talloc_tos().

Andrew Bartlett
2012-08-23 15:02:26 +02:00
Andrew Bartlett
8c71dc3505 param: Add startup checks for valid server role/binary combinations
This should eliminate confusion from our users about what they can
expect to successfully run.

Andrew Bartlett
2012-08-23 15:02:26 +02:00
Andrew Bartlett
332efe1539 s3-pysmbd: Fix error message 2012-08-23 15:02:26 +02:00
Andrew Bartlett
51e3547426 s3-pysmbd: Allow a mode to be specified for the simple ACL
The additional group for the ACL is now optional.

Andrew Bartlett
2012-08-23 15:02:26 +02:00
Stefan Metzmacher
069db9b630 s3:smb2_break: encrypt OPLOCK BREAK notifications
metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Aug 23 10:01:14 CEST 2012 on sn-devel-104
2012-08-23 10:01:14 +02:00
Stefan Metzmacher
54dfd08cb2 s3:smb2_server: use smbXsrv_session->nonce_*
metze
2012-08-23 08:23:07 +02:00
Stefan Metzmacher
6c7ffa9092 s3:smb2_server: remove dump_data() from smbd_smb2_request_pending_timer()
This was just for debugging...

metze
2012-08-23 08:23:07 +02:00
Andrew Bartlett
125e93cdde s3-pysmbd: Correct the python type for smb_acl_t
The t is weird, but the python bindings trim the traditional IDL name
prefix of each element, as it is usually rudundent.

Andrew Bartlett
2012-08-22 01:31:57 +02:00
Andrew Bartlett
dc063bf3bd s3-pysmbd: Add get/set functions for the posix ACL layer
These will be used to verify that an ACL set as an NT ACL creates
the correct posix ACL.

Andrew Bartlett
2012-08-21 15:25:50 +10:00
Andrew Bartlett
4df2c65ea6 s3-pysmbd: Correct comments in python VFS bindings 2012-08-21 15:25:50 +10:00
Andrew Bartlett
d963aaf73b s3-pysmbd: Add hook for a VFS chown() 2012-08-21 15:25:49 +10:00