summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-06-11 12:55:24 +0200
committerMichael Adam <obnox@samba.org>2014-09-19 09:15:11 +0200
commit4b9f17eca73120a1741250d2d55382921e4dea3c (patch)
treecefcc5b01de66489872bf60b1c43762d056026d7 /source3
parente3ab0a0569db3a63a05deae1c372b88eabf2bea2 (diff)
downloadsamba-4b9f17eca73120a1741250d2d55382921e4dea3c.tar.gz
s3:smbd: pass smbXsrv_connection to srv_send_smb()
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/aio.c6
-rw-r--r--source3/smbd/blocking.c6
-rw-r--r--source3/smbd/ipc.c9
-rw-r--r--source3/smbd/nttrans.c5
-rw-r--r--source3/smbd/oplock.c3
-rw-r--r--source3/smbd/pipes.c2
-rw-r--r--source3/smbd/process.c14
-rw-r--r--source3/smbd/proto.h2
-rw-r--r--source3/smbd/reply.c11
-rw-r--r--source3/smbd/trans2.c5
10 files changed, 30 insertions, 33 deletions
diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c
index f5e4cc68377..56b4cfc33d0 100644
--- a/source3/smbd/aio.c
+++ b/source3/smbd/aio.c
@@ -305,7 +305,7 @@ static void aio_pread_smb1_done(struct tevent_req *req)
}
smb_setlen(outbuf, outsize - 4);
show_msg(outbuf);
- if (!srv_send_smb(aio_ex->smbreq->sconn, outbuf,
+ if (!srv_send_smb(aio_ex->smbreq->xconn, outbuf,
true, aio_ex->smbreq->seqnum+1,
IS_CONN_ENCRYPTED(fsp->conn), NULL)) {
exit_server_cleanly("handle_aio_read_complete: srv_send_smb "
@@ -522,7 +522,7 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
SSVAL(aio_ex->outbuf.data,smb_vwv2,numtowrite);
SSVAL(aio_ex->outbuf.data,smb_vwv4,(numtowrite>>16)&1);
show_msg((char *)aio_ex->outbuf.data);
- if (!srv_send_smb(aio_ex->smbreq->sconn,
+ if (!srv_send_smb(aio_ex->smbreq->xconn,
(char *)aio_ex->outbuf.data,
true, aio_ex->smbreq->seqnum+1,
IS_CONN_ENCRYPTED(fsp->conn),
@@ -624,7 +624,7 @@ static void aio_pwrite_smb1_done(struct tevent_req *req)
}
show_msg(outbuf);
- if (!srv_send_smb(aio_ex->smbreq->sconn, outbuf,
+ if (!srv_send_smb(aio_ex->smbreq->xconn, outbuf,
true, aio_ex->smbreq->seqnum+1,
IS_CONN_ENCRYPTED(fsp->conn),
NULL)) {
diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c
index 5d3672e7836..942c4b3192a 100644
--- a/source3/smbd/blocking.c
+++ b/source3/smbd/blocking.c
@@ -277,7 +277,7 @@ static void reply_lockingX_success(struct blocking_lock_record *blr)
* that here and must set up the chain info manually.
*/
- if (!srv_send_smb(req->sconn,
+ if (!srv_send_smb(req->xconn,
(char *)req->outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(req->conn)||req->encrypted,
@@ -318,7 +318,7 @@ static void generic_blocking_lock_error(struct blocking_lock_record *blr, NTSTAT
}
reply_nterror(blr->req, status);
- if (!srv_send_smb(blr->req->sconn, (char *)blr->req->outbuf,
+ if (!srv_send_smb(blr->req->xconn, (char *)blr->req->outbuf,
true, blr->req->seqnum+1,
blr->req->encrypted, NULL)) {
exit_server_cleanly("generic_blocking_lock_error: srv_send_smb failed.");
@@ -407,7 +407,7 @@ static void blocking_lock_reply_error(struct blocking_lock_record *blr, NTSTATUS
*/
SCVAL(blr->req->outbuf,smb_com,SMBtrans2);
- if (!srv_send_smb(blr->req->sconn,
+ if (!srv_send_smb(blr->req->xconn,
(char *)blr->req->outbuf,
true, blr->req->seqnum+1,
IS_CONN_ENCRYPTED(blr->fsp->conn),
diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c
index 9a07ba01115..6f4c7e0f11c 100644
--- a/source3/smbd/ipc.c
+++ b/source3/smbd/ipc.c
@@ -108,7 +108,6 @@ void send_trans_reply(connection_struct *conn,
int ldata = rdata ? rdata_len : 0;
int lparam = rparam ? rparam_len : 0;
struct smbXsrv_connection *xconn = req->xconn;
- struct smbd_server_connection *sconn = xconn->sconn;
int max_send = xconn->smb1.sessions.max_send;
/* HACK: make sure we send at least 128 byte in one go */
int hdr_overhead = SMB_BUFFER_SIZE_MIN - 128;
@@ -152,7 +151,7 @@ void send_trans_reply(connection_struct *conn,
}
show_msg((char *)req->outbuf);
- if (!srv_send_smb(sconn, (char *)req->outbuf,
+ if (!srv_send_smb(xconn, (char *)req->outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(conn), &req->pcd)) {
exit_server_cleanly("send_trans_reply: srv_send_smb failed.");
@@ -212,7 +211,7 @@ void send_trans_reply(connection_struct *conn,
}
show_msg((char *)req->outbuf);
- if (!srv_send_smb(sconn, (char *)req->outbuf,
+ if (!srv_send_smb(xconn, (char *)req->outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(conn), &req->pcd))
exit_server_cleanly("send_trans_reply: srv_send_smb "
@@ -342,7 +341,7 @@ static void api_dcerpc_cmd_write_done(struct tevent_req *subreq)
send:
if (!srv_send_smb(
- req->sconn, (char *)req->outbuf,
+ req->xconn, (char *)req->outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(req->conn) || req->encrypted,
&req->pcd)) {
@@ -375,7 +374,7 @@ static void api_dcerpc_cmd_read_done(struct tevent_req *subreq)
NT_STATUS_EQUAL(old, status)?"":nt_errstr(status)));
reply_nterror(req, status);
- if (!srv_send_smb(req->sconn, (char *)req->outbuf,
+ if (!srv_send_smb(req->xconn, (char *)req->outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(req->conn)
||req->encrypted, &req->pcd)) {
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index cf242730ee9..f03f6d35349 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -68,7 +68,6 @@ static void send_nt_replies(connection_struct *conn,
int alignment_offset = 1;
int data_alignment_offset = 0;
struct smbXsrv_connection *xconn = req->xconn;
- struct smbd_server_connection *sconn = xconn->sconn;
int max_send = xconn->smb1.sessions.max_send;
/*
@@ -84,7 +83,7 @@ static void send_nt_replies(connection_struct *conn,
__LINE__,__FILE__);
}
show_msg((char *)req->outbuf);
- if (!srv_send_smb(sconn,
+ if (!srv_send_smb(xconn,
(char *)req->outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(conn),
@@ -248,7 +247,7 @@ static void send_nt_replies(connection_struct *conn,
/* Send the packet */
show_msg((char *)req->outbuf);
- if (!srv_send_smb(sconn,
+ if (!srv_send_smb(xconn,
(char *)req->outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(conn),
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index 02cd0bbc45b..d927d4c96b5 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -394,12 +394,13 @@ static void add_oplock_timeout_handler(files_struct *fsp)
static void send_break_message_smb1(files_struct *fsp, int level)
{
+ struct smbXsrv_connection *xconn = fsp->conn->sconn->conn;
char break_msg[SMB1_BREAK_MESSAGE_LENGTH];
new_break_message_smb1(fsp, level, break_msg);
show_msg(break_msg);
- if (!srv_send_smb(fsp->conn->sconn,
+ if (!srv_send_smb(xconn,
break_msg, false, 0,
IS_CONN_ENCRYPTED(fsp->conn),
NULL)) {
diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c
index 110951ca67c..f9390b4b558 100644
--- a/source3/smbd/pipes.c
+++ b/source3/smbd/pipes.c
@@ -246,7 +246,7 @@ static void pipe_write_done(struct tevent_req *subreq)
DEBUG(3,("write-IPC nwritten=%d\n", (int)nwritten));
send:
- if (!srv_send_smb(req->sconn, (char *)req->outbuf,
+ if (!srv_send_smb(req->xconn, (char *)req->outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(req->conn)||req->encrypted,
&req->pcd)) {
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index a3a0ac41700..68bd3e4b61c 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -211,12 +211,11 @@ void smbd_unlock_socket(struct smbXsrv_connection *xconn)
Send an smb to a fd.
****************************************************************************/
-bool srv_send_smb(struct smbd_server_connection *sconn, char *buffer,
+bool srv_send_smb(struct smbXsrv_connection *xconn, char *buffer,
bool do_signing, uint32_t seqnum,
bool do_encrypt,
struct smb_perfcount_data *pcd)
{
- struct smbXsrv_connection *xconn = sconn->conn;
size_t len = 0;
ssize_t ret;
char *buf_out = buffer;
@@ -1698,6 +1697,7 @@ static void construct_reply_chain(struct smbd_server_connection *sconn,
bool encrypted,
struct smb_perfcount_data *deferred_pcd)
{
+ struct smbXsrv_connection *xconn = sconn->conn;
struct smb_request **reqs = NULL;
struct smb_request *req;
unsigned num_reqs;
@@ -1709,7 +1709,7 @@ static void construct_reply_chain(struct smbd_server_connection *sconn,
char errbuf[smb_size];
error_packet(errbuf, 0, 0, NT_STATUS_INVALID_PARAMETER,
__LINE__, __FILE__);
- if (!srv_send_smb(sconn, errbuf, true, seqnum, encrypted,
+ if (!srv_send_smb(xconn, errbuf, true, seqnum, encrypted,
NULL)) {
exit_server_cleanly("construct_reply_chain: "
"srv_send_smb failed.");
@@ -1830,7 +1830,7 @@ void smb_request_done(struct smb_request *req)
first_req->outbuf, talloc_get_size(first_req->outbuf) - 4);
shipit:
- if (!srv_send_smb(first_req->sconn,
+ if (!srv_send_smb(first_req->xconn,
(char *)first_req->outbuf,
true, first_req->seqnum+1,
IS_CONN_ENCRYPTED(req->conn)||first_req->encrypted,
@@ -1846,7 +1846,7 @@ error:
{
char errbuf[smb_size];
error_packet(errbuf, 0, 0, status, __LINE__, __FILE__);
- if (!srv_send_smb(req->sconn, errbuf, true,
+ if (!srv_send_smb(req->xconn, errbuf, true,
req->seqnum+1, req->encrypted,
NULL)) {
exit_server_cleanly("construct_reply_chain: "
@@ -3083,7 +3083,7 @@ static bool smbd_echo_reply(struct smbd_echo_state *state,
memcpy(smb_buf(req.outbuf), req.buf, req.buflen);
}
- ok = srv_send_smb(req.sconn,
+ ok = srv_send_smb(req.xconn,
(char *)outbuf,
true, seqnum+1,
false, &req.pcd);
@@ -3727,7 +3727,7 @@ void smbd_process(struct tevent_context *ev_ctx,
DEBUG( 1, ("Connection denied from %s to %s\n",
tsocket_address_string(remote_address, talloc_tos()),
tsocket_address_string(local_address, talloc_tos())));
- (void)srv_send_smb(sconn,(char *)buf, false,
+ (void)srv_send_smb(xconn,(char *)buf, false,
0, false, NULL);
exit_server_cleanly("connection denied");
}
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 3a5ebcce08f..00f58c60e7a 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -741,7 +741,7 @@ int posix_sys_acl_blob_get_fd(vfs_handle_struct *handle,
void smbd_setup_sig_term_handler(struct smbd_server_connection *sconn);
void smbd_setup_sig_hup_handler(struct smbd_server_connection *sconn);
-bool srv_send_smb(struct smbd_server_connection *sconn, char *buffer,
+bool srv_send_smb(struct smbXsrv_connection *xconn, char *buffer,
bool no_signing, uint32_t seqnum,
bool do_encrypt,
struct smb_perfcount_data *pcd);
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 3c22bbb09a0..5a742753244 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -431,7 +431,6 @@ bool check_fsp_ntquota_handle(connection_struct *conn, struct smb_request *req,
static bool netbios_session_retarget(struct smbXsrv_connection *xconn,
const char *name, int name_type)
{
- struct smbd_server_connection *sconn = xconn->sconn;
char *trim_name;
char *trim_name_type;
const char *retarget_parm;
@@ -509,7 +508,7 @@ static bool netbios_session_retarget(struct smbXsrv_connection *xconn,
*(uint32_t *)(outbuf+4) = in_addr->sin_addr.s_addr;
*(uint16_t *)(outbuf+8) = htons(retarget_port);
- if (!srv_send_smb(sconn, (char *)outbuf, false, 0, false,
+ if (!srv_send_smb(xconn, (char *)outbuf, false, 0, false,
NULL)) {
exit_server_cleanly("netbios_session_retarget: srv_send_smb "
"failed.");
@@ -668,7 +667,7 @@ void reply_special(struct smbXsrv_connection *xconn, char *inbuf, size_t inbuf_s
DEBUG(5,("init msg_type=0x%x msg_flags=0x%x\n",
msg_type, msg_flags));
- srv_send_smb(sconn, outbuf, false, 0, false, NULL);
+ srv_send_smb(xconn, outbuf, false, 0, false, NULL);
if (CVAL(outbuf, 0) != 0x82) {
exit_server_cleanly("invalid netbios session");
@@ -4334,7 +4333,7 @@ void reply_writebraw(struct smb_request *req)
SCVAL(buf,smb_com,SMBwritebraw);
SSVALS(buf,smb_vwv0,0xFFFF);
show_msg(buf);
- if (!srv_send_smb(req->sconn,
+ if (!srv_send_smb(req->xconn,
buf,
false, 0, /* no signing */
IS_CONN_ENCRYPTED(conn),
@@ -5248,7 +5247,7 @@ static void do_smb1_close(struct tevent_req *req)
} else {
reply_nterror(smbreq, status);
}
- if (!srv_send_smb(smbreq->sconn,
+ if (!srv_send_smb(smbreq->xconn,
(char *)smbreq->outbuf,
true,
smbreq->seqnum+1,
@@ -5569,7 +5568,7 @@ void reply_echo(struct smb_request *req)
SSVAL(req->outbuf,smb_vwv0,seq_num);
show_msg((char *)req->outbuf);
- if (!srv_send_smb(req->sconn,
+ if (!srv_send_smb(req->xconn,
(char *)req->outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(conn)||req->encrypted,
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 44ff5fd18aa..a8043ce0a7e 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -860,7 +860,6 @@ void send_trans2_replies(connection_struct *conn,
int data_alignment_offset = 0;
bool overflow = False;
struct smbXsrv_connection *xconn = req->xconn;
- struct smbd_server_connection *sconn = xconn->sconn;
int max_send = xconn->smb1.sessions.max_send;
/* Modify the data_to_send and datasize and set the error if
@@ -888,7 +887,7 @@ void send_trans2_replies(connection_struct *conn,
__LINE__,__FILE__);
}
show_msg((char *)req->outbuf);
- if (!srv_send_smb(sconn,
+ if (!srv_send_smb(xconn,
(char *)req->outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(conn),
@@ -1028,7 +1027,7 @@ void send_trans2_replies(connection_struct *conn,
/* Send the packet */
show_msg((char *)req->outbuf);
- if (!srv_send_smb(sconn,
+ if (!srv_send_smb(xconn,
(char *)req->outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(conn),