The branch, master has been updated via 68e8696... s3: Remove smbd_server_fd() from smbd_process via 0bd39c7... s3: Remove smbd_server_fd() from smbd_echo_loop via 2cd6438... s3: Remove smbd_server_fd() from smbd_echo_reader via a234833... s3: Remove smbd_server_fd() from smbd_echo_reply via bb867df... s3: Remove smbd_server_fd() from keepalive_fn via a2bf46e... s3: Remove smbd_server_fd() from smbd_server_connection_handler via 8e7a92b... s3: Remove smbd_server_fd() from smbd_server_connection_read_handler via 6737c3d... s3: Remove smbd_server_fd() from chain_reply via b9d052c... s3: Remove smbd_server_fd() from construct_reply via 61989a9... s3: Remove smbd_server_fd() from switch_message via ee79625... s3: Remove smbd_server_fd() from smbd_server_connection_loop_once via 95b232a... s3: Remove smbd_server_fd() from receive_smb_raw_talloc_partial_read via 4a27c10... s3: Remove smbd_server_fd() from make_connection via 897d091... s3: Remove smbd_server_fd() from share_sanity_checks via 05604b3... s3: Remove smbd_server_fd() from setup_new_vc_session via a98604d... s3: Remove smbd_server_fd() from make_connection_snum via 910e3df... s3: Remove smbd_server_fd() from reply_echo via 495bb1e... s3: Remove smbd_server_fd() from reply_writebraw via 36cfc1d... s3: Remove smbd_server_fd() from send_file_readX via 209b3ae... s3: Remove smbd_server_fd() from send_file_readbraw via cc5f838... s3: Remove smbd_server_fd() from reply_readbraw_error via 5964550... s3: Remove smbd_server_fd() from sendfile_short_send via 6f85247... s3: Remove smbd_server_fd() from fake_sendfile via 3e28c05... s3: Remove smbd_server_fd from netbios_session_retarget via 2d571fd... s3: Remove smbd_server_fd from vfs_pwrite_data via 30ce022... s3: Remove smbd_server_fd from vfs_write_data via a92efa0... s3: Remove smbd_server_fd from send_trans2_replies via 50b3ee5... s3: Remove smbd_server_fd from smbd_initialize_smb2 via 0e12c21... s3: Remove smbd_server_fd from reply_special via 7a1c32c... s3: Remove smbd_server_fd from pipe_write_done via 7c0c7f3... s3: Remove smbd_server_fd from send_break_message_smb1 via e34c5e2... s3: Remove smbd_server_fd from api_dcerpc_cmd_read/write_done via 215d803... s3: Remove smbd_server_fd from send_trans_reply via 9878fa6... s3: Remove smbd_server_fd from send_nt_replies via 774bae7... s3: Remove smbd_server_fd from blocking_lock_reply_error via 9115beb... s3: Remove smbd_server_fd from generic_blocking_lock_error via c9458a7... s3: Remove smbd_server_fd from handle_aio_read/write_complete via bda7c70... s3: Remove smbd_server_fd from schedule_aio_write_and_X via 2f53d1d... s3: Add "sock" to smbd_server_connection from 7644fbd... s3-waf: Added missing client option to pidl list for wbint.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 68e86969fae55584f12191f09ac0442d09872030 Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 15 11:43:46 2010 +0200 s3: Remove smbd_server_fd() from smbd_process commit 0bd39c73be4cc14ac0961441f8ab3e65d0e9346a Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 15 11:41:08 2010 +0200 s3: Remove smbd_server_fd() from smbd_echo_loop commit 2cd643865d89b403f1b30b68ba4e6f040705dc8d Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 15 11:40:28 2010 +0200 s3: Remove smbd_server_fd() from smbd_echo_reader commit a23483310d4403071ec77e50d83b1a679ca20cdf Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 15 11:39:09 2010 +0200 s3: Remove smbd_server_fd() from smbd_echo_reply commit bb867df269a3c39c6f757f53c3770a0501eb42ff Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 15 11:36:27 2010 +0200 s3: Remove smbd_server_fd() from keepalive_fn commit a2bf46e9ec27092cf25515587956cbd68a909248 Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 15 11:35:23 2010 +0200 s3: Remove smbd_server_fd() from smbd_server_connection_handler commit 8e7a92bc242bf167a62e36f0d9258af41d39cb25 Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 15 11:34:48 2010 +0200 s3: Remove smbd_server_fd() from smbd_server_connection_read_handler commit 6737c3dd32aeff76322f0f6056612f71da2fe45e Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 15 11:33:53 2010 +0200 s3: Remove smbd_server_fd() from chain_reply commit b9d052c72874de91ffabc2fb75e1af57e0d4f839 Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 15 11:33:05 2010 +0200 s3: Remove smbd_server_fd() from construct_reply commit 61989a9e54ef0ded0fbf2d5353aa8d0c0e34e409 Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 15 11:31:51 2010 +0200 s3: Remove smbd_server_fd() from switch_message commit ee796255cee4efa280b8896deca492a877b2e135 Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 15 11:31:13 2010 +0200 s3: Remove smbd_server_fd() from smbd_server_connection_loop_once commit 95b232a008c00d69280f0fb15425d5f10c21b7a1 Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 15 11:29:44 2010 +0200 s3: Remove smbd_server_fd() from receive_smb_raw_talloc_partial_read commit 4a27c10903a90604c354dc335a7e42c15b798a1d Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 15 11:10:13 2010 +0200 s3: Remove smbd_server_fd() from make_connection commit 897d09174d541a2fcdb35b424167c78b0c5fcce3 Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 15 11:05:18 2010 +0200 s3: Remove smbd_server_fd() from share_sanity_checks commit 05604b315b41a8af02dc7e28436625cd5236bfbd Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 15 09:24:30 2010 +0200 s3: Remove smbd_server_fd() from setup_new_vc_session commit a98604d7f281f890fefd23e23e887c2199842484 Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 15 09:24:17 2010 +0200 s3: Remove smbd_server_fd() from make_connection_snum commit 910e3df7dd10e43e058874002b60e452c13cfa18 Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 15 08:59:19 2010 +0200 s3: Remove smbd_server_fd() from reply_echo commit 495bb1efb3f4ee38b97438e20d295c8e3c959fbb Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 15 08:57:26 2010 +0200 s3: Remove smbd_server_fd() from reply_writebraw commit 36cfc1d145d003005111612c67474fac5b9f442e Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 15 08:56:18 2010 +0200 s3: Remove smbd_server_fd() from send_file_readX commit 209b3aee1c265a3d81ede4242963c043288289bb Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 15 08:54:23 2010 +0200 s3: Remove smbd_server_fd() from send_file_readbraw commit cc5f83831961fdcee1a286ff465e616cbcba1f13 Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 15 08:52:01 2010 +0200 s3: Remove smbd_server_fd() from reply_readbraw_error commit 59645506a092ed2d9b49d901c45968d10ea3b6a2 Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 15 08:51:28 2010 +0200 s3: Remove smbd_server_fd() from sendfile_short_send commit 6f85247494e04657a11e0a05933bdc2da788277e Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 15 08:50:26 2010 +0200 s3: Remove smbd_server_fd() from fake_sendfile commit 3e28c05e98485c0cd3ffa3855314128400f32ad9 Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 15 08:48:54 2010 +0200 s3: Remove smbd_server_fd from netbios_session_retarget commit 2d571fdddbe86672ce47f22d8dd05e6dddaffa06 Author: Volker Lendecke <v...@samba.org> Date: Sat Aug 14 23:14:26 2010 +0200 s3: Remove smbd_server_fd from vfs_pwrite_data commit 30ce02299b3c6cb7e2f9f80ce530e8d5e3441d6c Author: Volker Lendecke <v...@samba.org> Date: Sat Aug 14 23:14:16 2010 +0200 s3: Remove smbd_server_fd from vfs_write_data commit a92efa0e4738bef8a5411fb7a0bb361e3a67ca14 Author: Volker Lendecke <v...@samba.org> Date: Sat Aug 14 23:13:28 2010 +0200 s3: Remove smbd_server_fd from send_trans2_replies commit 50b3ee57e2860c4074de356a45f9d54a3236f3e8 Author: Volker Lendecke <v...@samba.org> Date: Sat Aug 14 23:13:11 2010 +0200 s3: Remove smbd_server_fd from smbd_initialize_smb2 commit 0e12c216dcf2fccccd6b38dfbe532bfa2593ae79 Author: Volker Lendecke <v...@samba.org> Date: Sat Aug 14 23:12:46 2010 +0200 s3: Remove smbd_server_fd from reply_special commit 7a1c32c98a7b536fd1478f33c2e56cc2522d7eba Author: Volker Lendecke <v...@samba.org> Date: Sat Aug 14 23:12:21 2010 +0200 s3: Remove smbd_server_fd from pipe_write_done commit 7c0c7f33379efd3caa222e4c76d7390d5aadd58b Author: Volker Lendecke <v...@samba.org> Date: Sat Aug 14 23:12:01 2010 +0200 s3: Remove smbd_server_fd from send_break_message_smb1 commit e34c5e235d831160599202960cc1a3411883934f Author: Volker Lendecke <v...@samba.org> Date: Sat Aug 14 23:11:43 2010 +0200 s3: Remove smbd_server_fd from api_dcerpc_cmd_read/write_done commit 215d803cdbfeb7df8b4cc20c7b8d532b7be7bb99 Author: Volker Lendecke <v...@samba.org> Date: Sat Aug 14 23:11:23 2010 +0200 s3: Remove smbd_server_fd from send_trans_reply commit 9878fa6f725e4c44b863de0b18269746b9ca7144 Author: Volker Lendecke <v...@samba.org> Date: Sat Aug 14 23:10:45 2010 +0200 s3: Remove smbd_server_fd from send_nt_replies commit 774bae74d15621c303228c44ce4ea3707f9e078c Author: Volker Lendecke <v...@samba.org> Date: Sat Aug 14 23:10:18 2010 +0200 s3: Remove smbd_server_fd from blocking_lock_reply_error commit 9115beb88c1640f00b5d5cddcfc2a09a54b3a90e Author: Volker Lendecke <v...@samba.org> Date: Sat Aug 14 23:10:01 2010 +0200 s3: Remove smbd_server_fd from generic_blocking_lock_error commit c9458a756cd48abb69e5c520baba00f954ca445f Author: Volker Lendecke <v...@samba.org> Date: Sat Aug 14 14:54:13 2010 +0200 s3: Remove smbd_server_fd from handle_aio_read/write_complete commit bda7c70bc0c04eeb0adb2a1a08bf958895a68879 Author: Volker Lendecke <v...@samba.org> Date: Sat Aug 14 14:53:45 2010 +0200 s3: Remove smbd_server_fd from schedule_aio_write_and_X commit 2f53d1deb7a244e67302425d0f5e82caaa51f027 Author: Volker Lendecke <v...@samba.org> Date: Sat Aug 14 14:52:59 2010 +0200 s3: Add "sock" to smbd_server_connection ----------------------------------------------------------------------- Summary of changes: source3/smbd/aio.c | 7 +++-- source3/smbd/blocking.c | 4 +- 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 | 54 +++++++++++++++++++++---------------------- source3/smbd/reply.c | 43 ++++++++++++++++++++-------------- source3/smbd/server.c | 1 + source3/smbd/service.c | 26 +++++++++++++------- source3/smbd/sesssetup.c | 18 +++++++++----- source3/smbd/smb2_server.c | 4 +- source3/smbd/trans2.c | 4 +- source3/smbd/vfs.c | 4 +- 15 files changed, 102 insertions(+), 80 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c index 29b2fc4..281c296 100644 --- a/source3/smbd/aio.c +++ b/source3/smbd/aio.c @@ -357,7 +357,8 @@ 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(smbd_server_fd(),(char *)aio_ex->outbuf.data, + if (!srv_send_smb(aio_ex->smbreq->sconn->sock, + (char *)aio_ex->outbuf.data, true, aio_ex->smbreq->seqnum+1, IS_CONN_ENCRYPTED(fsp->conn), &aio_ex->smbreq->pcd)) { @@ -632,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(smbd_server_fd(),outbuf, + if (!srv_send_smb(aio_ex->smbreq->sconn->sock, 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 " @@ -721,7 +722,7 @@ static int handle_aio_write_complete(struct aio_extra *aio_ex, int errcode) } show_msg(outbuf); - if (!srv_send_smb(smbd_server_fd(),outbuf, + if (!srv_send_smb(aio_ex->smbreq->sconn->sock, 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 1b7431b..ee50963 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(smbd_server_fd(), (char *)blr->req->outbuf, + if (!srv_send_smb(blr->req->sconn->sock, (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(smbd_server_fd(), + if (!srv_send_smb(blr->req->sconn->sock, (char *)blr->req->outbuf, true, blr->req->seqnum+1, IS_CONN_ENCRYPTED(blr->fsp->conn), diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h index 92a3f76..cf23509 100644 --- a/source3/smbd/globals.h +++ b/source3/smbd/globals.h @@ -457,6 +457,7 @@ struct smbd_smb2_tcon { struct pending_auth_data; struct smbd_server_connection { + int sock; const struct tsocket_address *local_address; const struct tsocket_address *remote_address; struct messaging_context *msg_ctx; diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c index 3674c0d..c961fc4 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(smbd_server_fd(), (char *)req->outbuf, + if (!srv_send_smb(sconn->sock, (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(smbd_server_fd(), (char *)req->outbuf, + if (!srv_send_smb(sconn->sock, (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( - smbd_server_fd(), (char *)req->outbuf, + req->sconn->sock, (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(smbd_server_fd(), (char *)req->outbuf, + if (!srv_send_smb(req->sconn->sock, (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 839d1b3..07df67d 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(smbd_server_fd(), + if (!srv_send_smb(sconn->sock, (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(smbd_server_fd(), + if (!srv_send_smb(sconn->sock, (char *)req->outbuf, true, req->seqnum+1, IS_CONN_ENCRYPTED(conn), diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index a878f36..44060d5 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(smbd_server_fd(), + if (!srv_send_smb(fsp->conn->sconn->sock, break_msg, false, 0, IS_CONN_ENCRYPTED(fsp->conn), NULL)) { diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c index d321c7a..97f1c70 100644 --- a/source3/smbd/pipes.c +++ b/source3/smbd/pipes.c @@ -239,7 +239,7 @@ static void pipe_write_done(struct tevent_req *subreq) DEBUG(3,("write-IPC nwritten=%d\n", (int)nwritten)); send: - if (!srv_send_smb(smbd_server_fd(), (char *)req->outbuf, + if (!srv_send_smb(req->sconn->sock, (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 9ce4bbb..7430e35 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -261,7 +261,7 @@ static NTSTATUS receive_smb_raw_talloc_partial_read(TALLOC_CTX *mem_ctx, if (doff > STANDARD_WRITE_AND_X_HEADER_SIZE) { size_t drain = doff - STANDARD_WRITE_AND_X_HEADER_SIZE; - if (drain_socket(smbd_server_fd(), drain) != drain) { + if (drain_socket(fd, drain) != drain) { smb_panic("receive_smb_raw_talloc_partial_read:" " failed to drain pending bytes"); } @@ -962,14 +962,14 @@ static NTSTATUS smbd_server_connection_loop_once(struct smbd_server_connection * } if ((conn->smb1.echo_handler.trusted_fd != -1) - && FD_ISSET(smbd_server_fd(), &r_fds) + && FD_ISSET(conn->sock, &r_fds) && FD_ISSET(conn->smb1.echo_handler.trusted_fd, &r_fds)) { /* * Prefer to read pending requests from the echo handler. To * quote Jeremy (da70f8ab1): This is a hack of monstrous * proportions... */ - FD_CLR(smbd_server_fd(), &r_fds); + FD_CLR(conn->sock, &r_fds); } if (run_events(smbd_event_context(), selrtn, &r_fds, &w_fds)) { @@ -1526,7 +1526,7 @@ static connection_struct *switch_message(uint8 type, struct smb_request *req, in /* does this protocol need to be run as guest? */ if ((flags & AS_GUEST) && (!change_to_guest() || - !check_access(smbd_server_fd(), lp_hostsallow(-1), + !check_access(sconn->sock, lp_hostsallow(-1), lp_hostsdeny(-1)))) { reply_nterror(req, NT_STATUS_ACCESS_DENIED); return conn; @@ -1571,7 +1571,7 @@ static void construct_reply(char *inbuf, int size, size_t unread_bytes, if (req->unread_bytes) { /* writeX failed. drain socket. */ - if (drain_socket(smbd_server_fd(), req->unread_bytes) != + if (drain_socket(req->sconn->sock, req->unread_bytes) != req->unread_bytes) { smb_panic("failed to drain pending bytes"); } @@ -1591,7 +1591,7 @@ static void construct_reply(char *inbuf, int size, size_t unread_bytes, show_msg((char *)req->outbuf); } - if (!srv_send_smb(smbd_server_fd(), + if (!srv_send_smb(req->sconn->sock, (char *)req->outbuf, true, req->seqnum+1, IS_CONN_ENCRYPTED(conn)||req->encrypted, @@ -2030,7 +2030,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(smbd_server_fd(), (char *)req->chain_outbuf, + if (!srv_send_smb(req->sconn->sock, (char *)req->chain_outbuf, true, req->seqnum+1, IS_CONN_ENCRYPTED(req->conn) ||req->encrypted, @@ -2170,7 +2170,7 @@ void chain_reply(struct smb_request *req) show_msg((char *)(req->chain_outbuf)); - if (!srv_send_smb(smbd_server_fd(), (char *)req->chain_outbuf, + if (!srv_send_smb(req->sconn->sock, (char *)req->chain_outbuf, true, req->seqnum+1, IS_CONN_ENCRYPTED(req->conn)||req->encrypted, &req->pcd)) { @@ -2261,12 +2261,12 @@ static void smbd_server_connection_read_handler( NTSTATUS status; uint32_t seqnum; - bool from_client = (smbd_server_fd() == fd); + bool from_client = (conn->sock == fd); if (from_client) { smbd_lock_socket(conn); - if (!fd_is_readable(smbd_server_fd())) { + if (!fd_is_readable(fd)) { DEBUG(10,("the echo listener was faster\n")); smbd_unlock_socket(conn); return; @@ -2320,7 +2320,7 @@ static void smbd_server_connection_handler(struct event_context *ev, return; } if (flags & EVENT_FD_READ) { - smbd_server_connection_read_handler(conn, smbd_server_fd()); + smbd_server_connection_read_handler(conn, conn->sock); return; } } @@ -2412,7 +2412,7 @@ static bool keepalive_fn(const struct timeval *now, void *private_data) } smbd_lock_socket(smbd_server_conn); - ret = send_keepalive(smbd_server_fd()); + ret = send_keepalive(sconn->sock); smbd_unlock_socket(smbd_server_conn); if (!ret) { @@ -2565,8 +2565,7 @@ static void smbd_echo_writer_done(struct tevent_req *req) smbd_echo_activate_writer(state); } -static bool smbd_echo_reply(int fd, - uint8_t *inbuf, size_t inbuf_len, +static bool smbd_echo_reply(uint8_t *inbuf, size_t inbuf_len, uint32_t seqnum) { struct smb_request req; @@ -2622,7 +2621,7 @@ static bool smbd_echo_reply(int fd, out_len = smb_len(req.outbuf) + 4; - ok = srv_send_smb(smbd_server_fd(), + ok = srv_send_smb(req.sconn->sock, (char *)outbuf, true, seqnum+1, false, &req.pcd); @@ -2666,7 +2665,7 @@ static void smbd_echo_reader(struct tevent_context *ev, exit(1); } - if (!fd_is_readable(smbd_server_fd())) { + if (!fd_is_readable(sconn->sock)) { DEBUG(10,("echo_handler[%d] the parent smbd was faster\n", (int)sys_getpid())); ok = smbd_unlock_socket_internal(sconn); @@ -2689,7 +2688,7 @@ static void smbd_echo_reader(struct tevent_context *ev, DEBUG(10,("echo_handler[%d]: reading pdu\n", (int)sys_getpid())); - status = receive_smb_talloc(state->pending, smbd_server_fd(), + status = receive_smb_talloc(state->pending, sconn->sock, (char **)(void *)&state->pending[num_pending].iov_base, 0 /* timeout */, &unread, @@ -2717,8 +2716,7 @@ static void smbd_echo_reader(struct tevent_context *ev, SIVAL((uint8_t *)state->pending[num_pending].iov_base, smb_ss_field, seqnum); SIVAL((uint8_t *)state->pending[num_pending].iov_base, smb_ss_field+4, NT_STATUS_V(NT_STATUS_OK)); - reply = smbd_echo_reply(smbd_server_fd(), - (uint8_t *)state->pending[num_pending].iov_base, + reply = smbd_echo_reply((uint8_t *)state->pending[num_pending].iov_base, state->pending[num_pending].iov_len, seqnum); if (reply) { @@ -2759,7 +2757,7 @@ static void smbd_echo_loop(struct smbd_server_connection *sconn, TALLOC_FREE(state); return; } - state->read_fde = tevent_add_fd(state->ev, state, smbd_server_fd(), + state->read_fde = tevent_add_fd(state->ev, state, sconn->sock, TEVENT_FD_READ, smbd_echo_reader, state); if (state->read_fde == NULL) { @@ -2883,14 +2881,14 @@ void smbd_process(struct smbd_server_connection *sconn) } /* Ensure child is set to blocking mode */ - set_blocking(smbd_server_fd(),True); + set_blocking(sconn->sock,True); - set_socket_options(smbd_server_fd(),"SO_KEEPALIVE"); - set_socket_options(smbd_server_fd(), lp_socket_options()); + set_socket_options(sconn->sock, "SO_KEEPALIVE"); + set_socket_options(sconn->sock, lp_socket_options()); sa = (struct sockaddr *)(void *)&ss; sa_len = sizeof(ss); - ret = getpeername(smbd_server_fd(), sa, &sa_len); + ret = getpeername(sconn->sock, sa, &sa_len); if (ret != 0) { int level = (errno == ENOTCONN)?2:0; DEBUG(level,("getpeername() failed - %s\n", strerror(errno))); @@ -2907,7 +2905,7 @@ void smbd_process(struct smbd_server_connection *sconn) sa = (struct sockaddr *)(void *)&ss; sa_len = sizeof(ss); - ret = getsockname(smbd_server_fd(), sa, &sa_len); + ret = getsockname(sconn->sock, sa, &sa_len); if (ret != 0) { int level = (errno == ENOTCONN)?2:0; DEBUG(level,("getsockname() failed - %s\n", strerror(errno))); @@ -2948,7 +2946,7 @@ void smbd_process(struct smbd_server_connection *sconn) * the hosts allow list. */ - if (!check_access(smbd_server_fd(), lp_hostsallow(-1), + if (!check_access(sconn->sock, lp_hostsallow(-1), lp_hostsdeny(-1))) { /* * send a negative session response "not listening on calling @@ -2958,7 +2956,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(smbd_server_fd(),(char *)buf, false, + (void)srv_send_smb(sconn->sock,(char *)buf, false, 0, false, NULL); exit_server_cleanly("connection denied"); } @@ -3097,7 +3095,7 @@ void smbd_process(struct smbd_server_connection *sconn) sconn->smb1.fde = event_add_fd(smbd_event_context(), sconn, - smbd_server_fd(), + sconn->sock, EVENT_FD_READ, smbd_server_connection_handler, sconn); diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index ed6d3bc..97451e6 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -390,7 +390,8 @@ bool check_fsp_ntquota_handle(connection_struct *conn, struct smb_request *req, return true; } -static bool netbios_session_retarget(const char *name, int name_type) +static bool netbios_session_retarget(struct smbd_server_connection *sconn, + const char *name, int name_type) { char *trim_name; char *trim_name_type; @@ -404,7 +405,7 @@ static bool netbios_session_retarget(const char *name, int name_type) bool ret = false; uint8_t outbuf[10]; - if (get_socket_port(smbd_server_fd()) != 139) { + if (get_socket_port(sconn->sock) != 139) { return false; } @@ -467,7 +468,7 @@ static bool netbios_session_retarget(const char *name, int name_type) *(uint32_t *)(outbuf+4) = in_addr->sin_addr.s_addr; *(uint16_t *)(outbuf+8) = htons(retarget_port); - if (!srv_send_smb(smbd_server_fd(), (char *)outbuf, false, 0, false, + if (!srv_send_smb(sconn->sock, (char *)outbuf, false, 0, false, NULL)) { exit_server_cleanly("netbios_session_regarget: srv_send_smb " "failed."); @@ -522,7 +523,7 @@ void reply_special(struct smbd_server_connection *sconn, char *inbuf) DEBUG(2,("netbios connect: name1=%s0x%x name2=%s0x%x\n", name1, name_type1, name2, name_type2)); - if (netbios_session_retarget(name1, name_type1)) { + if (netbios_session_retarget(sconn, name1, name_type1)) { exit_server_cleanly("retargeted client"); } @@ -573,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(smbd_server_fd(), outbuf, false, 0, false, NULL); + srv_send_smb(sconn->sock, outbuf, false, 0, false, NULL); return; } @@ -2809,7 +2810,8 @@ static ssize_t fake_sendfile(files_struct *fsp, SMB_OFF_T startpos, memset(buf + ret, '\0', cur_read - ret); } - if (write_data(smbd_server_fd(),buf,cur_read) != cur_read) { + if (write_data(fsp->conn->sconn->sock, buf, cur_read) + != cur_read) { SAFE_FREE(buf); return -1; } @@ -2870,7 +2872,8 @@ static void sendfile_short_send(files_struct *fsp, size_t to_write; to_write = MIN(SHORT_SEND_BUFSIZE, smb_maxcnt - nread); - if (write_data(smbd_server_fd(), buf, to_write) != to_write) { + if (write_data(fsp->conn->sconn->sock, buf, to_write) + != to_write) { exit_server_cleanly("sendfile_short_send: " "write_data failed"); } @@ -2892,7 +2895,7 @@ static void reply_readbraw_error(struct smbd_server_connection *sconn) SIVAL(header,0,0); smbd_lock_socket(sconn); - if (write_data(smbd_server_fd(),header,4) != 4) { + if (write_data(sconn->sock,header,4) != 4) { fail_readraw(); } smbd_unlock_socket(sconn); @@ -2931,8 +2934,10 @@ static void send_file_readbraw(connection_struct *conn, _smb_setlen(header,nread); header_blob = data_blob_const(header, 4); - if ((sendfile_read = SMB_VFS_SENDFILE(smbd_server_fd(), fsp, - &header_blob, startpos, nread)) == -1) { + sendfile_read = SMB_VFS_SENDFILE(sconn->sock, fsp, + &header_blob, startpos, + nread); + if (sendfile_read == -1) { /* Returning ENOSYS means no data at all was sent. * Do this as a normal read. */ if (errno == ENOSYS) { @@ -3008,7 +3013,7 @@ normal_readbraw: } _smb_setlen(outbuf,ret); - if (write_data(smbd_server_fd(),outbuf,4+ret) != 4+ret) + if (write_data(sconn->sock, outbuf, 4+ret) != 4+ret) fail_readraw(); TALLOC_FREE(outbuf); @@ -3474,7 +3479,9 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req, construct_reply_common_req(req, (char *)headerbuf); setup_readX_header(req, (char *)headerbuf, smb_maxcnt); - if ((nread = SMB_VFS_SENDFILE(smbd_server_fd(), fsp, &header, startpos, smb_maxcnt)) == -1) { + nread = SMB_VFS_SENDFILE(req->sconn->sock, fsp, &header, + startpos, smb_maxcnt); + if (nread == -1) { /* Returning ENOSYS means no data at all was sent. Do this as a normal read. */ if (errno == ENOSYS) { @@ -3549,7 +3556,7 @@ normal_read: setup_readX_header(req, (char *)headerbuf, smb_maxcnt); /* Send out the header. */ - if (write_data(smbd_server_fd(), (char *)headerbuf, + if (write_data(req->sconn->sock, (char *)headerbuf, sizeof(headerbuf)) != sizeof(headerbuf)) { DEBUG(0,("send_file_readX: write_data failed for file " "%s (%s). Terminating\n", fsp_str_dbg(fsp), @@ -3867,7 +3874,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(smbd_server_fd(), + if (!srv_send_smb(req->sconn->sock, -- Samba Shared Repository