From b20c00f718c09cc2c9077235488683e0ca98f5bc Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 1 Jul 2006 14:11:00 +0000 Subject: r16732: use the given macros metze (This used to be commit 6d5c74c38ca4d4a605b619cd7cbbd7e1dccd6b0c) --- source4/smb_server/smb2/tcon.c | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-) (limited to 'source4') diff --git a/source4/smb_server/smb2/tcon.c b/source4/smb_server/smb2/tcon.c index b2270640c8..28c505a1fd 100644 --- a/source4/smb_server/smb2/tcon.c +++ b/source4/smb_server/smb2/tcon.c @@ -262,19 +262,12 @@ failed: static void smb2srv_tcon_send(struct smb2srv_request *req, union smb_tcon *io) { - NTSTATUS status; - if (NT_STATUS_IS_ERR(req->status)) { smb2srv_send_error(req, req->status); return; } - 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); - return; - } + SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x10, False, 0)); SBVAL(req->out.hdr, SMB2_HDR_TID, io->smb2.out.tid); @@ -289,28 +282,13 @@ static void smb2srv_tcon_send(struct smb2srv_request *req, union smb_tcon *io) void smb2srv_tcon_recv(struct smb2srv_request *req) { union smb_tcon *io; - NTSTATUS status; - if (req->in.body_size < 0x08) { - smb2srv_send_error(req, NT_STATUS_FOOBAR); - return; - } - - io = talloc(req, union smb_tcon); - if (!io) { - smbsrv_terminate_connection(req->smb_conn, nt_errstr(NT_STATUS_NO_MEMORY)); - talloc_free(req); - return; - } + SMB2SRV_CHECK_BODY_SIZE(req, 0x08, True); + SMB2SRV_TALLOC_IO_PTR(io, union smb_tcon); io->smb2.level = RAW_TCON_SMB2; io->smb2.in.unknown1 = SVAL(req->in.body, 0x02); - status = smb2_pull_o16s16_string(&req->in, io, req->in.body+0x04, &io->smb2.in.path); - if (!NT_STATUS_IS_OK(status)) { - smbsrv_terminate_connection(req->smb_conn, nt_errstr(status)); - talloc_free(req); - return; - } + SMB2SRV_CHECK(smb2_pull_o16s16_string(&req->in, io, req->in.body+0x04, &io->smb2.in.path)); req->status = smb2srv_tcon_backend(req, io); @@ -354,10 +332,7 @@ void smb2srv_tdis_recv(struct smb2srv_request *req) { uint16_t _pad; - if (req->in.body_size < 0x04) { - smb2srv_send_error(req, NT_STATUS_FOOBAR); - return; - } + SMB2SRV_CHECK_BODY_SIZE(req, 0x04, False); _pad = SVAL(req->in.body, 0x02); -- cgit