summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2013-03-26 15:46:06 -0700
committerDavid Disseldorp <ddiss@samba.org>2013-04-02 20:06:37 +0200
commitd9e7c8219fd8b3d770301a87bc1cd62b07b989ca (patch)
tree96b5b6445573d27ff0e9679a03c5e755872588d3 /source3
parent1e8bcce52f233722fad5c25f2467b86d97cadfa0 (diff)
downloadsamba-d9e7c8219fd8b3d770301a87bc1cd62b07b989ca.tar.gz
samba-d9e7c8219fd8b3d770301a87bc1cd62b07b989ca.tar.bz2
samba-d9e7c8219fd8b3d770301a87bc1cd62b07b989ca.zip
Modify fill_ea_chained_buffer() to be able to do size calculation only, no marshalling.
Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: David Disseldorp <ddiss@suse.de>
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/trans2.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index ee16bf9b53..61252ba507 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -459,6 +459,7 @@ static NTSTATUS fill_ea_chained_buffer(TALLOC_CTX *mem_ctx,
{
uint8_t *p = (uint8_t *)pdata;
uint8_t *last_start = NULL;
+ bool do_store_data = (pdata != NULL);
*ret_data_size = 0;
@@ -471,7 +472,7 @@ static NTSTATUS fill_ea_chained_buffer(TALLOC_CTX *mem_ctx,
fstring dos_ea_name;
size_t this_size;
- if (last_start) {
+ if (last_start != NULL && do_store_data) {
SIVAL(last_start, 0, PTR_DIFF(p, last_start));
}
last_start = p;
@@ -492,19 +493,21 @@ static NTSTATUS fill_ea_chained_buffer(TALLOC_CTX *mem_ctx,
this_size += pad;
}
- if (this_size > total_data_size) {
- return NT_STATUS_INFO_LENGTH_MISMATCH;
+ if (do_store_data) {
+ if (this_size > total_data_size) {
+ return NT_STATUS_INFO_LENGTH_MISMATCH;
+ }
+
+ /* We know we have room. */
+ SIVAL(p, 0x00, 0); /* next offset */
+ SCVAL(p, 0x04, ea_list->ea.flags);
+ SCVAL(p, 0x05, dos_namelen);
+ SSVAL(p, 0x06, ea_list->ea.value.length);
+ strlcpy((char *)(p+0x08), dos_ea_name, dos_namelen+1);
+ memcpy(p + 0x08 + dos_namelen + 1, ea_list->ea.value.data, ea_list->ea.value.length);
+ total_data_size -= this_size;
}
- /* We know we have room. */
- SIVAL(p, 0x00, 0); /* next offset */
- SCVAL(p, 0x04, ea_list->ea.flags);
- SCVAL(p, 0x05, dos_namelen);
- SSVAL(p, 0x06, ea_list->ea.value.length);
- strlcpy((char *)(p+0x08), dos_ea_name, dos_namelen+1);
- memcpy(p + 0x08 + dos_namelen + 1, ea_list->ea.value.data, ea_list->ea.value.length);
-
- total_data_size -= this_size;
p += this_size;
}