[PATCH] Two small preparatory patches for multi-channel
Ralph Böhme
slow at samba.org
Tue Oct 6 10:54:50 UTC 2015
Hi
attached are two small patches with preparatory work for
multi-channel.
The patches already have the necessary two team-member votes, so I'll
push later on if I don't hear any objections.
Two patches on-top of the multi-channel WIP branch then use these
changes, they can be found in my slow-multi-channel branch. :)
6707ede STEP2: AFTER: TMP more DEBUG smbXsrv_client_connection_pass_loop
3c8d583 STEP2: AFTER: TMP more DEBUG smbXsrv_client_connection_pass_loop, remove from smbXsrv.idl
-slow
-------------- next part --------------
From b62aa3abf07324c18d5cdd176d1cf0cf7f721360 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Sun, 27 Sep 2015 01:58:46 +0200
Subject: [PATCH 1/2] s3:smbd: add expected_seq_low arg to smbd_initialize_smb2
This is in preparation of connection passing for multichannel where we
have to set seq_low to the mid of the passed negprot.
Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
Signed-off-by: Ralph Boehme <slow at samba.org>
Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
source3/smbd/smb2_server.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index a53ddf8..2c1546c 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -200,11 +200,12 @@ bool smbd_is_smb2_header(const uint8_t *inbuf, size_t size)
return true;
}
-static NTSTATUS smbd_initialize_smb2(struct smbXsrv_connection *xconn)
+static NTSTATUS smbd_initialize_smb2(struct smbXsrv_connection *xconn,
+ uint64_t expected_seq_low)
{
TALLOC_FREE(xconn->transport.fde);
- xconn->smb2.credits.seq_low = 0;
+ xconn->smb2.credits.seq_low = expected_seq_low;
xconn->smb2.credits.seq_range = 1;
xconn->smb2.credits.granted = 1;
xconn->smb2.credits.max = lp_smb2_max_credits();
@@ -3159,7 +3160,7 @@ void smbd_smb2_first_negprot(struct smbXsrv_connection *xconn,
DEBUG(10,("smbd_smb2_first_negprot: packet length %u\n",
(unsigned int)size));
- status = smbd_initialize_smb2(xconn);
+ status = smbd_initialize_smb2(xconn, 0);
if (!NT_STATUS_IS_OK(status)) {
smbd_server_connection_terminate(xconn, nt_errstr(status));
return;
--
2.1.0
From c29a0ddd586afd1d471f1f558997821821891323 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Sun, 27 Sep 2015 02:01:47 +0200
Subject: [PATCH 2/2] s3:smb3: rename smbd_smb2_first_negprot and pass expected
seq_low
This is in preperation of connection passing where we have to set
seq_low to the mid from the negprot we've handed over.
Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
Signed-off-by: Ralph Boehme <slow at samba.org>
Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
source3/smbd/globals.h | 5 +++--
source3/smbd/process.c | 2 +-
source3/smbd/smb2_negprot.c | 2 +-
source3/smbd/smb2_server.c | 5 +++--
4 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index b107049..b567a58 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -226,8 +226,9 @@ NTSTATUS smbd_add_connection(struct smbXsrv_client *client, int sock_fd,
void reply_smb2002(struct smb_request *req, uint16_t choice);
void reply_smb20ff(struct smb_request *req, uint16_t choice);
-void smbd_smb2_first_negprot(struct smbXsrv_connection *xconn,
- const uint8_t *inpdu, size_t size);
+void smbd_smb2_process_negprot(struct smbXsrv_connection *xconn,
+ uint64_t expected_seq_low,
+ const uint8_t *inpdu, size_t size);
DATA_BLOB smbd_smb2_generate_outbody(struct smbd_smb2_request *req, size_t size);
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 74d34ef..8d9275c 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -1893,7 +1893,7 @@ static void process_smb(struct smbXsrv_connection *xconn,
if (smbd_is_smb2_header(inbuf, nread)) {
const uint8_t *inpdu = inbuf + NBT_HDR_SIZE;
size_t pdulen = nread - NBT_HDR_SIZE;
- smbd_smb2_first_negprot(xconn, inpdu, pdulen);
+ smbd_smb2_process_negprot(xconn, 0, inpdu, pdulen);
return;
} else if (nread >= smb_size && valid_smb_header(inbuf)
&& CVAL(inbuf, smb_com) != 0x72) {
diff --git a/source3/smbd/smb2_negprot.c b/source3/smbd/smb2_negprot.c
index 18382a9..c04fbca 100644
--- a/source3/smbd/smb2_negprot.c
+++ b/source3/smbd/smb2_negprot.c
@@ -60,7 +60,7 @@ static void reply_smb20xx(struct smb_request *req, uint16_t dialect)
req->outbuf = NULL;
- smbd_smb2_first_negprot(req->xconn, smb2_inpdu, len);
+ smbd_smb2_process_negprot(req->xconn, 0, smb2_inpdu, len);
return;
}
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index 2c1546c..7120ce5 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -3150,8 +3150,9 @@ static NTSTATUS smbd_smb2_request_next_incoming(struct smbXsrv_connection *xconn
return NT_STATUS_OK;
}
-void smbd_smb2_first_negprot(struct smbXsrv_connection *xconn,
- const uint8_t *inpdu, size_t size)
+void smbd_smb2_process_negprot(struct smbXsrv_connection *xconn,
+ uint64_t expected_seq_low,
+ const uint8_t *inpdu, size_t size)
{
struct smbd_server_connection *sconn = xconn->client->sconn;
NTSTATUS status;
--
2.1.0
More information about the samba-technical
mailing list