summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2012-02-24 16:16:23 +0100
committerVolker Lendecke <vl@samba.org>2012-02-24 16:34:34 +0100
commitda322e4f3f0967bd65ec0f4cfbea83d9e8ccd77e (patch)
tree00d96f5476253fb3298ac5fe58aeb619b7733247 /source3/smbd
parent947a8bc44afc47961e2477ce0b7d8a16573b0f97 (diff)
downloadsamba-da322e4f3f0967bd65ec0f4cfbea83d9e8ccd77e.tar.gz
samba-da322e4f3f0967bd65ec0f4cfbea83d9e8ccd77e.tar.bz2
samba-da322e4f3f0967bd65ec0f4cfbea83d9e8ccd77e.zip
s3: Simplify smb_splice_chain
We use it in smbd/process.c only now. This only splices in finished buffers, both callers used the same arguments. Pull that into the routine itself.
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/process.c36
1 files changed, 11 insertions, 25 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 3214cbae0c..3b94d4a56d 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -1775,22 +1775,18 @@ static bool find_andx_cmd_ofs(uint8_t *buf, size_t *pofs)
/**
* @brief Do the smb chaining at a buffer level
* @param[in] poutbuf Pointer to the talloc'ed buffer to be modified
- * @param[in] smb_command The command that we want to issue
- * @param[in] wct How many words?
- * @param[in] vwv The words, already in network order
- * @param[in] bytes_alignment How shall we align "bytes"?
- * @param[in] num_bytes How many bytes?
- * @param[in] bytes The data the request ships
- *
- * smb_splice_chain() adds the vwv and bytes to the request already present in
- * *poutbuf.
+ * @param[in] andx_buf Buffer to be appended
*/
-static bool smb_splice_chain(uint8_t **poutbuf, uint8_t smb_command,
- uint8_t wct, const uint16_t *vwv,
- size_t bytes_alignment,
- uint32_t num_bytes, const uint8_t *bytes)
+static bool smb_splice_chain(uint8_t **poutbuf, const uint8_t *andx_buf)
{
+ uint8_t smb_command = CVAL(andx_buf, smb_com);
+ uint8_t wct = CVAL(andx_buf, smb_wct);
+ const uint16_t *vwv = (const uint16_t *)(andx_buf + smb_vwv);
+ size_t bytes_alignment = 0;
+ uint32_t num_bytes = smb_buflen(andx_buf);
+ const uint8_t *bytes = (const uint8_t *)smb_buf(andx_buf);
+
uint8_t *outbuf;
size_t old_size, new_size;
size_t ofs;
@@ -1983,12 +1979,7 @@ void chain_reply(struct smb_request *req)
SSVAL(req->chain_outbuf, smb_tid, SVAL(req->outbuf, smb_tid));
SSVAL(req->chain_outbuf, smb_uid, SVAL(req->outbuf, smb_uid));
- if (!smb_splice_chain(&req->chain_outbuf,
- CVAL(req->outbuf, smb_com),
- CVAL(req->outbuf, smb_wct),
- (uint16_t *)(req->outbuf + smb_vwv),
- 0, smb_buflen(req->outbuf),
- (uint8_t *)smb_buf(req->outbuf))) {
+ if (!smb_splice_chain(&req->chain_outbuf, req->outbuf)) {
goto error;
}
TALLOC_FREE(req->outbuf);
@@ -2144,12 +2135,7 @@ void chain_reply(struct smb_request *req)
SSVAL(req->chain_outbuf, smb_rcls, SVAL(req->outbuf, smb_rcls));
SSVAL(req->chain_outbuf, smb_err, SVAL(req->outbuf, smb_err));
- if (!smb_splice_chain(&req->chain_outbuf,
- CVAL(req->outbuf, smb_com),
- CVAL(req->outbuf, smb_wct),
- (uint16_t *)(req->outbuf + smb_vwv),
- 0, smb_buflen(req->outbuf),
- (uint8_t *)smb_buf(req->outbuf))) {
+ if (!smb_splice_chain(&req->chain_outbuf, req->outbuf)) {
exit_server_cleanly("chain_reply: smb_splice_chain failed\n");
}
TALLOC_FREE(req->outbuf);