summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-08-07 13:02:14 +0200
committerStefan Metzmacher <metze@samba.org>2012-08-07 18:32:47 +0200
commit40f771e0105a0d13d83d66d99d9412acf6b73978 (patch)
tree5bec721ff7558a53bc37d15aed76f21ee63e8cb5 /source3/smbd
parent8d63efe27397f0f45b774e04e6146f87a84ba799 (diff)
downloadsamba-40f771e0105a0d13d83d66d99d9412acf6b73978.tar.gz
samba-40f771e0105a0d13d83d66d99d9412acf6b73978.tar.bz2
samba-40f771e0105a0d13d83d66d99d9412acf6b73978.zip
s3:smb2_server: there's no need to copy req->out.vector when we just keep the last request
metze
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/smb2_server.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index fe94d9d658..f439cd7e5f 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -1225,28 +1225,11 @@ NTSTATUS smbd_smb2_request_pending_queue(struct smbd_smb2_request *req,
/* Reset the new in size. */
smb2_setup_nbt_length(req->in.vector, req->in.vector_count);
- /* Now recreate the out.vectors. */
- outvec = talloc_zero_array(req, struct iovec, 4);
- if (!outvec) {
- return NT_STATUS_NO_MEMORY;
- }
-
- /* 0 is always boilerplate and must
- * be of size 4 for the length field. */
-
- outvec[0].iov_base = req->out.nbt_hdr;
- outvec[0].iov_len = 4;
- SIVAL(req->out.nbt_hdr, 0, 0);
-
- if (!dup_smb2_vec3(outvec, &outvec[1], &req->out.vector[i])) {
- return NT_STATUS_NO_MEMORY;
- }
-
- TALLOC_FREE(req->out.vector);
-
- req->out.vector = outvec;
-
- req->out.vector_count = 4;
+ /* Re-arrange the out.vectors. */
+ memmove(&req->out.vector[req->current_idx],
+ &req->out.vector[i],
+ sizeof(req->out.vector[0])*SMBD_SMB2_NUM_IOV_PER_REQ);
+ req->out.vector_count = req->current_idx + SMBD_SMB2_NUM_IOV_PER_REQ;
outhdr = SMBD_SMB2_OUT_HDR_PTR(req);
flags = (IVAL(outhdr, SMB2_HDR_FLAGS) & ~SMB2_HDR_FLAG_CHAINED);