summaryrefslogtreecommitdiff
path: root/source3/smbd/trans2.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2013-08-07 13:48:55 -0700
committerStefan Metzmacher <metze@samba.org>2013-08-15 09:07:06 +0200
commitc80349e0fad7c182b0bddefed99a78d95323faca (patch)
tree7d41a5637c37b274c7bd67e6bf859bb9fa53bdde /source3/smbd/trans2.c
parent2394f8788d2f6e21064db0b6099a0dbe3a33e1d6 (diff)
downloadsamba-c80349e0fad7c182b0bddefed99a78d95323faca.tar.gz
samba-c80349e0fad7c182b0bddefed99a78d95323faca.tar.bz2
samba-c80349e0fad7c182b0bddefed99a78d95323faca.zip
s3:lib: Factor read_ea_list_entry() and read_nttrans_ea_list() out so they can be used by the SMB2 client code.
Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source3/smbd/trans2.c')
-rw-r--r--source3/smbd/trans2.c62
1 files changed, 1 insertions, 61 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index da0b1ea92c..2bff483d70 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -38,6 +38,7 @@
#include "smbprofile.h"
#include "rpc_server/srv_pipe_hnd.h"
#include "printing.h"
+#include "lib/util_ea.h"
#define DIR_ENTRY_SAFETY_MARGIN 4096
@@ -749,67 +750,6 @@ static struct ea_list *read_ea_name_list(TALLOC_CTX *ctx, const char *pdata, siz
}
/****************************************************************************
- Read one EA list entry from the buffer.
-****************************************************************************/
-
-struct ea_list *read_ea_list_entry(TALLOC_CTX *ctx, const char *pdata, size_t data_size, size_t *pbytes_used)
-{
- struct ea_list *eal = talloc_zero(ctx, struct ea_list);
- uint16 val_len;
- unsigned int namelen;
- size_t converted_size;
-
- if (!eal) {
- return NULL;
- }
-
- if (data_size < 6) {
- return NULL;
- }
-
- eal->ea.flags = CVAL(pdata,0);
- namelen = CVAL(pdata,1);
- val_len = SVAL(pdata,2);
-
- if (4 + namelen + 1 + val_len > data_size) {
- return NULL;
- }
-
- /* Ensure the name is null terminated. */
- if (pdata[namelen + 4] != '\0') {
- return NULL;
- }
- if (!pull_ascii_talloc(ctx, &eal->ea.name, pdata + 4, &converted_size)) {
- DEBUG(0,("read_ea_list_entry: pull_ascii_talloc failed: %s",
- strerror(errno)));
- }
- if (!eal->ea.name) {
- return NULL;
- }
-
- eal->ea.value = data_blob_talloc(eal, NULL, (size_t)val_len + 1);
- if (!eal->ea.value.data) {
- return NULL;
- }
-
- memcpy(eal->ea.value.data, pdata + 4 + namelen + 1, val_len);
-
- /* Ensure we're null terminated just in case we print the value. */
- eal->ea.value.data[val_len] = '\0';
- /* But don't count the null. */
- eal->ea.value.length--;
-
- if (pbytes_used) {
- *pbytes_used = 4 + namelen + 1 + val_len;
- }
-
- DEBUG(10,("read_ea_list_entry: read ea name %s\n", eal->ea.name));
- dump_data(10, eal->ea.value.data, eal->ea.value.length);
-
- return eal;
-}
-
-/****************************************************************************
Read a list of EA names and data from an incoming data buffer. Create an ea_list with them.
****************************************************************************/