From a399cd3cea5efb644785ca63052ff18b765d5888 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 25 Nov 2005 11:04:42 +0000 Subject: r11901: added smb2_logoff() support (metze correctly guessed opcode 2 was logoff) (This used to be commit 6884ce66f2881eba834b419370f74111852fe022) --- source4/libcli/smb2/logoff.c | 67 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 source4/libcli/smb2/logoff.c (limited to 'source4/libcli/smb2/logoff.c') diff --git a/source4/libcli/smb2/logoff.c b/source4/libcli/smb2/logoff.c new file mode 100644 index 0000000000..a73c7ee92e --- /dev/null +++ b/source4/libcli/smb2/logoff.c @@ -0,0 +1,67 @@ +/* + Unix SMB/CIFS implementation. + + SMB2 client logoff handling + + Copyright (C) Andrew Tridgell 2005 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" +#include "libcli/raw/libcliraw.h" +#include "libcli/smb2/smb2.h" +#include "libcli/smb2/smb2_calls.h" + +/* + send a logoff request +*/ +struct smb2_request *smb2_logoff_send(struct smb2_tree *tree) +{ + struct smb2_request *req; + + req = smb2_request_init_tree(tree, SMB2_OP_LOGOFF, 0x04, 0); + if (req == NULL) return NULL; + + SSVAL(req->out.body, 0x02, 0); + + smb2_transport_send(req); + + return req; +} + + +/* + recv a logoff reply +*/ +NTSTATUS smb2_logoff_recv(struct smb2_request *req) +{ + if (!smb2_request_receive(req) || + smb2_request_is_error(req)) { + return smb2_request_destroy(req); + } + + SMB2_CHECK_PACKET_RECV(req, 0x04, False); + return smb2_request_destroy(req); +} + +/* + sync logoff request +*/ +NTSTATUS smb2_logoff(struct smb2_tree *tree) +{ + struct smb2_request *req = smb2_logoff_send(tree); + return smb2_logoff_recv(req); +} -- cgit From 89f5d66dfeb02ad626ad21c4c4c7800560f83676 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 7 Dec 2005 07:28:43 +0000 Subject: r12114: - smb2_keepalive() acts on the smb2_transport - smb2_logoff() acts on the smb2_session metze (This used to be commit ae1ca2bb4affefff1026c03f0765faf28c2b316b) --- source4/libcli/smb2/logoff.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'source4/libcli/smb2/logoff.c') diff --git a/source4/libcli/smb2/logoff.c b/source4/libcli/smb2/logoff.c index a73c7ee92e..febe0d6b45 100644 --- a/source4/libcli/smb2/logoff.c +++ b/source4/libcli/smb2/logoff.c @@ -28,13 +28,15 @@ /* send a logoff request */ -struct smb2_request *smb2_logoff_send(struct smb2_tree *tree) +struct smb2_request *smb2_logoff_send(struct smb2_session *session) { struct smb2_request *req; - req = smb2_request_init_tree(tree, SMB2_OP_LOGOFF, 0x04, 0); + req = smb2_request_init(session->transport, SMB2_OP_LOGOFF, 0x04, 0); if (req == NULL) return NULL; + SBVAL(req->out.hdr, SMB2_HDR_UID, session->uid); + SSVAL(req->out.body, 0x02, 0); smb2_transport_send(req); @@ -60,8 +62,8 @@ NTSTATUS smb2_logoff_recv(struct smb2_request *req) /* sync logoff request */ -NTSTATUS smb2_logoff(struct smb2_tree *tree) +NTSTATUS smb2_logoff(struct smb2_session *session) { - struct smb2_request *req = smb2_logoff_send(tree); + struct smb2_request *req = smb2_logoff_send(session); return smb2_logoff_recv(req); } -- cgit From d4de4c2d210d2e8c9b5aedf70695594809ad6a0b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 30 Dec 2005 13:16:54 +0000 Subject: r12608: Remove some unused #include lines. (This used to be commit 70e7449318aa0e9d2639c76730a7d1683b2f4981) --- source4/libcli/smb2/logoff.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source4/libcli/smb2/logoff.c') diff --git a/source4/libcli/smb2/logoff.c b/source4/libcli/smb2/logoff.c index febe0d6b45..ba0e691e8b 100644 --- a/source4/libcli/smb2/logoff.c +++ b/source4/libcli/smb2/logoff.c @@ -21,9 +21,7 @@ */ #include "includes.h" -#include "libcli/raw/libcliraw.h" #include "libcli/smb2/smb2.h" -#include "libcli/smb2/smb2_calls.h" /* send a logoff request -- cgit From 63d718e243fd03e6ea24c47e7442975ec088a5b5 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 3 Jan 2006 17:27:33 +0000 Subject: r12696: Reduce the size of include/structs.h (This used to be commit 63917616016133c623fc6ff59454bc313ee7dd8f) --- source4/libcli/smb2/logoff.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/libcli/smb2/logoff.c') diff --git a/source4/libcli/smb2/logoff.c b/source4/libcli/smb2/logoff.c index ba0e691e8b..977c1e57af 100644 --- a/source4/libcli/smb2/logoff.c +++ b/source4/libcli/smb2/logoff.c @@ -22,6 +22,7 @@ #include "includes.h" #include "libcli/smb2/smb2.h" +#include "libcli/smb2/smb2_calls.h" /* send a logoff request -- cgit 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/libcli/smb2/logoff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libcli/smb2/logoff.c') diff --git a/source4/libcli/smb2/logoff.c b/source4/libcli/smb2/logoff.c index 977c1e57af..cfaa389ef8 100644 --- a/source4/libcli/smb2/logoff.c +++ b/source4/libcli/smb2/logoff.c @@ -31,7 +31,7 @@ struct smb2_request *smb2_logoff_send(struct smb2_session *session) { struct smb2_request *req; - req = smb2_request_init(session->transport, SMB2_OP_LOGOFF, 0x04, 0); + req = smb2_request_init(session->transport, SMB2_OP_LOGOFF, 0x04, False, 0); if (req == NULL) return NULL; SBVAL(req->out.hdr, SMB2_HDR_UID, session->uid); -- cgit From bd1efc1235b647f6845fb7d6218cf2b4068e9f0a Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 29 Jun 2006 11:08:27 +0000 Subject: r16669: this calls don't expect any valid error codes than NT_STATUS_OK metze (This used to be commit 429215113bd999466141df0a2e3b3097d677df1f) --- source4/libcli/smb2/logoff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libcli/smb2/logoff.c') diff --git a/source4/libcli/smb2/logoff.c b/source4/libcli/smb2/logoff.c index cfaa389ef8..67129319fb 100644 --- a/source4/libcli/smb2/logoff.c +++ b/source4/libcli/smb2/logoff.c @@ -50,7 +50,7 @@ struct smb2_request *smb2_logoff_send(struct smb2_session *session) NTSTATUS smb2_logoff_recv(struct smb2_request *req) { if (!smb2_request_receive(req) || - smb2_request_is_error(req)) { + !smb2_request_is_ok(req)) { return smb2_request_destroy(req); } -- cgit From 0479a2f1cbae51fcd8dbdc3c148c808421fb4d25 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 02:07:03 +0000 Subject: r23792: convert Samba4 to GPLv3 There are still a few tidyups of old FSF addresses to come (in both s3 and s4). More commits soon. (This used to be commit fcf38a38ac691abd0fa51b89dc951a08e89fdafa) --- source4/libcli/smb2/logoff.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/libcli/smb2/logoff.c') diff --git a/source4/libcli/smb2/logoff.c b/source4/libcli/smb2/logoff.c index 67129319fb..00d5e19e82 100644 --- a/source4/libcli/smb2/logoff.c +++ b/source4/libcli/smb2/logoff.c @@ -7,7 +7,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -16,8 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #include "includes.h" -- cgit From 2151cde58014ea2e822c13d2f8a369b45dc19ca8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 6 Oct 2007 22:28:14 +0000 Subject: r25554: Convert last instances of BOOL, True and False to the standard types. (This used to be commit 566aa14139510788548a874e9213d91317f83ca9) --- source4/libcli/smb2/logoff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/libcli/smb2/logoff.c') diff --git a/source4/libcli/smb2/logoff.c b/source4/libcli/smb2/logoff.c index 00d5e19e82..321a4db1a6 100644 --- a/source4/libcli/smb2/logoff.c +++ b/source4/libcli/smb2/logoff.c @@ -30,7 +30,7 @@ struct smb2_request *smb2_logoff_send(struct smb2_session *session) { struct smb2_request *req; - req = smb2_request_init(session->transport, SMB2_OP_LOGOFF, 0x04, False, 0); + req = smb2_request_init(session->transport, SMB2_OP_LOGOFF, 0x04, false, 0); if (req == NULL) return NULL; SBVAL(req->out.hdr, SMB2_HDR_UID, session->uid); @@ -53,7 +53,7 @@ NTSTATUS smb2_logoff_recv(struct smb2_request *req) return smb2_request_destroy(req); } - SMB2_CHECK_PACKET_RECV(req, 0x04, False); + SMB2_CHECK_PACKET_RECV(req, 0x04, false); return smb2_request_destroy(req); } -- cgit From a2505c5a2cc2b7b692ffbcdd8c6b86000a15d2c7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 12 Feb 2008 17:00:35 +1100 Subject: updated SMB2 header defines to match WSPP docs (This used to be commit d2c6ad55eca27f50a38fc6e2a85032eddb3f0aae) --- source4/libcli/smb2/logoff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libcli/smb2/logoff.c') diff --git a/source4/libcli/smb2/logoff.c b/source4/libcli/smb2/logoff.c index 321a4db1a6..b38a08ca43 100644 --- a/source4/libcli/smb2/logoff.c +++ b/source4/libcli/smb2/logoff.c @@ -33,7 +33,7 @@ struct smb2_request *smb2_logoff_send(struct smb2_session *session) req = smb2_request_init(session->transport, SMB2_OP_LOGOFF, 0x04, false, 0); if (req == NULL) return NULL; - SBVAL(req->out.hdr, SMB2_HDR_UID, session->uid); + SBVAL(req->out.hdr, SMB2_HDR_SESSION_ID, session->uid); SSVAL(req->out.body, 0x02, 0); -- cgit From 4355b31730f900fcae1ccb58df4feb387489e1e9 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 9 Jun 2008 21:41:06 +0200 Subject: libcli/smb2: sign SMB2 Logoff requests metze (This used to be commit 35ee165b146b9157b0cff49e1139a0cb37d98926) --- source4/libcli/smb2/logoff.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source4/libcli/smb2/logoff.c') diff --git a/source4/libcli/smb2/logoff.c b/source4/libcli/smb2/logoff.c index b38a08ca43..e3f83f27d8 100644 --- a/source4/libcli/smb2/logoff.c +++ b/source4/libcli/smb2/logoff.c @@ -33,6 +33,8 @@ struct smb2_request *smb2_logoff_send(struct smb2_session *session) req = smb2_request_init(session->transport, SMB2_OP_LOGOFF, 0x04, false, 0); if (req == NULL) return NULL; + req->session = session; + SBVAL(req->out.hdr, SMB2_HDR_SESSION_ID, session->uid); SSVAL(req->out.body, 0x02, 0); -- cgit