summaryrefslogtreecommitdiff
path: root/source4/smb_server/request.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-10-29 03:48:49 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:04:58 -0500
commit4676de010f1b1680ce70e2e4ae1eb4af4de26695 (patch)
treed644f08c06d50a5ceb587651e07ed45855ef84ee /source4/smb_server/request.c
parentae3b7ef161fcf248f551a2f1ac9d1052f932b3a0 (diff)
downloadsamba-4676de010f1b1680ce70e2e4ae1eb4af4de26695.tar.gz
samba-4676de010f1b1680ce70e2e4ae1eb4af4de26695.tar.bz2
samba-4676de010f1b1680ce70e2e4ae1eb4af4de26695.zip
r3350: fixed a bug with sending multiple replies for the one request, as
happens with trans2, trans and echo. Now that smbd is async we queue the multiples replies all at once, and now need a way to ensure each reply gets it own smbsrv_request buffer. I have added req_setup_secondary() to cope with this. (This used to be commit 2dbd2abc5f197ee21d7dceeda2922c7449c46d99)
Diffstat (limited to 'source4/smb_server/request.c')
-rw-r--r--source4/smb_server/request.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/source4/smb_server/request.c b/source4/smb_server/request.c
index 5b137b4c53..5d5b397dd3 100644
--- a/source4/smb_server/request.c
+++ b/source4/smb_server/request.c
@@ -155,6 +155,37 @@ void req_setup_reply(struct smbsrv_request *req, uint_t wct, uint_t buflen)
}
}
+
+/*
+ setup a copy of a request, used when the server needs to send
+ more than one reply for a single request packet
+*/
+struct smbsrv_request *req_setup_secondary(struct smbsrv_request *old_req)
+{
+ struct smbsrv_request *req;
+ ptrdiff_t diff;
+
+ req = talloc_memdup(old_req, old_req, sizeof(struct smbsrv_request));
+ if (req == NULL) {
+ return NULL;
+ }
+
+ req->out.buffer = talloc_memdup(req, req->out.buffer, req->out.allocated);
+ if (req->out.buffer == NULL) {
+ talloc_free(req);
+ return NULL;
+ }
+
+ diff = req->out.buffer - old_req->out.buffer;
+
+ req->out.hdr += diff;
+ req->out.vwv += diff;
+ req->out.data += diff;
+ req->out.ptr += diff;
+
+ return req;
+}
+
/*
work out the maximum data size we will allow for this reply, given
the negotiated max_xmit. The basic reply packet must be setup before