From dc86ab3e454d7219608d01879145dec5609acaa3 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 11 May 2006 10:47:37 +0000 Subject: r15532: add a BOOL body_dynamic_present, because the body_dynamic_size can be 0 also if the dynamic flag should be set metze (This used to be commit 7829100e1ee79f4f5d24004af221288e19c09b3e) --- source4/smb_server/smb2/keepalive.c | 2 +- source4/smb_server/smb2/negprot.c | 2 +- source4/smb_server/smb2/receive.c | 13 +++++++++++-- source4/smb_server/smb2/sesssetup.c | 4 ++-- source4/smb_server/smb2/tcon.c | 4 ++-- 5 files changed, 17 insertions(+), 8 deletions(-) (limited to 'source4/smb_server/smb2') diff --git a/source4/smb_server/smb2/keepalive.c b/source4/smb_server/smb2/keepalive.c index ca8983d5e2..4994af4a0d 100644 --- a/source4/smb_server/smb2/keepalive.c +++ b/source4/smb_server/smb2/keepalive.c @@ -39,7 +39,7 @@ static void smb2srv_keepalive_send(struct smb2srv_request *req) return; } - status = smb2srv_setup_reply(req, 0x04, 0); + status = smb2srv_setup_reply(req, 0x04, False, 0); if (!NT_STATUS_IS_OK(status)) { smbsrv_terminate_connection(req->smb_conn, nt_errstr(status)); talloc_free(req); diff --git a/source4/smb_server/smb2/negprot.c b/source4/smb_server/smb2/negprot.c index 351c9e718f..6d180eb1d6 100644 --- a/source4/smb_server/smb2/negprot.c +++ b/source4/smb_server/smb2/negprot.c @@ -117,7 +117,7 @@ static void smb2srv_negprot_send(struct smb2srv_request *req, struct smb2_negpro return; } - status = smb2srv_setup_reply(req, 0x40, io->out.secblob.length); + status = smb2srv_setup_reply(req, 0x40, True, io->out.secblob.length); if (!NT_STATUS_IS_OK(status)) { smbsrv_terminate_connection(req->smb_conn, nt_errstr(status)); talloc_free(req); diff --git a/source4/smb_server/smb2/receive.c b/source4/smb_server/smb2/receive.c index e27e622a4a..abd825adcc 100644 --- a/source4/smb_server/smb2/receive.c +++ b/source4/smb_server/smb2/receive.c @@ -41,8 +41,17 @@ static struct smb2srv_request *smb2srv_init_request(struct smbsrv_connection *sm return req; } -NTSTATUS smb2srv_setup_reply(struct smb2srv_request *req, uint_t body_fixed_size, size_t body_dynamic_size) +NTSTATUS smb2srv_setup_reply(struct smb2srv_request *req, uint16_t body_fixed_size, + BOOL body_dynamic_present, uint32_t body_dynamic_size) { + if (body_dynamic_present) { + if (body_dynamic_size == 0) { + body_dynamic_size = 1; + } + } else { + body_dynamic_size = 0; + } + req->out.size = SMB2_HDR_BODY+NBT_HDR_SIZE+body_fixed_size; req->out.allocated = req->out.size + body_dynamic_size; @@ -103,7 +112,7 @@ void smb2srv_send_error(struct smb2srv_request *req, NTSTATUS error) { NTSTATUS status; - status = smb2srv_setup_reply(req, 8, 1); + status = smb2srv_setup_reply(req, 8, True, 0); if (!NT_STATUS_IS_OK(status)) { smbsrv_terminate_connection(req->smb_conn, nt_errstr(status)); talloc_free(req); diff --git a/source4/smb_server/smb2/sesssetup.c b/source4/smb_server/smb2/sesssetup.c index 6d94d43155..a5b9cf50bd 100644 --- a/source4/smb_server/smb2/sesssetup.c +++ b/source4/smb_server/smb2/sesssetup.c @@ -126,7 +126,7 @@ static void smb2srv_sesssetup_send(struct smb2srv_request *req, struct smb2_sess return; } - status = smb2srv_setup_reply(req, 0x08, io->out.secblob.length); + status = smb2srv_setup_reply(req, 0x08, True, io->out.secblob.length); if (!NT_STATUS_IS_OK(status)) { smbsrv_terminate_connection(req->smb_conn, nt_errstr(status)); talloc_free(req); @@ -199,7 +199,7 @@ static void smb2srv_logoff_send(struct smb2srv_request *req) return; } - status = smb2srv_setup_reply(req, 0x04, 0); + status = smb2srv_setup_reply(req, 0x04, False, 0); if (!NT_STATUS_IS_OK(status)) { smbsrv_terminate_connection(req->smb_conn, nt_errstr(status)); talloc_free(req); diff --git a/source4/smb_server/smb2/tcon.c b/source4/smb_server/smb2/tcon.c index 8d6c002d50..ba7758b362 100644 --- a/source4/smb_server/smb2/tcon.c +++ b/source4/smb_server/smb2/tcon.c @@ -54,7 +54,7 @@ static void smb2srv_tcon_send(struct smb2srv_request *req, struct smb2_tree_conn return; } - status = smb2srv_setup_reply(req, 0x10, 0); + status = smb2srv_setup_reply(req, 0x10, False, 0); if (!NT_STATUS_IS_OK(status)) { smbsrv_terminate_connection(req->smb_conn, nt_errstr(status)); talloc_free(req); @@ -122,7 +122,7 @@ static void smb2srv_tdis_send(struct smb2srv_request *req) return; } - status = smb2srv_setup_reply(req, 0x04, 0); + status = smb2srv_setup_reply(req, 0x04, False, 0); if (!NT_STATUS_IS_OK(status)) { smbsrv_terminate_connection(req->smb_conn, nt_errstr(status)); talloc_free(req); -- cgit