summaryrefslogtreecommitdiff
path: root/source3/smbd/smb2_server.c
AgeCommit message (Collapse)AuthorFilesLines
2013-05-23Revert my accidental commit.Richard Sharpe1-1/+1
Signed-off-by: Richard Sharpe <rsharpe@samba.org> Autobuild-User(master): Richard Sharpe <sharpe@samba.org> Autobuild-Date(master): Thu May 23 06:53:17 CEST 2013 on sn-devel-104
2013-05-21Make sure that if an smbd is exiting because of an error we let the user know.Richard Sharpe1-1/+1
Signed-off-by: Richard Sharpe <realrichardsharpe@gmail.com>
2013-05-07Remove the compound_related_in_progress state from the smb2 global state.Jeremy Allison1-11/+0
And also remove the restriction that we can't read a new request whilst we're in this state. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Richard Sharpe <realrichardsharpe@samba.org>
2013-05-07The core of the fix to allow opens to go async inside a compound request.Jeremy Allison1-43/+53
This is only allowed for opens that cause an oplock break, otherwise it is not allowed. See [MS-SMB2].pdf note <194> on Section 3.3.5.2.7. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
2013-05-07Move a variable into the area of code where it's used.Jeremy Allison1-2/+2
Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
2013-05-07Ensure we don't try and cancel anything that is in a compound-related request.Jeremy Allison1-0/+8
Too hard to deal with splitting off the replies. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
2013-04-19Add the internals of is_smb2_recvfile_write.Jeremy Allison1-1/+37
This turns on the real receivefile detection, and completes the receivefile code path changes. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan (metze) Metzmacher <metze@samba.org>
2013-04-19The guts of the receivefile code changes.Jeremy Allison1-5/+60
If an incoming PDU might qualify, only read SMBD_SMB2_SHORT_RECEIVEFILE_WRITE_LEN = (SMB2_HEADER + SMB2_WRITE_BODY_LEN) bytes rather than the whole PDU. Next time we're called, use is_smb2_recvfile_write() to decide if this is an SMB2_WRITE that fit the receivefile criteria, otherwise just read the rest of the PDU. If we did do a short receivefile read, set up the smb2_req->smb1req->unread_bytes value to show what bytes remain in the TCP buffers. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan (metze) Metzmacher <metze@samba.org>
2013-04-19Add stub static function that will turn on/off receivefile code path.Jeremy Allison1-0/+5
Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan (metze) Metzmacher <metze@samba.org>
2013-04-19Add extra fields into struct smbd_smb2_request_read_state to support ↵Jeremy Allison1-0/+3
receivefile. Initialize min_recv_size with the size that will trigger the receivefile write path. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan (metze) Metzmacher <metze@samba.org>
2013-04-19Add utility function get_min_receive_file_size().Jeremy Allison1-0/+11
Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan (metze) Metzmacher <metze@samba.org>
2013-04-19Allow smbd_smb2_request_error_ex() to cope with unread bytes on error.Jeremy Allison1-0/+10
Drain the socket if a RECVFILE write failed. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan (metze) Metzmacher <metze@samba.org>
2013-04-02Fix bad SMB2 opcode reading in server.Jeremy Allison1-5/+5
SMB2 opcodes are 16-bit values. We should *never* be reading them with IVAL(inhdr, SMB2_HDR_OPCODE), it should always be SVAL(inhdr, SMB2_HDR_OPCODE). Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com> Autobuild-User(master): Richard Sharpe <sharpe@samba.org> Autobuild-Date(master): Tue Apr 2 07:28:48 CEST 2013 on sn-devel-104
2012-11-02smb2_server: Fix typo in comment.Karolin Seeger1-1/+1
Karolin Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Fri Nov 2 15:40:22 CET 2012 on sn-devel-104
2012-11-02s3:smbd:smb2: fix a comment typo in the crediting code.Michael Adam1-1/+1
Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Fri Nov 2 10:09:36 CET 2012 on sn-devel-104
2012-10-03Fix bug #9214 - Bad user supplied SMB2 credit value can cause smbd to call ↵Jeremy Allison1-1/+6
smb_panic. Terminate the connection cleanly instead.
2012-09-22s3:smb2_server: avoid segfault in smbd_smb2_request_pending_queue()Stefan Metzmacher1-2/+6
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-22s3:smbd:smb2: simplify smbd_smb2_request_validate() and ↵Michael Adam1-49/+3
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-22s3:smbd:smb2: add check for session_status for compound requestsMichael Adam1-3/+3
2012-09-22s3:smb2_server: do the req->next_status check before the signing checksStefan Metzmacher1-15/+15
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-22s3:smb2_server: reset req->last_session_id and req->last_tid after using itStefan Metzmacher1-0/+4
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-22s3: Compound requests should continue processing.Ira Cooper1-3/+2
This patch addresses #9173. Signed-off-by: Michael Adam <obnox@samba.org>
2012-09-20s3:smb2_server: fix usage of invalid memory in smb2_signing_check_pdu()Stefan Metzmacher1-1/+1
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-08-23s3:smb2_break: encrypt OPLOCK BREAK notificationsStefan Metzmacher1-13/+80
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-23s3:smb2_server: use smbXsrv_session->nonce_*Stefan Metzmacher1-25/+24
metze
2012-08-23s3:smb2_server: remove dump_data() from smbd_smb2_request_pending_timer()Stefan Metzmacher1-1/+0
This was just for debugging... metze
2012-08-17s3:smb2_server: add SMB3 encryption supportStefan Metzmacher1-31/+319
metze
2012-08-17s3:smb2_server: try to sign an error response if we have a signing keyStefan Metzmacher1-1/+18
metze Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Fri Aug 17 00:54:01 CEST 2012 on sn-devel-104
2012-08-16s3:smb2_server: verify the signature before the session_statusStefan Metzmacher1-3/+4
metze
2012-08-16s3:smb2_server: add some const to print_req_vectors()Stefan Metzmacher1-1/+1
metze
2012-08-15s3:smb2_server: do calculations based on SMBD_SMB2_NUM_IOV_PER_REQ in ↵Stefan Metzmacher1-3/+3
smbd_smb2_request_validate() metze
2012-08-09s3:smb2_server: add smbd_smb2_request->do_encryptionStefan Metzmacher1-0/+1
For now it's always false... metze
2012-08-09s3:smb2_server: check the session before we could response with an error.Stefan Metzmacher1-15/+15
metze
2012-08-09s3:smb2_server: do central file_id check if the operation requires itStefan Metzmacher1-0/+56
Note that it's fine to call file_fsp_smb2() twice, the 2nd call just returns smb2req->compat_chain_fsp without a 2nd lookup. metze
2012-08-08s3:smb2_server: s/i/idx in smbd_smb2_request_pending_queue()Stefan Metzmacher1-4/+4
metze Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Wed Aug 8 17:32:26 CEST 2012 on sn-devel-104
2012-08-08s3:smb2_server: make use of SMBD_SMB2_OUT_HDR_PTR() in ↵Stefan Metzmacher1-1/+1
smbd_smb2_request_pending_queue() metze
2012-08-08s3:smb2_server: remove useless variable 'i'Stefan Metzmacher1-2/+1
metze
2012-08-08s3:smb2_server: rewrite dup_smb2_vec3() using SMBD_SMB2_*_IOV_OFS and helper ↵Stefan Metzmacher1-42/+52
variables metze
2012-08-08s3:smb2_server: make use of SMBD_SMB2_* macros in smbd_smb2_request_done_ex()Stefan Metzmacher1-18/+21
metze
2012-08-08s3:smb2_server: make use of SMBD_SMB2_* macros in ↵Stefan Metzmacher1-8/+14
smbd_smb2_request_verify_sizes() metze
2012-08-08s3:smb2_server: use the common buffer layout for smbd_smb2_request_pending*Stefan Metzmacher1-16/+26
metze
2012-08-08s3:smb2_server: don't try to update req->in.vector[0] in ↵Stefan Metzmacher1-3/+0
smbd_smb2_request_pending_queue() req->in.vector[0] is reserved for the transport and might be removed in future. This is currently always { NULL, 0 }, as it's not used, by our transport layer code. The SMB2 layer should never touch this! metze
2012-08-08s3:smb2_server: sign the last request at the start of smbd_smb2_request_reply()Stefan Metzmacher1-22/+16
This means we correctly sign all responses in a compound chain. metze
2012-08-07s3:smb2_server: fix SMB2 signing of compound responsesStefan Metzmacher1-13/+72
We need to defer the signing until we know the response doesn't change anymore before it goes over the wire. metze Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Tue Aug 7 20:29:30 CEST 2012 on sn-devel-104
2012-08-07s3:smb2_server: there's no need to copy req->out.vector when we just keep ↵Stefan Metzmacher1-22/+5
the last request metze
2012-08-07s3:smb2_server: use memmove instead of copying single vector elementsStefan Metzmacher1-6/+7
metze
2012-08-07s3:smb2_server: make use of SMBD_SMB2_OUT_HDR_PTR() ↵Stefan Metzmacher1-1/+1
smbd_smb2_request_pending_queue() metze
2012-08-07s3:smb2_server: check for compound based on SMBD_SMB2_NUM_IOV_PER_REQStefan Metzmacher1-1/+1
metze
2012-08-07s3:smb2_server: make use of SMBD_SMB2_OUT_*_IOV smbd_smb2_request_reply()Stefan Metzmacher1-4/+4
metze
2012-08-07s3:smb2_server: check for compound based on SMBD_SMB2_NUM_IOV_PER_REQStefan Metzmacher1-4/+3
metze