diff options
author | Stefan Metzmacher <metze@samba.org> | 2009-05-22 12:42:24 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2009-05-22 14:03:14 +0200 |
commit | 202509a3479b7bba9a5dfce58270fb8f46cc496a (patch) | |
tree | ae20740f7f0f8782d9372d788d29e6fe3a991644 /source3/smbd | |
parent | 7dfbb2835f395105982c8e42529c468de3cffcb4 (diff) | |
download | samba-202509a3479b7bba9a5dfce58270fb8f46cc496a.tar.gz samba-202509a3479b7bba9a5dfce58270fb8f46cc496a.tar.bz2 samba-202509a3479b7bba9a5dfce58270fb8f46cc496a.zip |
s3:smbd: implement SMB2 Tree Disconnect
metze
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/globals.h | 1 | ||||
-rw-r--r-- | source3/smbd/smb2_server.c | 2 | ||||
-rw-r--r-- | source3/smbd/smb2_tcon.c | 36 |
3 files changed, 38 insertions, 1 deletions
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h index a26311e7da..9d5eead939 100644 --- a/source3/smbd/globals.h +++ b/source3/smbd/globals.h @@ -229,6 +229,7 @@ NTSTATUS smbd_smb2_request_process_negprot(struct smbd_smb2_request *req); NTSTATUS smbd_smb2_request_process_sesssetup(struct smbd_smb2_request *req); NTSTATUS smbd_smb2_request_process_logoff(struct smbd_smb2_request *req); NTSTATUS smbd_smb2_request_process_tcon(struct smbd_smb2_request *req); +NTSTATUS smbd_smb2_request_process_tdis(struct smbd_smb2_request *req); NTSTATUS smbd_smb2_request_process_keepalive(struct smbd_smb2_request *req); struct smbd_smb2_request { diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index a11ffd7624..32bb5543ae 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -326,7 +326,7 @@ static NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) if (!NT_STATUS_IS_OK(status)) { return smbd_smb2_request_error(req, status); } - return smbd_smb2_request_error(req, NT_STATUS_NOT_IMPLEMENTED); + return smbd_smb2_request_process_tdis(req); case SMB2_OP_CREATE: status = smbd_smb2_request_check_session(req); diff --git a/source3/smbd/smb2_tcon.c b/source3/smbd/smb2_tcon.c index 895677c984..f74d1bcca7 100644 --- a/source3/smbd/smb2_tcon.c +++ b/source3/smbd/smb2_tcon.c @@ -194,3 +194,39 @@ NTSTATUS smbd_smb2_request_check_tcon(struct smbd_smb2_request *req) req->tcon = tcon; return NT_STATUS_OK; } + +NTSTATUS smbd_smb2_request_process_tdis(struct smbd_smb2_request *req) +{ + const uint8_t *inbody; + int i = req->current_idx; + DATA_BLOB outbody; + size_t expected_body_size = 0x04; + size_t body_size; + + if (req->in.vector[i+1].iov_len != (expected_body_size & 0xFFFFFFFE)) { + return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER); + } + + inbody = (const uint8_t *)req->in.vector[i+1].iov_base; + + body_size = SVAL(inbody, 0x00); + if (body_size != expected_body_size) { + return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER); + } + + /* + * TODO: cancel all outstanding requests on the tcon + * and delete all file handles. + */ + TALLOC_FREE(req->tcon); + + outbody = data_blob_talloc(req->out.vector, NULL, 0x04); + if (outbody.data == NULL) { + return smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY); + } + + SSVAL(outbody.data, 0x00, 0x04); /* struct size */ + SSVAL(outbody.data, 0x02, 0); /* reserved */ + + return smbd_smb2_request_done(req, outbody, NULL); +} |