summaryrefslogtreecommitdiff
path: root/source4/smb_server/smb2/sesssetup.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-12-06 13:26:24 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:47:08 -0500
commit2634f22bfcd5172ae20e9fa0d236aee91c43c1ae (patch)
tree36a16dbf9fb00ee3b1e7b788454022cf947af071 /source4/smb_server/smb2/sesssetup.c
parente5adca67f255555533934c1eb56268af8bd527a3 (diff)
downloadsamba-2634f22bfcd5172ae20e9fa0d236aee91c43c1ae.tar.gz
samba-2634f22bfcd5172ae20e9fa0d236aee91c43c1ae.tar.bz2
samba-2634f22bfcd5172ae20e9fa0d236aee91c43c1ae.zip
r12092: - add dummy functions for the missing SMB2 opcodes
- implement keepalive and logoff metze (This used to be commit 859ab627f45a5acca1deb66b8abdc38eaf49e5a2)
Diffstat (limited to 'source4/smb_server/smb2/sesssetup.c')
-rw-r--r--source4/smb_server/smb2/sesssetup.c57
1 files changed, 49 insertions, 8 deletions
diff --git a/source4/smb_server/smb2/sesssetup.c b/source4/smb_server/smb2/sesssetup.c
index af0c074dac..7915590464 100644
--- a/source4/smb_server/smb2/sesssetup.c
+++ b/source4/smb_server/smb2/sesssetup.c
@@ -27,13 +27,6 @@
#include "smb_server/smb2/smb2_server.h"
#include "smbd/service_stream.h"
-struct smb2srv_session {
- struct smb2srv_session *prev,*next;
- uint64_t uid;
- struct gensec_security *gensec_ctx;
- struct auth_session_info *session_info;
-};
-
static NTSTATUS smb2srv_sesssetup_backend(struct smb2srv_request *req, struct smb2_session_setup *io)
{
NTSTATUS status = NT_STATUS_ACCESS_DENIED;
@@ -134,7 +127,6 @@ static void smb2srv_sesssetup_send(struct smb2srv_request *req, struct smb2_sess
return;
}
- SIVAL(req->out.hdr, SMB2_HDR_STATUS, NT_STATUS_V(req->status));
SBVAL(req->out.hdr, SMB2_HDR_UID, io->out.uid);
SSVAL(req->out.body, 0x02, io->out._pad);
@@ -183,3 +175,52 @@ void smb2srv_sesssetup_recv(struct smb2srv_request *req)
}
smb2srv_sesssetup_send(req, io);
}
+
+static NTSTATUS smb2srv_logoff_backend(struct smb2srv_request *req)
+{
+ /* TODO: call ntvfs backends to close file of this session */
+ talloc_free(req->session);
+ req->session = NULL;
+ return NT_STATUS_OK;
+}
+
+static void smb2srv_logoff_send(struct smb2srv_request *req)
+{
+ NTSTATUS status;
+
+ if (NT_STATUS_IS_ERR(req->status)) {
+ smb2srv_send_error(req, req->status);
+ return;
+ }
+
+ status = smb2srv_setup_reply(req, 0x04, 0);
+ if (!NT_STATUS_IS_OK(status)) {
+ smbsrv_terminate_connection(req->smb_conn, nt_errstr(status));
+ talloc_free(req);
+ return;
+ }
+
+ SSVAL(req->out.body, 0x02, 0);
+
+ smb2srv_send_reply(req);
+}
+
+void smb2srv_logoff_recv(struct smb2srv_request *req)
+{
+ uint16_t _pad;
+
+ if (req->in.body_size < 0x04) {
+ smb2srv_send_error(req, NT_STATUS_FOOBAR);
+ return;
+ }
+
+ _pad = SVAL(req->in.body, 0x02);
+
+ req->status = smb2srv_logoff_backend(req);
+
+ if (req->control_flags & SMB2SRV_REQ_CTRL_FLAG_NOT_REPLY) {
+ talloc_free(req);
+ return;
+ }
+ smb2srv_logoff_send(req);
+}