1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

s3:smbd: pass smbXsrv_connection explicitly to fake_sendfile()

In future (with multi-channel) a fsp can be used from multiple
connections, we need to make it explicit on which we want to reply.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
This commit is contained in:
Stefan Metzmacher 2014-06-12 08:40:25 +02:00 committed by Michael Adam
parent bd19fd1286
commit c18a62ee9d
3 changed files with 9 additions and 8 deletions

View File

@ -856,7 +856,8 @@ NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req,
uint32 dirtype, struct smb_filename *smb_fname,
bool has_wild);
void reply_unlink(struct smb_request *req);
ssize_t fake_sendfile(files_struct *fsp, off_t startpos, size_t nread);
ssize_t fake_sendfile(struct smbXsrv_connection *xconn, files_struct *fsp,
off_t startpos, size_t nread);
void sendfile_short_send(files_struct *fsp,
ssize_t nread,
size_t headersize,

View File

@ -3026,9 +3026,9 @@ static void fail_readraw(void)
Fake (read/write) sendfile. Returns -1 on read or write fail.
****************************************************************************/
ssize_t fake_sendfile(files_struct *fsp, off_t startpos, size_t nread)
ssize_t fake_sendfile(struct smbXsrv_connection *xconn, files_struct *fsp,
off_t startpos, size_t nread)
{
struct smbXsrv_connection *xconn = fsp->conn->sconn->conn;
size_t bufsize;
size_t tosend = nread;
char *buf;
@ -3239,7 +3239,7 @@ static void send_file_readbraw(connection_struct *conn,
set_use_sendfile(SNUM(conn), False);
DEBUG(0,("send_file_readbraw: sendfile not available. Faking..\n"));
if (fake_sendfile(fsp, startpos, nread) == -1) {
if (fake_sendfile(xconn, fsp, startpos, nread) == -1) {
DEBUG(0,("send_file_readbraw: "
"fake_sendfile failed for "
"file %s (%s).\n",
@ -3774,7 +3774,7 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req,
/* Ensure we don't do this again. */
set_use_sendfile(SNUM(conn), False);
DEBUG(0,("send_file_readX: sendfile not available. Faking..\n"));
nread = fake_sendfile(fsp, startpos,
nread = fake_sendfile(xconn, fsp, startpos,
smb_maxcnt);
if (nread == -1) {
saved_errno = errno;
@ -3851,7 +3851,7 @@ normal_read:
errno = saved_errno;
exit_server_cleanly("send_file_readX sendfile failed");
}
nread = fake_sendfile(fsp, startpos, smb_maxcnt);
nread = fake_sendfile(xconn, fsp, startpos, smb_maxcnt);
if (nread == -1) {
saved_errno = errno;
DEBUG(0,("send_file_readX: fake_sendfile failed for file "

View File

@ -217,7 +217,7 @@ static int smb2_sendfile_send_data(struct smbd_smb2_read_state *state)
* Fake this up by doing read/write calls.
*/
set_use_sendfile(SNUM(fsp->conn), false);
nread = fake_sendfile(fsp, in_offset, in_length);
nread = fake_sendfile(xconn, fsp, in_offset, in_length);
if (nread == -1) {
saved_errno = errno;
DEBUG(0,("smb2_sendfile_send_data: fake_sendfile "
@ -267,7 +267,7 @@ normal_read:
smbXsrv_connection_dbg(xconn)));
exit_server_cleanly("smb2_sendfile_send_data: write_data failed");
}
nread = fake_sendfile(fsp, in_offset, in_length);
nread = fake_sendfile(xconn, fsp, in_offset, in_length);
if (nread == -1) {
saved_errno = errno;
DEBUG(0,("smb2_sendfile_send_data: fake_sendfile "