/* Bump to version 33 - Samba 4.3 will ship with that. */
/* Version 33 - change fallocate mode flags param from enum->uint32_t */
/* Version 33 - Add snapshot create/delete calls */
+/* Version 33 - Add OS X SMB2 AAPL copyfile extension flag to fsp */
#define SMB_VFS_INTERFACE_VERSION 33
bool is_sparse;
bool backup_intent; /* Handle was successfully opened with backup intent
and opener has privilege to do so. */
+ bool aapl_copyfile_supported;
struct smb_filename *fsp_name;
uint32_t name_hash; /* Jenkins hash of full pathname. */
uint64_t mid; /* Mid of the operation that created us. */
COPYCHUNK_OUT_LIMITS,
COPYCHUNK_OUT_RSP,
} out_data;
+ bool aapl_copyfile;
};
static void fsctl_srv_copychunk_vfs_done(struct tevent_req *subreq);
/* any errors from here onwards should carry copychunk response data */
state->out_data = COPYCHUNK_OUT_RSP;
+ if (cc_copy.chunk_count == 0) {
+ struct tevent_req *vfs_subreq;
+ /*
+ * Process as OS X copyfile request. This is currently
+ * the only copychunk request with a chunk count of 0
+ * we will process.
+ */
+ if (!state->src_fsp->aapl_copyfile_supported) {
+ tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
+ return tevent_req_post(req, ev);
+ }
+ if (!state->dst_fsp->aapl_copyfile_supported) {
+ tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
+ return tevent_req_post(req, ev);
+ }
+ state->aapl_copyfile = true;
+ vfs_subreq = SMB_VFS_COPY_CHUNK_SEND(dst_fsp->conn,
+ state, ev,
+ state->src_fsp,
+ 0,
+ state->dst_fsp,
+ 0,
+ 0);
+ if (tevent_req_nomem(vfs_subreq, req)) {
+ return tevent_req_post(req, ev);
+ }
+ tevent_req_set_callback(vfs_subreq,
+ fsctl_srv_copychunk_vfs_done, req);
+ state->dispatch_count++;
+ return req;
+ }
+
for (i = 0; i < cc_copy.chunk_count; i++) {
struct tevent_req *vfs_subreq;
chunk = &cc_copy.chunks[i];
*pack_rsp = true;
break;
case COPYCHUNK_OUT_RSP:
- cc_rsp->chunks_written = state->recv_count - state->bad_recv_count;
+ if (state->aapl_copyfile == true) {
+ cc_rsp->chunks_written = 0;
+ } else {
+ cc_rsp->chunks_written = state->recv_count - state->bad_recv_count;
+ }
cc_rsp->chunk_bytes_written = 0;
cc_rsp->total_bytes_written = state->total_written;
*pack_rsp = true;