[SCM] Samba Shared Repository - branch master updated
Volker Lendecke
vlendec at samba.org
Tue Aug 24 13:07:16 MDT 2010
The branch, master has been updated
via 2d81721... s3: Move "trans_num" to smbd_server_connection
via 1808dd0... s3: Make srv_send_smb take an sconn instead of a sock fd
from aa830cd... pam: fix unused variable warning
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 2d81721a3fd9aa0cfdb2501cbcdd6eedc78c15c3
Author: Volker Lendecke <vl at samba.org>
Date: Tue Aug 24 20:47:29 2010 +0200
s3: Move "trans_num" to smbd_server_connection
commit 1808dd0a854f0cf95718da28a9fc58134af04d83
Author: Volker Lendecke <vl at samba.org>
Date: Tue Aug 24 20:10:20 2010 +0200
s3: Make srv_send_smb take an sconn instead of a sock fd
-----------------------------------------------------------------------
Summary of changes:
source3/include/proto.h | 2 +-
source3/smbd/aio.c | 6 +++---
source3/smbd/blocking.c | 4 ++--
source3/smbd/globals.c | 1 -
source3/smbd/globals.h | 1 +
source3/smbd/ipc.c | 8 ++++----
source3/smbd/nttrans.c | 4 ++--
source3/smbd/oplock.c | 2 +-
source3/smbd/pipes.c | 2 +-
source3/smbd/process.c | 29 ++++++++++++++---------------
source3/smbd/reply.c | 8 ++++----
source3/smbd/trans2.c | 4 ++--
12 files changed, 35 insertions(+), 36 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 43a510b..a344979 100644
--- 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);
-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);
diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c
index 281c296..677fbb6 100644
--- 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);
- 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),
@@ -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);
- 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 "
@@ -722,7 +722,7 @@ static int handle_aio_write_complete(struct aio_extra *aio_ex, int errcode)
}
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)) {
diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c
index ee50963..7a73ea9 100644
--- 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);
- 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.");
@@ -395,7 +395,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->sock,
+ if (!srv_send_smb(blr->req->sconn,
(char *)blr->req->outbuf,
true, blr->req->seqnum+1,
IS_CONN_ENCRYPTED(blr->fsp->conn),
diff --git a/source3/smbd/globals.c b/source3/smbd/globals.c
index 324d13a..98e4d51 100644
--- a/source3/smbd/globals.c
+++ b/source3/smbd/globals.c
@@ -71,7 +71,6 @@ struct msg_state *smbd_msg_state = NULL;
bool logged_ioctl_message = false;
-int trans_num = 0;
pid_t mypid = 0;
time_t last_smb_conf_reload_time = 0;
time_t last_printer_reload_time = 0;
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index e4f4b79..86e2c9b 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -466,6 +466,7 @@ struct smbd_server_connection {
bool got_session;
} nbt;
bool using_smb2;
+ int trans_num;
struct {
struct fd_event *fde;
diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c
index c961fc4..5dd0e56 100644
--- 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);
- 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.");
@@ -195,7 +195,7 @@ void send_trans_reply(connection_struct *conn,
}
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 "
@@ -313,7 +313,7 @@ static void api_dcerpc_cmd_write_done(struct tevent_req *subreq)
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)) {
@@ -341,7 +341,7 @@ static void api_dcerpc_cmd_read_done(struct tevent_req *subreq)
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)) {
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 07df67d..965d279 100644
--- 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);
- if (!srv_send_smb(sconn->sock,
+ if (!srv_send_smb(sconn,
(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);
- if (!srv_send_smb(sconn->sock,
+ if (!srv_send_smb(sconn,
(char *)req->outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(conn),
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index 44060d5..63a17e1 100644
--- 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);
- 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)) {
diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c
index 8bdd8b2..dfe8756 100644
--- 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:
- 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)) {
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 126b6b7..961598f 100644
--- 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.
****************************************************************************/
-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)
@@ -111,11 +111,11 @@ bool srv_send_smb(int fd, char *buffer,
ssize_t ret;
char *buf_out = buffer;
- smbd_lock_socket(smbd_server_conn);
+ smbd_lock_socket(sconn);
if (do_signing) {
/* Sign the outgoing packet if required. */
- srv_calculate_sign_mac(smbd_server_conn, buf_out, seqnum);
+ srv_calculate_sign_mac(sconn, buf_out, seqnum);
}
if (do_encrypt) {
@@ -130,7 +130,7 @@ bool srv_send_smb(int fd, char *buffer,
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];
@@ -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,
- 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);
@@ -152,7 +152,7 @@ bool srv_send_smb(int fd, char *buffer,
out:
SMB_PERFCOUNT_END(pcd);
- smbd_unlock_socket(smbd_server_conn);
+ smbd_unlock_socket(sconn);
return true;
}
@@ -1620,7 +1620,7 @@ static void construct_reply(char *inbuf, int size, size_t unread_bytes,
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,
@@ -1647,9 +1647,8 @@ static void process_smb(struct smbd_server_connection *conn,
DEBUG( 6, ( "got message type 0x%x of len 0x%x\n", msg_type,
smb_len(inbuf) ) );
- DEBUG( 3, ( "Transaction %d of length %d (%u toread)\n", trans_num,
- (int)nread,
- (unsigned int)unread_bytes ));
+ DEBUG(3, ("Transaction %d of length %d (%u toread)\n",
+ conn->trans_num, (int)nread, (unsigned int)unread_bytes));
if (msg_type != 0) {
/*
@@ -1676,7 +1675,7 @@ static void process_smb(struct smbd_server_connection *conn,
show_msg((char *)inbuf);
construct_reply((char *)inbuf,nread,unread_bytes,seqnum,encrypted,deferred_pcd);
- trans_num++;
+ conn->trans_num++;
done:
conn->smb1.num_requests++;
@@ -2059,7 +2058,7 @@ void chain_reply(struct smb_request *req)
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,
@@ -2199,7 +2198,7 @@ void chain_reply(struct smb_request *req)
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)) {
@@ -2658,7 +2657,7 @@ static bool smbd_echo_reply(uint8_t *inbuf, size_t inbuf_len,
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);
@@ -2994,7 +2993,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())));
- (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");
}
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 583c896..0775b39 100644
--- 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);
- 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.");
@@ -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));
- srv_send_smb(sconn->sock, outbuf, false, 0, false, NULL);
+ srv_send_smb(sconn, outbuf, false, 0, false, NULL);
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);
- if (!srv_send_smb(req->sconn->sock,
+ if (!srv_send_smb(req->sconn,
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);
- 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,
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index ccc194b..24d66a6 100644
--- 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 (!srv_send_smb(sconn->sock,
+ if (!srv_send_smb(sconn,
(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);
- if (!srv_send_smb(sconn->sock,
+ if (!srv_send_smb(sconn,
(char *)req->outbuf,
true, req->seqnum+1,
IS_CONN_ENCRYPTED(conn),
--
Samba Shared Repository
More information about the samba-cvs
mailing list