s4:libcli/composite: correctly finish composite smb and smb2 requests

Without this we would hang forever if the connection was already disconnected,
instead of directly propagating NT_STATUS_CONNECTION_DISCONNECTED;

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
libcli/smb: correctly report disconnect errors after getting STATUS_PENDING

smb2cli_req_recv() should not report STATUS_PENDING if the
request isn't pending anymore (e.g. the connection was disconnected)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
libcli/smb: Add routine to reset the Channel Sequence number.

Signed-off-by: Anubhav Rakshit <anubhav.rakshit@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
libcli/smb: Add routines to enable/disable SMB2_HDR_FLAG_REPLAY_OPERATION flag.

Signed-off-by: Anubhav Rakshit <anubhav.rakshit@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
s3:selftest: run the smb2.replay test against the //$SERVER_IP/durable share

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
s4:torture: Add Replay tests to examine server behaviour when Multiple Channels are utilized.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Anubhav Rakshit <anubhav.rakshit@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
s4:torture/smb2/lock: Add Lock Replay detection test case.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Anubhav Rakshit <anubhav.rakshit@gmail.com>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
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>
s3:smb2_sesssetup: use smb2req->sconn in smbd_smb2_reauth_generic_return()

xconn->sconn will go away soon.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
s3:smbd: use smbXsrv_connection_dbg() inreceive_smb_raw_talloc_partial_read()

instead of manually assembling the address string

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
s3:smbd: use smbXsrv_connection_dbg() in receive_smb_talloc()

instead of manually assembling the address string

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
s3:smbd: pass smbXsrv_connection to receive_smb*()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
s3:smbd: pass smbXsrv_connection to srv_send_smb()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
s3:smbd: use req->sconn in reply_negprot()

xconn->sconn will go away soon.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
s3:smbd: use req->sconn in reply_ntcancel()

xconn->sconn will go away soon.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
s3:smbd: use req->sconn in sesssetup.c

xconn->sconn will go away soon.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
s3:smbd: use req->sconn in reply.c where possible

xconn->sconn will go away soon.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
s3:smbd: only pass smbXsrv_connection to fork_echo_handler()

We don't need smbd_server_connection there.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
s3:smbd: support xconn=NULL in init_smb_request()

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
s3:smbd: pass smbXsrv_connection to smb1_parse_chain()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>