summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2013-03-26 16:53:45 -0700
committerKarolin Seeger <kseeger@samba.org>2013-04-26 09:25:03 +0200
commit3a335d492ee8a969e19db33df9ee49dfa5e4b988 (patch)
tree9e240cedf9cc680bca42baf34de701b4ff68bd0b
parent2b7b65c26732a837a4b622bc0250988caf5e9818 (diff)
downloadsamba-3a335d492ee8a969e19db33df9ee49dfa5e4b988.tar.gz
Change estimate_ea_size() to correctly estimate the EA size over SMB2.
Signed-off-by: Jeremy Allison <jra@samba.org> (cherry picked from commit c6688532c8a01836f29a38806ced62b34617222d)
-rw-r--r--source3/smbd/trans2.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index ff315754d6f..30466493226 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -471,13 +471,38 @@ static NTSTATUS fill_ea_chained_buffer(TALLOC_CTX *mem_ctx,
static unsigned int estimate_ea_size(connection_struct *conn, files_struct *fsp, const char *fname)
{
size_t total_ea_len = 0;
+ struct ea_list *ea_list = NULL;
TALLOC_CTX *mem_ctx = NULL;
if (!lp_ea_support(SNUM(conn))) {
return 0;
}
mem_ctx = talloc_tos();
- (void)get_ea_list_from_file(mem_ctx, conn, fsp, fname, &total_ea_len);
+ ea_list = get_ea_list_from_file(mem_ctx, conn, fsp, fname, &total_ea_len);
+ if (ea_list == NULL) {
+ return 0;
+ }
+ if(conn->sconn->using_smb2) {
+ NTSTATUS status;
+ unsigned int ret_data_size;
+ /*
+ * We're going to be using fill_ea_chained_buffer() to
+ * marshall EA's - this size is significantly larger
+ * than the SMB1 buffer. Re-calculate the size without
+ * marshalling.
+ */
+ status = fill_ea_chained_buffer(mem_ctx,
+ NULL,
+ 65535,
+ &ret_data_size,
+ conn,
+ ea_list);
+ if (!NT_STATUS_IS_OK(status)) {
+ ret_data_size = 0;
+ }
+ total_ea_len = ret_data_size;
+ }
+
return total_ea_len;
}