summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-05-10 13:47:46 +0200
committerStefan Metzmacher <metze@samba.org>2012-05-11 20:15:37 +0200
commitc11c4df762fd9e17bc8c5a422528bb80eae85e21 (patch)
tree38d29569622405554c21d9cd5f99bd95d3b2f6e7
parent7e7c4ba6f856488e4efc2c654b0073dbd8cc264a (diff)
downloadsamba-c11c4df762fd9e17bc8c5a422528bb80eae85e21.tar.gz
samba-c11c4df762fd9e17bc8c5a422528bb80eae85e21.tar.bz2
samba-c11c4df762fd9e17bc8c5a422528bb80eae85e21.zip
s3:smb2_ioctl: allow functions to disconnect the smb connection
metze Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Fri May 11 20:15:37 CEST 2012 on sn-devel-104
-rw-r--r--source3/smbd/smb2_ioctl.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/source3/smbd/smb2_ioctl.c b/source3/smbd/smb2_ioctl.c
index a66eedc8aa..4bbb8aecb1 100644
--- a/source3/smbd/smb2_ioctl.c
+++ b/source3/smbd/smb2_ioctl.c
@@ -36,7 +36,8 @@ static struct tevent_req *smbd_smb2_ioctl_send(TALLOC_CTX *mem_ctx,
uint32_t in_flags);
static NTSTATUS smbd_smb2_ioctl_recv(struct tevent_req *req,
TALLOC_CTX *mem_ctx,
- DATA_BLOB *out_output);
+ DATA_BLOB *out_output,
+ bool *disconnect);
static void smbd_smb2_request_ioctl_done(struct tevent_req *subreq);
NTSTATUS smbd_smb2_request_process_ioctl(struct smbd_smb2_request *req)
@@ -129,8 +130,11 @@ static void smbd_smb2_request_ioctl_done(struct tevent_req *subreq)
DATA_BLOB out_output_buffer = data_blob_null;
NTSTATUS status;
NTSTATUS error; /* transport error */
+ bool disconnect = false;
- status = smbd_smb2_ioctl_recv(subreq, req, &out_output_buffer);
+ status = smbd_smb2_ioctl_recv(subreq, req,
+ &out_output_buffer,
+ &disconnect);
DEBUG(10,("smbd_smb2_request_ioctl_done: smbd_smb2_ioctl_recv returned "
"%u status %s\n",
@@ -138,6 +142,13 @@ static void smbd_smb2_request_ioctl_done(struct tevent_req *subreq)
nt_errstr(status) ));
TALLOC_FREE(subreq);
+ if (disconnect) {
+ error = status;
+ smbd_server_connection_terminate(req->sconn,
+ nt_errstr(error));
+ return;
+ }
+
if (NT_STATUS_EQUAL(status, STATUS_BUFFER_OVERFLOW)) {
/* also ok */
} else if (!NT_STATUS_IS_OK(status)) {
@@ -211,6 +222,7 @@ struct smbd_smb2_ioctl_state {
DATA_BLOB in_input;
uint32_t in_max_output;
DATA_BLOB out_output;
+ bool disconnect;
};
static void smbd_smb2_ioctl_pipe_write_done(struct tevent_req *subreq);
@@ -502,12 +514,15 @@ static void smbd_smb2_ioctl_pipe_read_done(struct tevent_req *subreq)
static NTSTATUS smbd_smb2_ioctl_recv(struct tevent_req *req,
TALLOC_CTX *mem_ctx,
- DATA_BLOB *out_output)
+ DATA_BLOB *out_output,
+ bool *disconnect)
{
NTSTATUS status = NT_STATUS_OK;
struct smbd_smb2_ioctl_state *state = tevent_req_data(req,
struct smbd_smb2_ioctl_state);
+ *disconnect = state->disconnect;
+
if (tevent_req_is_nterror(req, &status)) {
if (!NT_STATUS_EQUAL(status, STATUS_BUFFER_OVERFLOW)) {
tevent_req_received(req);