summaryrefslogtreecommitdiffstats
path: root/source3
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-05-20 19:35:39 +0200
committerStefan Metzmacher <metze@samba.org>2009-05-20 20:53:31 +0200
commiteac12355196cbf15d8bc51109a12c65efc34ffde (patch)
tree57e09ece28e940819526845754867d31cd31a560 /source3
parentc4b41c56498bea40baf152e2ee23f9850710891d (diff)
downloadsamba-eac12355196cbf15d8bc51109a12c65efc34ffde.tar.gz
samba-eac12355196cbf15d8bc51109a12c65efc34ffde.tar.xz
samba-eac12355196cbf15d8bc51109a12c65efc34ffde.zip
s3:smbd: add smbd_smb2_request_done_ex()
Some times we have to return a non-error response with status != NT_STATUS_OK. metze
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/globals.h3
-rw-r--r--source3/smbd/smb2_server.c18
2 files changed, 16 insertions, 5 deletions
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index c5dd97c7c84..93075ad9017 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -214,6 +214,9 @@ NTSTATUS smbd_smb2_request_error_ex(struct smbd_smb2_request *req,
NTSTATUS status, DATA_BLOB *info);
NTSTATUS smbd_smb2_request_error(struct smbd_smb2_request *req,
NTSTATUS status);
+NTSTATUS smbd_smb2_request_done_ex(struct smbd_smb2_request *req,
+ NTSTATUS status,
+ DATA_BLOB body, DATA_BLOB *dyn);
NTSTATUS smbd_smb2_request_done(struct smbd_smb2_request *req,
DATA_BLOB body, DATA_BLOB *dyn);
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index 095b1f0cd7e..c4c5492e5fd 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -436,16 +436,18 @@ NTSTATUS smbd_smb2_request_error(struct smbd_smb2_request *req,
return smbd_smb2_request_error_ex(req, status, NULL);
}
-NTSTATUS smbd_smb2_request_done(struct smbd_smb2_request *req,
- DATA_BLOB body, DATA_BLOB *dyn)
+NTSTATUS smbd_smb2_request_done_ex(struct smbd_smb2_request *req,
+ NTSTATUS status,
+ DATA_BLOB body, DATA_BLOB *dyn)
{
uint8_t *outhdr;
uint8_t *outdyn;
int i = req->current_idx;
uint32_t next_command_ofs;
- DEBUG(10,("smbd_smb2_request_done: idx[%d] body[%u] dyn[%s:%u]\n",
- i, (unsigned int)body.length,
+ DEBUG(10,("smbd_smb2_request_done_ex: "
+ "idx[%d] status[%s] body[%u] dyn[%s:%u]\n",
+ i, nt_errstr(status), (unsigned int)body.length,
dyn ? "yes": "no",
(unsigned int)(dyn ? dyn->length : 0)));
@@ -462,7 +464,7 @@ NTSTATUS smbd_smb2_request_done(struct smbd_smb2_request *req,
outdyn = outhdr + SMB2_HDR_BODY + 8;
next_command_ofs = SIVAL(outhdr, SMB2_HDR_NEXT_COMMAND, 0);
- SIVAL(outhdr, SMB2_HDR_STATUS, NT_STATUS_V(NT_STATUS_OK));
+ SIVAL(outhdr, SMB2_HDR_STATUS, NT_STATUS_V(status));
req->out.vector[i+1].iov_base = (void *)body.data;
req->out.vector[i+1].iov_len = body.length;
@@ -498,6 +500,12 @@ NTSTATUS smbd_smb2_request_done(struct smbd_smb2_request *req,
return smbd_smb2_request_reply(req);
}
+NTSTATUS smbd_smb2_request_done(struct smbd_smb2_request *req,
+ DATA_BLOB body, DATA_BLOB *dyn)
+{
+ return smbd_smb2_request_done_ex(req, NT_STATUS_OK, body, dyn);
+}
+
static void smbd_smb2_request_dispatch_compound(struct tevent_req *subreq)
{
struct smbd_smb2_request *req = tevent_req_callback_data(subreq,