uint64_t in_offset = state->in_offset;
files_struct *fsp = state->fsp;
const DATA_BLOB *hdr = state->smb2req->queue_entry.sendfile_header;
+ NTSTATUS *pstatus = state->smb2req->queue_entry.sendfile_status;
struct smbXsrv_connection *xconn = state->smb2req->xconn;
ssize_t nread;
ssize_t ret;
"Terminating\n",
fsp_str_dbg(fsp), strerror(saved_errno),
smbXsrv_connection_dbg(xconn)));
- exit_server_cleanly("smb2_sendfile_send_data: "
- "fake_sendfile failed");
+ *pstatus = map_nt_error_from_unix_common(saved_errno);
+ return 0;
}
goto out;
}
"%s (%s) for client %s. Terminating\n",
fsp_str_dbg(fsp), strerror(saved_errno),
smbXsrv_connection_dbg(xconn)));
- exit_server_cleanly("smb2_sendfile_send_data: sendfile failed");
+ *pstatus = map_nt_error_from_unix_common(saved_errno);
+ return 0;
} else if (nread == 0) {
/*
* Some sendfile implementations return 0 to indicate
"%s (%s) for client %s. Terminating\n",
fsp_str_dbg(fsp), strerror(saved_errno),
smbXsrv_connection_dbg(xconn)));
- exit_server_cleanly("smb2_sendfile_send_data: write_data failed");
+ *pstatus = map_nt_error_from_unix_common(saved_errno);
+ return 0;
}
nread = fake_sendfile(xconn, fsp, in_offset, in_length);
if (nread == -1) {
"Terminating\n",
fsp_str_dbg(fsp), strerror(saved_errno),
smbXsrv_connection_dbg(xconn)));
- exit_server_cleanly("smb2_sendfile_send_data: "
- "fake_sendfile failed");
+ *pstatus = map_nt_error_from_unix_common(saved_errno);
+ return 0;
}
out:
__func__,
fsp_str_dbg(fsp), strerror(saved_errno),
smbXsrv_connection_dbg(xconn)));
- exit_server_cleanly("smb2_sendfile_send_data: "
- "sendfile_short_send failed");
+ *pstatus = map_nt_error_from_unix_common(saved_errno);
+ return 0;
}
}
&lock);
SMB_VFS_STRICT_UNLOCK(fsp->conn, fsp, &lock);
+
+ *pstatus = NT_STATUS_OK;
return 0;
}
struct smbd_smb2_send_queue *e = xconn->smb2.send_queue;
if (e->sendfile_header != NULL) {
+ NTSTATUS status = NT_STATUS_INTERNAL_ERROR;
size_t size = 0;
size_t i = 0;
uint8_t *buf;
e->sendfile_header->data = buf;
e->sendfile_header->length = size;
+ e->sendfile_status = &status;
e->count = 0;
xconn->smb2.send_queue_len--;
* the destructor.
*/
talloc_free(e->mem_ctx);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
continue;
}