summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-12-19 18:12:44 +0100
committerVolker Lendecke <vl@samba.org>2008-12-19 18:12:44 +0100
commitfa5f11279bda32dcb9a85c74b2b4a967a8e52104 (patch)
treef889ea95bacb7b6b41757b91c824119bf034ab73 /source3/libsmb
parentae0c6cff25c2be64fb5d19e738e449f845551d8c (diff)
downloadsamba-fa5f11279bda32dcb9a85c74b2b4a967a8e52104.tar.gz
samba-fa5f11279bda32dcb9a85c74b2b4a967a8e52104.tar.bz2
samba-fa5f11279bda32dcb9a85c74b2b4a967a8e52104.zip
Add the cli_wct_ofs routine to calculate the offset for write&x
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/async_smb.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c
index fdcbb00206..52bfc75009 100644
--- a/source3/libsmb/async_smb.c
+++ b/source3/libsmb/async_smb.c
@@ -639,6 +639,37 @@ struct async_req *cli_request_send(TALLOC_CTX *mem_ctx,
}
/**
+ * Calculate the current ofs to wct for requests like write&x
+ * @param[in] req The smb request we're currently building
+ * @retval how many bytes offset have we accumulated?
+ */
+
+uint16_t cli_wct_ofs(const struct cli_state *cli)
+{
+ size_t buf_size;
+
+ if (cli->chain_accumulator == NULL) {
+ return smb_wct - 4;
+ }
+
+ buf_size = talloc_get_size(cli->chain_accumulator->outbuf);
+
+ if (buf_size == smb_wct) {
+ return smb_wct - 4;
+ }
+
+ /*
+ * Add alignment for subsequent requests
+ */
+
+ if ((buf_size % 4) != 0) {
+ buf_size += (4 - (buf_size % 4));
+ }
+
+ return buf_size - 4;
+}
+
+/**
* Figure out if there is an andx command behind the current one
* @param[in] buf The smb buffer to look at
* @param[in] ofs The offset to the wct field that is followed by the cmd