vfs_default: let copy_chunk_send use const from IDL
authorRalph Boehme <slow@samba.org>
Sun, 12 Mar 2017 16:18:39 +0000 (17:18 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 28 Mar 2017 15:45:20 +0000 (17:45 +0200)
This also increases the buffer size from 8 MB to the current value of
COPYCHUNK_MAX_TOTAL_LEN which is 16 MB.

For the typical case when vfswrap_copy_chunk_send is called from the SMB
layer for an copy_chunk ioctl() the parameter "num" is guaranteed to be
at most 1 MB though.

It will only be larger for special callers like vfs_fruit for their
special implementation of copyfile where num will be the size of a file
to copy.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_default.c

index d4610f74c2e640671a413948224cd379090b9649..054ff642c03f25999e992ffa2ed7a4a84ace5e56 100644 (file)
@@ -33,6 +33,7 @@
 #include "lib/util/tevent_ntstatus.h"
 #include "lib/util/sys_rw.h"
 #include "lib/pthreadpool/pthreadpool_tevent.h"
+#include "librpc/gen_ndr/ndr_ioctl.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_VFS
@@ -1617,7 +1618,7 @@ static struct tevent_req *vfswrap_copy_chunk_send(struct vfs_handle_struct *hand
        }
 
        vfs_cc_state->buf = talloc_array(vfs_cc_state, uint8_t,
-                                        MIN(num, 8*1024*1024));
+                                        MIN(num, COPYCHUNK_MAX_TOTAL_LEN));
        if (tevent_req_nomem(vfs_cc_state->buf, req)) {
                return tevent_req_post(req, ev);
        }