From ddaa65ef6e049a185281c4d5deca4045e3b085e2 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 21 Nov 2008 23:17:31 +0100 Subject: Correctly calculate the offset for read&x --- source3/smbd/process.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'source3/smbd/process.c') diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 3547bfcc3a..1701cd33da 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -1822,6 +1822,25 @@ void chain_reply(struct smb_request *req) #else +/* + * How many bytes have we already accumulated up to the current wct field + * offset? + */ + +size_t req_wct_ofs(struct smb_request *req) +{ + size_t buf_size; + + if (req->chain_outbuf == NULL) { + return smb_wct - 4; + } + buf_size = talloc_get_size(req->chain_outbuf); + if ((buf_size % 4) != 0) { + buf_size += (4 - (buf_size % 4)); + } + return buf_size - 4; +} + /* * Hack around reply_nterror & friends not being aware of chained requests, * generating illegal (i.e. wct==0) chain replies. -- cgit