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

300 Commits

Author SHA1 Message Date
Stefan Metzmacher
fe00c8e436 s3:smb2_server: use xconn->client->sconn in smbd_smb2_first_negprot()
xconn->sconn will go away soon.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-09-19 09:15:12 +02:00
Stefan Metzmacher
b970db154a s3:smb2_server: use xconn->client->sconn in smbd_smb2_io_handler()
xconn->sconn will go away soon.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-09-19 09:15:12 +02:00
Stefan Metzmacher
7e006d1113 s3:smb2_server: use the global signing key to check if signing is required
If we have a channel session key, we also always have a global session key.

For multi-channel it's possible that the channel session key is not in place
yet, in that case the global session key needs to be used.

In both cases (reauth or session bind) we session setup requests need to be
signed.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-09-19 09:15:10 +02:00
Stefan Metzmacher
3805249deb s3:smb2_server: pass smbXsrv_connection to smbd_smb2_send_break()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:14 +02:00
Stefan Metzmacher
d9716cb0db s3:smb2_server: propagate NTSTATUS from smb2_sendfile_send_data() to smbd_smb2_flush_send_queue()
Calling exit_server() from within a destructor is a bit ugly...

This will result in smbd_server_connection_terminate() instead of
directly calling exit_server(), which will be useful for multi-channel in
future.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:14 +02:00
Stefan Metzmacher
888ddd171a s3:smb2_negprot: remove NBT_HDR_SIZE from smbd_smb2_first_negprot()
This will simplify future features like multi-channel and rdma.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:13 +02:00
Stefan Metzmacher
4a07b14cea s3:smb2_server: pass smbXsrv_connection to smbd_server_connection_terminate*()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:13 +02:00
Stefan Metzmacher
b7eeb658e7 s3:smb2_server: use req->xconn in is_smb2_recvfile_write()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:13 +02:00
Stefan Metzmacher
b76cd04469 s3:smb2_server: remove unused 'sconn' from smbd_smb2_send_break_state
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:13 +02:00
Stefan Metzmacher
4faec1ea91 s3:smb2_server: use req->xconn in smbd_smb2_request_error_ex()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:13 +02:00
Stefan Metzmacher
7ee78c78e0 s3:smb2_server: use req->xconn in smbd_smb2_request_dispatch()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:13 +02:00
Stefan Metzmacher
0e2cf47a99 s3:smb2_server: use req->xconn in smbd_smb2_request_verify_creditcharge()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:13 +02:00
Stefan Metzmacher
323fe07f72 s3:smb2_server: use req->xconn in smbd_smb2_request_check_session()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:13 +02:00
Stefan Metzmacher
65ad96a841 s3:smb2_server: use req->xconn in smbd_smb2_request_process_cancel()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:13 +02:00
Stefan Metzmacher
cedf403bcf s3:smb2_server: remove unused 'sconn' from smbd_smb2_request_pending_state
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:13 +02:00
Stefan Metzmacher
a319b89687 s3:smb2_server: talloc smbd_smb2_request_pending_state on smbXsrv_connection
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:12 +02:00
Stefan Metzmacher
c02afe66eb s3:smb2_server: use req->xconn in smbd_smb2_request_setup_out()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:12 +02:00
Stefan Metzmacher
1ac9e52aae s3:smb2_server: pass smbXsrv_connection to smbd_smb2_request_next_incoming()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:12 +02:00
Stefan Metzmacher
90b27f1559 s3:smb2_server: pass smbXsrv_connection to smbd_smb2_request_create()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:12 +02:00
Stefan Metzmacher
694c048bbd s3:smb2_server: pass smbXsrv_connection to smbd_initialize_smb2()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:12 +02:00
Stefan Metzmacher
3a622c785c s3:smb2_server: pass smbXsrv_connection to smbd_smb2_first_negprot()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:12 +02:00
Stefan Metzmacher
bfc702b9a0 s3:smb2_server: pass smbXsrv_connection to smb2_set_operation_credit()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:12 +02:00
Stefan Metzmacher
f3b24168f9 s3:smb2_server: pass smbXsrv_connection to smb2_validate_message_id()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:12 +02:00
Stefan Metzmacher
aaa072a1f3 s3:smb2_server: pass smbXsrv_connection to smb2_validate_sequence_number()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:12 +02:00
Stefan Metzmacher
330febb7df s3:smb2_server: pass smbXsrv_connection to smbd_smb2_flush_send_queue()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:12 +02:00
Stefan Metzmacher
d1d3294cea s3:smb2_server: rename 'conn' variables to 'xconn'
This makes the code more consistent with other functions
using 'struct smbXsrv_connection *xconn' as local variables.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:12 +02:00
Stefan Metzmacher
59a25a6067 s3:smb2_server: pass smbXsrv_connection to fd handlers
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:12 +02:00
Stefan Metzmacher
39f5566092 s3:smb2_server: remember smbXsrv_connection for each smbd_smb2_request
This prepares the structures for multi-channel support.
Each request needs to respond on the same connection,
where it arrived.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:12 +02:00
Stefan Metzmacher
b38cb03ab6 s3:smb2_server: talloc smbd_smb2_request as child of smbXsrv_connection
As the list of pending requests moved from sconn->smb2.requests to xconn->smb2.requests,
it is more logical to use smbXsrv_connection as talloc parent.

This prepares the structures for multi-channel support.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:11 +02:00
Stefan Metzmacher
92e96bedfb s3:smb2_server: move sconn->smb2.requests to xconn->smb2.requests
This prepares the structures for multi-channel support.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:11 +02:00
Stefan Metzmacher
36e3484260 s3:smb2_server: move sconn->smb2.*credits* to xconn->smb2.credits.*
This prepares the structures for multi-channel support.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:11 +02:00
Stefan Metzmacher
e644406bcd s3:smb2_server: move sconn->smb2.send_queue* to xconn->smb2.send_queue*
This prepares the structures for multi-channel support.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:11 +02:00
Stefan Metzmacher
f9ef2a5850 s3:smb2_server: move sconn->smb2.request_read_state to xconn->smb2.request_read_state
This prepares the structures for multi-channel support.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:11 +02:00
Stefan Metzmacher
3e236983df s3:smb2_server: use xconn->transport.fde also for smb2
This prepares the structures for multi-channel support.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:11 +02:00
Stefan Metzmacher
b05b4cab25 s3:smbd: move sconn->status to xconn->transport.status
This prepares the structures for multi-channel support.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:11 +02:00
Stefan Metzmacher
9557ac4b46 s3:smbd: move sconn->smb1.fde to xconn->transport.fde
This prepares the structures for multi-channel support.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:11 +02:00
Stefan Metzmacher
0ccffffe07 s3:smbd: move sconn->sock to xconn->transport.sock
This prepares the structures for multi-channel support.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:11 +02:00
Volker Lendecke
5f3a765672 smbd: Factor out smbd_smb2_send_break
Most of this routine can be re-used for sending lease breaks

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Jul  8 19:54:09 CEST 2014 on sn-devel-104
2014-07-08 19:54:09 +02:00
Volker Lendecke
afb2b64e75 smbd: Rename smbd_smb2_send_oplock_break_state->buf to ->body
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-07-08 17:28:11 +02:00
Volker Lendecke
0d4bf9150f smbd: no "dyn" in smbd_smb2_send_oplock_break
We don't need the assignment to state->vector[1+SMBD_SMB2_DYN_IOV_OFS],
this is zero-initialized by talloc_zero

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-07-08 17:28:11 +02:00
Volker Lendecke
b7fe854140 smbd: Make hdr a field of its own in smbd_smb2_send_oplock_break
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-07-08 17:28:11 +02:00
Volker Lendecke
49de2e9df6 smbd: Make tf a field of its own in smbd_smb2_send_oplock_break
This actually saves a few bytes in .text. Maybe due to the struct assignments?

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-07-08 17:28:11 +02:00
Volker Lendecke
6fcc4f8aeb smbd: Make nbt_hdr a field of its own in smbd_smb2_send_oplock_break
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-07-08 17:28:11 +02:00
Jeremy Allison
37b4c9e08f s3: smb2 - Negprot should return INVALID_PARAMETER if flags2 signed bit is set.
MS-SMB2: 3.3.5.2.4 Verifying the Signature.
If the SMB2 header of the SMB2 NEGOTIATE
request has the SMB2_FLAGS_SIGNED bit set in the
Flags field, the server MUST fail the request
with STATUS_INVALID_PARAMETER.

Found and fix confirmed by Microsoft test tool.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
2014-06-18 07:15:13 +02:00
Stefan Metzmacher
51077c6be6 s3:smb2_server: call smbd_smb2_flush_send_queue() directly
This avoids recursion into smbd_smb2_io_handler(),
which avoids confusion when analysing out put of
performance analysing tools, e.g. callgrind.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat May 31 04:25:36 CEST 2014 on sn-devel-104
2014-05-31 04:25:36 +02:00
Stefan Metzmacher
629f4e8769 s3:smb2_server: fix invalid TALLOC_FREE(iov) in smbd_smb2_inbuf_parse_compound()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-05-31 01:59:18 +02:00
Stefan Metzmacher
e49bae7ac9 s3:smb2_server: remove unused get_min_receive_file_size() wrapper function
smb2req always comes from talloc_zero().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Apr 11 23:55:17 CEST 2014 on sn-devel-104
2014-04-11 23:55:17 +02:00
Stefan Metzmacher
535103e7a3 s3:smb2_server: only allocate the required buffer in the smb2 recvfile() code path
This way the buffer will likely be allocated within the existing talloc_pool,
which avoids one malloc() per request.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-04-11 21:41:08 +02:00
Stefan Metzmacher
80de72bb57 s3:smb2_server: prepare smbd_smb2_request_verify_sizes() for the optimized recvfile() case
For recvfile we haven't read and may not allocated the dyn buffer.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-04-11 21:41:08 +02:00
Stefan Metzmacher
95df39b99f s3:smb2_server: make sure we don't try recvfile for special NBT messages
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-04-11 21:41:08 +02:00