git.samba.org
/
samba.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
aa830cd
)
s3: Make srv_send_smb take an sconn instead of a sock fd
author
Volker Lendecke
<vl@samba.org>
Tue, 24 Aug 2010 18:10:20 +0000
(20:10 +0200)
committer
Volker Lendecke
<vl@samba.org>
Tue, 24 Aug 2010 19:06:41 +0000
(21:06 +0200)
source3/include/proto.h
patch
|
blob
|
history
source3/smbd/aio.c
patch
|
blob
|
history
source3/smbd/blocking.c
patch
|
blob
|
history
source3/smbd/ipc.c
patch
|
blob
|
history
source3/smbd/nttrans.c
patch
|
blob
|
history
source3/smbd/oplock.c
patch
|
blob
|
history
source3/smbd/pipes.c
patch
|
blob
|
history
source3/smbd/process.c
patch
|
blob
|
history
source3/smbd/reply.c
patch
|
blob
|
history
source3/smbd/trans2.c
patch
|
blob
|
history
diff --git
a/source3/include/proto.h
b/source3/include/proto.h
index 43a510b4b20d000e41d9d060e5cf6d8a17e04dc5..a3449799a862097014390f5aa794d302821eb71b 100644
(file)
--- a/
source3/include/proto.h
+++ b/
source3/include/proto.h
@@
-5590,7
+5590,7
@@
struct security_descriptor *get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fna
void smbd_setup_sig_term_handler(void);
void smbd_setup_sig_hup_handler(struct tevent_context *ev,
struct messaging_context *msg_ctx);
void smbd_setup_sig_term_handler(void);
void smbd_setup_sig_hup_handler(struct tevent_context *ev,
struct messaging_context *msg_ctx);
-bool srv_send_smb(
int fd
, char *buffer,
+bool srv_send_smb(
struct smbd_server_connection *sconn
, char *buffer,
bool no_signing, uint32_t seqnum,
bool do_encrypt,
struct smb_perfcount_data *pcd);
bool no_signing, uint32_t seqnum,
bool do_encrypt,
struct smb_perfcount_data *pcd);
diff --git
a/source3/smbd/aio.c
b/source3/smbd/aio.c
index 281c29679ee3911535ee62b3ebde5b322d11f339..677fbb6764c306246a1659be0ae5ef0407c872a2 100644
(file)
--- a/
source3/smbd/aio.c
+++ b/
source3/smbd/aio.c
@@
-357,7
+357,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);
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
->sock
,
+ if (!srv_send_smb(aio_ex->smbreq->sconn,
(char *)aio_ex->outbuf.data,
true, aio_ex->smbreq->seqnum+1,
IS_CONN_ENCRYPTED(fsp->conn),
(char *)aio_ex->outbuf.data,
true, aio_ex->smbreq->seqnum+1,
IS_CONN_ENCRYPTED(fsp->conn),
@@
-633,7
+633,7
@@
static int handle_aio_read_complete(struct aio_extra *aio_ex, int errcode)
}
smb_setlen(outbuf,outsize - 4);
show_msg(outbuf);
}
smb_setlen(outbuf,outsize - 4);
show_msg(outbuf);
- if (!srv_send_smb(aio_ex->smbreq->sconn
->sock
, outbuf,
+ if (!srv_send_smb(aio_ex->smbreq->sconn, outbuf,
true, aio_ex->smbreq->seqnum+1,
IS_CONN_ENCRYPTED(aio_ex->fsp->conn), NULL)) {
exit_server_cleanly("handle_aio_read_complete: srv_send_smb "
true, aio_ex->smbreq->seqnum+1,
IS_CONN_ENCRYPTED(aio_ex->fsp->conn), NULL)) {
exit_server_cleanly("handle_aio_read_complete: srv_send_smb "
@@
-722,7
+722,7
@@
static int handle_aio_write_complete(struct aio_extra *aio_ex, int errcode)
}
show_msg(outbuf);
}
show_msg(outbuf);
- if (!srv_send_smb(aio_ex->smbreq->sconn
->sock
, outbuf,
+ if (!srv_send_smb(aio_ex->smbreq->sconn, outbuf,
true, aio_ex->smbreq->seqnum+1,
IS_CONN_ENCRYPTED(fsp->conn),
NULL)) {
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 ee5096351c855ad737fa3ce5253c97b7f68feb56..7a73ea9ccad18c51516d0979a1b983cd617503bb 100644
(file)
--- a/
source3/smbd/blocking.c
+++ b/
source3/smbd/blocking.c
@@
-312,7
+312,7
@@
static void generic_blocking_lock_error(struct blocking_lock_record *blr, NTSTAT
}
reply_nterror(blr->req, status);
}
reply_nterror(blr->req, status);
- if (!srv_send_smb(blr->req->sconn
->sock
, (char *)blr->req->outbuf,
+ if (!srv_send_smb(blr->req->sconn, (char *)blr->req->outbuf,
true, blr->req->seqnum+1,
blr->req->encrypted, NULL)) {
exit_server_cleanly("generic_blocking_lock_error: srv_send_smb failed.");
true, blr->req->seqnum+1,
blr->req->encrypted, NULL)) {
exit_server_cleanly("generic_blocking_lock_error: srv_send_smb failed.");
@@
-395,7
+395,7
@@
static void blocking_lock_reply_error(struct blocking_lock_record *blr, NTSTATUS
*/
SCVAL(blr->req->outbuf,smb_com,SMBtrans2);
*/
SCVAL(blr->req->outbuf,smb_com,SMBtrans2);
- if (!srv_send_smb(blr->req->sconn
->sock
,
+ if (!srv_send_smb(blr->req->sconn,
(char *)blr->req->outbuf,
true, blr->req->seqnum+1,
IS_CONN_ENCRYPTED(blr->fsp->conn),
(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 c961fc4ab6b0495a89908811ed4d9214d6e9b1c8..5dd0e5627e2bffd3db3e5616c1722e1524fe5430 100644
(file)
--- a/
source3/smbd/ipc.c
+++ b/
source3/smbd/ipc.c
@@
-135,7
+135,7
@@
void send_trans_reply(connection_struct *conn,
}
show_msg((char *)req->outbuf);
}
show_msg((char *)req->outbuf);
- if (!srv_send_smb(sconn
->sock
, (char *)req->outbuf,
+ if (!srv_send_smb(sconn, (char *)req->outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(conn), &req->pcd)) {
exit_server_cleanly("send_trans_reply: srv_send_smb failed.");
true, req->seqnum+1,
IS_CONN_ENCRYPTED(conn), &req->pcd)) {
exit_server_cleanly("send_trans_reply: srv_send_smb failed.");
@@
-195,7
+195,7
@@
void send_trans_reply(connection_struct *conn,
}
show_msg((char *)req->outbuf);
}
show_msg((char *)req->outbuf);
- if (!srv_send_smb(sconn
->sock
, (char *)req->outbuf,
+ if (!srv_send_smb(sconn, (char *)req->outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(conn), &req->pcd))
exit_server_cleanly("send_trans_reply: srv_send_smb "
true, req->seqnum+1,
IS_CONN_ENCRYPTED(conn), &req->pcd))
exit_server_cleanly("send_trans_reply: srv_send_smb "
@@
-313,7
+313,7
@@
static void api_dcerpc_cmd_write_done(struct tevent_req *subreq)
send:
if (!srv_send_smb(
send:
if (!srv_send_smb(
- req->sconn
->sock
, (char *)req->outbuf,
+ req->sconn, (char *)req->outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(req->conn) || req->encrypted,
&req->pcd)) {
true, req->seqnum+1,
IS_CONN_ENCRYPTED(req->conn) || req->encrypted,
&req->pcd)) {
@@
-341,7
+341,7
@@
static void api_dcerpc_cmd_read_done(struct tevent_req *subreq)
nt_errstr(status)));
reply_nterror(req, status);
nt_errstr(status)));
reply_nterror(req, status);
- if (!srv_send_smb(req->sconn
->sock
, (char *)req->outbuf,
+ if (!srv_send_smb(req->sconn, (char *)req->outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(req->conn)
||req->encrypted, &req->pcd)) {
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 07df67d8a54ab0e6e21bb3dfef1b4905b6511da4..965d2791836aa2a0edd4a41e9aea44ac96ba8355 100644
(file)
--- a/
source3/smbd/nttrans.c
+++ b/
source3/smbd/nttrans.c
@@
-74,7
+74,7
@@
void send_nt_replies(connection_struct *conn,
__LINE__,__FILE__);
}
show_msg((char *)req->outbuf);
__LINE__,__FILE__);
}
show_msg((char *)req->outbuf);
- if (!srv_send_smb(sconn
->sock
,
+ if (!srv_send_smb(sconn,
(char *)req->outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(conn),
(char *)req->outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(conn),
@@
-243,7
+243,7
@@
void send_nt_replies(connection_struct *conn,
/* Send the packet */
show_msg((char *)req->outbuf);
/* Send the packet */
show_msg((char *)req->outbuf);
- if (!srv_send_smb(sconn
->sock
,
+ if (!srv_send_smb(sconn,
(char *)req->outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(conn),
(char *)req->outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(conn),
diff --git
a/source3/smbd/oplock.c
b/source3/smbd/oplock.c
index 44060d5d776f3c6df0a30b0fd0a75ef9a5e876ee..63a17e16a376ad044823b128dd3a101795c0e842 100644
(file)
--- a/
source3/smbd/oplock.c
+++ b/
source3/smbd/oplock.c
@@
-364,7
+364,7
@@
static void send_break_message_smb1(files_struct *fsp, int level)
}
show_msg(break_msg);
}
show_msg(break_msg);
- if (!srv_send_smb(fsp->conn->sconn
->sock
,
+ if (!srv_send_smb(fsp->conn->sconn,
break_msg, false, 0,
IS_CONN_ENCRYPTED(fsp->conn),
NULL)) {
break_msg, false, 0,
IS_CONN_ENCRYPTED(fsp->conn),
NULL)) {
diff --git
a/source3/smbd/pipes.c
b/source3/smbd/pipes.c
index 8bdd8b22e3f480076e2e2ae9eaaa93087851340a..dfe8756a19cfecdf97023ecfbf99fe9df84446a7 100644
(file)
--- a/
source3/smbd/pipes.c
+++ b/
source3/smbd/pipes.c
@@
-240,7
+240,7
@@
static void pipe_write_done(struct tevent_req *subreq)
DEBUG(3,("write-IPC nwritten=%d\n", (int)nwritten));
send:
DEBUG(3,("write-IPC nwritten=%d\n", (int)nwritten));
send:
- if (!srv_send_smb(req->sconn
->sock
, (char *)req->outbuf,
+ if (!srv_send_smb(req->sconn, (char *)req->outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(req->conn)||req->encrypted,
&req->pcd)) {
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 126b6b797ee59462e7608538819ddc750d916ae3..b787674635a04ba7d4a556991a8873e3b5d3babd 100644
(file)
--- a/
source3/smbd/process.c
+++ b/
source3/smbd/process.c
@@
-101,7
+101,7
@@
void smbd_unlock_socket(struct smbd_server_connection *sconn)
Send an smb to a fd.
****************************************************************************/
Send an smb to a fd.
****************************************************************************/
-bool srv_send_smb(
int fd
, char *buffer,
+bool srv_send_smb(
struct smbd_server_connection *sconn
, char *buffer,
bool do_signing, uint32_t seqnum,
bool do_encrypt,
struct smb_perfcount_data *pcd)
bool do_signing, uint32_t seqnum,
bool do_encrypt,
struct smb_perfcount_data *pcd)
@@
-111,11
+111,11
@@
bool srv_send_smb(int fd, char *buffer,
ssize_t ret;
char *buf_out = buffer;
ssize_t ret;
char *buf_out = buffer;
- smbd_lock_socket(s
mbd_server_
conn);
+ smbd_lock_socket(sconn);
if (do_signing) {
/* Sign the outgoing packet if required. */
if (do_signing) {
/* Sign the outgoing packet if required. */
- srv_calculate_sign_mac(s
mbd_server_
conn, buf_out, seqnum);
+ srv_calculate_sign_mac(sconn, buf_out, seqnum);
}
if (do_encrypt) {
}
if (do_encrypt) {
@@
-130,7
+130,7
@@
bool srv_send_smb(int fd, char *buffer,
len = smb_len(buf_out) + 4;
len = smb_len(buf_out) + 4;
- ret = write_data(
fd,buf_out+nwritten,
len - nwritten);
+ ret = write_data(
sconn->sock, buf_out+nwritten,
len - nwritten);
if (ret <= 0) {
char addr[INET6_ADDRSTRLEN];
if (ret <= 0) {
char addr[INET6_ADDRSTRLEN];
@@
-140,7
+140,7
@@
bool srv_send_smb(int fd, char *buffer,
*/
DEBUG(0,("pid[%d] Error writing %d bytes to client %s. %d. (%s)\n",
(int)sys_getpid(), (int)len,
*/
DEBUG(0,("pid[%d] Error writing %d bytes to client %s. %d. (%s)\n",
(int)sys_getpid(), (int)len,
- get_peer_addr(
fd
, addr, sizeof(addr)),
+ get_peer_addr(
sconn->sock
, addr, sizeof(addr)),
(int)ret, strerror(errno) ));
srv_free_enc_buffer(buf_out);
(int)ret, strerror(errno) ));
srv_free_enc_buffer(buf_out);
@@
-152,7
+152,7
@@
bool srv_send_smb(int fd, char *buffer,
out:
SMB_PERFCOUNT_END(pcd);
out:
SMB_PERFCOUNT_END(pcd);
- smbd_unlock_socket(s
mbd_server_
conn);
+ smbd_unlock_socket(sconn);
return true;
}
return true;
}
@@
-1620,7
+1620,7
@@
static void construct_reply(char *inbuf, int size, size_t unread_bytes,
show_msg((char *)req->outbuf);
}
show_msg((char *)req->outbuf);
}
- if (!srv_send_smb(req->sconn
->sock
,
+ if (!srv_send_smb(req->sconn,
(char *)req->outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(conn)||req->encrypted,
(char *)req->outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(conn)||req->encrypted,
@@
-2059,7
+2059,7
@@
void chain_reply(struct smb_request *req)
smb_setlen((char *)(req->chain_outbuf),
talloc_get_size(req->chain_outbuf) - 4);
smb_setlen((char *)(req->chain_outbuf),
talloc_get_size(req->chain_outbuf) - 4);
- if (!srv_send_smb(req->sconn
->sock
, (char *)req->chain_outbuf,
+ if (!srv_send_smb(req->sconn, (char *)req->chain_outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(req->conn)
||req->encrypted,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(req->conn)
||req->encrypted,
@@
-2199,7
+2199,7
@@
void chain_reply(struct smb_request *req)
show_msg((char *)(req->chain_outbuf));
show_msg((char *)(req->chain_outbuf));
- if (!srv_send_smb(req->sconn
->sock
, (char *)req->chain_outbuf,
+ if (!srv_send_smb(req->sconn, (char *)req->chain_outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(req->conn)||req->encrypted,
&req->pcd)) {
true, req->seqnum+1,
IS_CONN_ENCRYPTED(req->conn)||req->encrypted,
&req->pcd)) {
@@
-2658,7
+2658,7
@@
static bool smbd_echo_reply(uint8_t *inbuf, size_t inbuf_len,
out_len = smb_len(req.outbuf) + 4;
out_len = smb_len(req.outbuf) + 4;
- ok = srv_send_smb(req.sconn
->sock
,
+ ok = srv_send_smb(req.sconn,
(char *)outbuf,
true, seqnum+1,
false, &req.pcd);
(char *)outbuf,
true, seqnum+1,
false, &req.pcd);
@@
-2994,7
+2994,7
@@
void smbd_process(struct smbd_server_connection *sconn)
DEBUG( 1, ("Connection denied from %s to %s\n",
tsocket_address_string(remote_address, talloc_tos()),
tsocket_address_string(local_address, talloc_tos())));
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
->sock
,(char *)buf, false,
+ (void)srv_send_smb(sconn,(char *)buf, false,
0, false, NULL);
exit_server_cleanly("connection denied");
}
0, false, NULL);
exit_server_cleanly("connection denied");
}
diff --git
a/source3/smbd/reply.c
b/source3/smbd/reply.c
index 583c8960f96dd5179a08ab698537fe22b0e1e331..0775b398d5b77960413f83835fc6e85ab95af337 100644
(file)
--- a/
source3/smbd/reply.c
+++ b/
source3/smbd/reply.c
@@
-468,7
+468,7
@@
static bool netbios_session_retarget(struct smbd_server_connection *sconn,
*(uint32_t *)(outbuf+4) = in_addr->sin_addr.s_addr;
*(uint16_t *)(outbuf+8) = htons(retarget_port);
*(uint32_t *)(outbuf+4) = in_addr->sin_addr.s_addr;
*(uint16_t *)(outbuf+8) = htons(retarget_port);
- if (!srv_send_smb(sconn
->sock
, (char *)outbuf, false, 0, false,
+ if (!srv_send_smb(sconn, (char *)outbuf, false, 0, false,
NULL)) {
exit_server_cleanly("netbios_session_regarget: srv_send_smb "
"failed.");
NULL)) {
exit_server_cleanly("netbios_session_regarget: srv_send_smb "
"failed.");
@@
-574,7
+574,7
@@
void reply_special(struct smbd_server_connection *sconn, char *inbuf)
DEBUG(5,("init msg_type=0x%x msg_flags=0x%x\n",
msg_type, msg_flags));
DEBUG(5,("init msg_type=0x%x msg_flags=0x%x\n",
msg_type, msg_flags));
- srv_send_smb(sconn
->sock
, outbuf, false, 0, false, NULL);
+ srv_send_smb(sconn, outbuf, false, 0, false, NULL);
return;
}
return;
}
@@
-3966,7
+3966,7
@@
void reply_writebraw(struct smb_request *req)
SCVAL(buf,smb_com,SMBwritebraw);
SSVALS(buf,smb_vwv0,0xFFFF);
show_msg(buf);
SCVAL(buf,smb_com,SMBwritebraw);
SSVALS(buf,smb_vwv0,0xFFFF);
show_msg(buf);
- if (!srv_send_smb(req->sconn
->sock
,
+ if (!srv_send_smb(req->sconn,
buf,
false, 0, /* no signing */
IS_CONN_ENCRYPTED(conn),
buf,
false, 0, /* no signing */
IS_CONN_ENCRYPTED(conn),
@@
-5113,7
+5113,7
@@
void reply_echo(struct smb_request *req)
SSVAL(req->outbuf,smb_vwv0,seq_num);
show_msg((char *)req->outbuf);
SSVAL(req->outbuf,smb_vwv0,seq_num);
show_msg((char *)req->outbuf);
- if (!srv_send_smb(req->sconn
->sock
,
+ if (!srv_send_smb(req->sconn,
(char *)req->outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(conn)||req->encrypted,
(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 ccc194b07f1042679db3a8eb7c6a3000b8ebd76b..24d66a61879fb3d1c1cec73f898d3b37172184bf 100644
(file)
--- a/
source3/smbd/trans2.c
+++ b/
source3/smbd/trans2.c
@@
-800,7
+800,7
@@
void send_trans2_replies(connection_struct *conn,
if(params_to_send == 0 && data_to_send == 0) {
reply_outbuf(req, 10, 0);
show_msg((char *)req->outbuf);
if(params_to_send == 0 && data_to_send == 0) {
reply_outbuf(req, 10, 0);
show_msg((char *)req->outbuf);
- if (!srv_send_smb(sconn
->sock
,
+ if (!srv_send_smb(sconn,
(char *)req->outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(conn),
(char *)req->outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(conn),
@@
-939,7
+939,7
@@
void send_trans2_replies(connection_struct *conn,
/* Send the packet */
show_msg((char *)req->outbuf);
/* Send the packet */
show_msg((char *)req->outbuf);
- if (!srv_send_smb(sconn
->sock
,
+ if (!srv_send_smb(sconn,
(char *)req->outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(conn),
(char *)req->outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(conn),