The branch, master has been updated via e114a21 s3: Remove unused ERROR_FORCE_NT macro via 9b1e4cf s3: Remove unused ERROR_DOS macro via d20e968 s3: Move deferred_open_queue to smbd_server_connection via cb69d10 s3: Pass sconn explicitly to get_deferred_open_message_smb via f9d183f s3: Pass sconn explicitly to open_was_deferred via 502fdae s3: Pass sconn explicitly to schedule_deferred_open_message_smb via 04253df s3: Explicitly pass sconn to remove_deferred_open_message_smb via 77f5246 s3: Fix some nonempty blank lines from a68f16c s3:server Consolidate printing related initialization
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit e114a21cc27504efc31f9be1616b91c6b1fcc59d Author: Volker Lendecke <v...@samba.org> Date: Tue Aug 2 17:18:15 2011 +0200 s3: Remove unused ERROR_FORCE_NT macro Autobuild-User: Volker Lendecke <vlen...@samba.org> Autobuild-Date: Tue Aug 2 20:32:08 CEST 2011 on sn-devel-104 commit 9b1e4cfb8f0495cc4af6043c72ff09edf3a0565a Author: Volker Lendecke <v...@samba.org> Date: Tue Aug 2 17:17:29 2011 +0200 s3: Remove unused ERROR_DOS macro commit d20e968cff86eaad62e5fef8d3ee16f8767f8054 Author: Volker Lendecke <v...@samba.org> Date: Tue Aug 2 17:13:23 2011 +0200 s3: Move deferred_open_queue to smbd_server_connection commit cb69d105f5cb0336e3b97bf864d164d4daeab5ab Author: Volker Lendecke <v...@samba.org> Date: Tue Aug 2 17:07:25 2011 +0200 s3: Pass sconn explicitly to get_deferred_open_message_smb commit f9d183f931f021c7b76047766838388cb7686c37 Author: Volker Lendecke <v...@samba.org> Date: Tue Aug 2 17:05:33 2011 +0200 s3: Pass sconn explicitly to open_was_deferred commit 502fdae7f134bda53e6c95e3a336e7b2fcda77f2 Author: Volker Lendecke <v...@samba.org> Date: Tue Aug 2 16:58:46 2011 +0200 s3: Pass sconn explicitly to schedule_deferred_open_message_smb commit 04253dfd9fb024bb8c227b0d9ccb81efa208fabe Author: Volker Lendecke <v...@samba.org> Date: Tue Aug 2 16:53:33 2011 +0200 s3: Explicitly pass sconn to remove_deferred_open_message_smb commit 77f5246f09138c86b8a391a7aa8a0522feb324f6 Author: Volker Lendecke <v...@samba.org> Date: Tue Aug 2 16:44:53 2011 +0200 s3: Fix some nonempty blank lines ----------------------------------------------------------------------- Summary of changes: source3/include/smb_macros.h | 8 ++---- source3/smbd/close.c | 13 ++++++++--- source3/smbd/error.c | 6 ++-- source3/smbd/globals.c | 1 - source3/smbd/globals.h | 6 +++- source3/smbd/nttrans.c | 6 ++-- source3/smbd/open.c | 4 +- source3/smbd/oplock.c | 20 ++++++++++++----- source3/smbd/process.c | 47 +++++++++++++++++++++++------------------ source3/smbd/proto.h | 8 ++++-- source3/smbd/reply.c | 14 ++++++------ source3/smbd/smb2_create.c | 2 +- source3/smbd/trans2.c | 4 +- 13 files changed, 79 insertions(+), 60 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h index aba1455..957db5b 100644 --- a/source3/include/smb_macros.h +++ b/source3/include/smb_macros.h @@ -5,17 +5,17 @@ Copyright (C) John H Terpstra 1996-1999 Copyright (C) Luke Kenneth Casson Leighton 1996-1999 Copyright (C) Paul Ashton 1998 - 1999 - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ @@ -104,9 +104,7 @@ #define SMB_LARGE_LKLEN_OFFSET_HIGH(indx) (12 + (20 * (indx))) #define SMB_LARGE_LKLEN_OFFSET_LOW(indx) (16 + (20 * (indx))) -#define ERROR_DOS(class,code) error_packet(outbuf,class,code,NT_STATUS_OK,__LINE__,__FILE__) #define ERROR_NT(status) error_packet(outbuf,0,0,status,__LINE__,__FILE__) -#define ERROR_FORCE_NT(status) error_packet(outbuf,-1,-1,status,__LINE__,__FILE__) #define ERROR_BOTH(status,class,code) error_packet(outbuf,class,code,status,__LINE__,__FILE__) #define reply_nterror(req,status) reply_nt_error(req,status,__LINE__,__FILE__) diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 43861b3..a1b6fd8 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -167,22 +167,27 @@ static void notify_deferred_opens(struct messaging_context *msg_ctx, if (!should_notify_deferred_opens()) { return; } - + for (i=0; i<lck->num_share_modes; i++) { struct share_mode_entry *e = &lck->share_modes[i]; - + if (!is_deferred_open_entry(e)) { continue; } - + if (procid_is_me(&e->pid)) { + struct smbd_server_connection *sconn; /* * We need to notify ourself to retry the open. Do * this by finding the queued SMB record, moving it to * the head of the queue and changing the wait time to * zero. */ - schedule_deferred_open_message_smb(e->op_mid); + sconn = msg_ctx_to_sconn(msg_ctx); + if (sconn != NULL) { + schedule_deferred_open_message_smb( + sconn, e->op_mid); + } } else { char msg[MSG_SMB_SHARE_MODE_ENTRY_SIZE]; diff --git a/source3/smbd/error.c b/source3/smbd/error.c index 2fb4241..815b857 100644 --- a/source3/smbd/error.c +++ b/source3/smbd/error.c @@ -2,17 +2,17 @@ Unix SMB/CIFS implementation. error packet handling Copyright (C) Andrew Tridgell 1992-1998 - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ diff --git a/source3/smbd/globals.c b/source3/smbd/globals.c index bf36dcb..8cc1a31 100644 --- a/source3/smbd/globals.c +++ b/source3/smbd/globals.c @@ -65,7 +65,6 @@ time_t last_printer_reload_time = 0; structure to hold a linked list of queued messages. for processing. ****************************************************************************/ -struct pending_message_list *deferred_open_queue = NULL; uint32_t common_flags2 = FLAGS2_LONG_PATH_COMPONENTS|FLAGS2_32_BIT_ERROR_CODES|FLAGS2_EXTENDED_ATTRIBUTES; struct smb_srv_trans_enc_ctx *partial_srv_trans_enc_ctx = NULL; diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h index 6d13e56..9e8059b 100644 --- a/source3/smbd/globals.h +++ b/source3/smbd/globals.h @@ -70,8 +70,6 @@ extern time_t last_printer_reload_time; structure to hold a linked list of queued messages. for processing. ****************************************************************************/ -struct pending_message_list; -extern struct pending_message_list *deferred_open_queue; extern uint32_t common_flags2; struct smb_srv_trans_enc_ctx; @@ -447,6 +445,7 @@ struct smbd_smb2_tcon { connection_struct *compat_conn; }; +struct pending_message_list; struct pending_auth_data; struct smbd_server_connection { @@ -478,6 +477,9 @@ struct smbd_server_connection { /* number of open connections (tcons) */ int num_tcons_open; + struct pending_message_list *deferred_open_queue; + + /* open directory handles. */ struct { struct bitmap *dptr_bmap; diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index 9f745f2..8900ec8 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -584,7 +584,7 @@ void reply_ntcreate_and_X(struct smb_request *req) &info); /* pinfo */ if (!NT_STATUS_IS_OK(status)) { - if (open_was_deferred(req->mid)) { + if (open_was_deferred(req->sconn, req->mid)) { /* We have re-scheduled this call, no error. */ goto out; } @@ -1159,7 +1159,7 @@ static void call_nt_transact_create(connection_struct *conn, &info); /* pinfo */ if(!NT_STATUS_IS_OK(status)) { - if (open_was_deferred(req->mid)) { + if (open_was_deferred(req->sconn, req->mid)) { /* We have re-scheduled this call, no error. */ return; } @@ -1642,7 +1642,7 @@ void reply_ntrename(struct smb_request *req) } if (!NT_STATUS_IS_OK(status)) { - if (open_was_deferred(req->mid)) { + if (open_was_deferred(req->sconn, req->mid)) { /* We have re-scheduled this call. */ goto out; } diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 510dfe0..61d1a2e 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -794,7 +794,7 @@ static void validate_my_share_entries(struct smbd_server_connection *sconn, } if (is_deferred_open_entry(share_entry) && - !open_was_deferred(share_entry->op_mid)) { + !open_was_deferred(sconn, share_entry->op_mid)) { char *str = talloc_asprintf(talloc_tos(), "Got a deferred entry without a request: " "PANIC: %s\n", @@ -1621,7 +1621,7 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn, sconn_server_id(req->sconn)); /* Ensure we don't reprocess this message. */ - remove_deferred_open_message_smb(req->mid); + remove_deferred_open_message_smb(req->sconn, req->mid); } } diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index 284b032..bba2e35 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -4,17 +4,17 @@ Copyright (C) Andrew Tridgell 1992-1998 Copyright (C) Jeremy Allison 1998 - 2001 Copyright (C) Volker Lendecke 2005 - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ @@ -688,6 +688,7 @@ static void process_oplock_break_response(struct messaging_context *msg_ctx, DATA_BLOB *data) { struct share_mode_entry msg; + struct smbd_server_connection *sconn; if (data->data == NULL) { DEBUG(0, ("Got NULL buffer\n")); @@ -707,7 +708,10 @@ static void process_oplock_break_response(struct messaging_context *msg_ctx, server_id_str(talloc_tos(), &src), file_id_string_tos(&msg.id), msg.share_file_id, (unsigned long long)msg.op_mid)); - schedule_deferred_open_message_smb(msg.op_mid); + sconn = msg_ctx_to_sconn(msg_ctx); + if (sconn != NULL) { + schedule_deferred_open_message_smb(sconn, msg.op_mid); + } } static void process_open_retry_message(struct messaging_context *msg_ctx, @@ -717,7 +721,8 @@ static void process_open_retry_message(struct messaging_context *msg_ctx, DATA_BLOB *data) { struct share_mode_entry msg; - + struct smbd_server_connection *sconn; + if (data->data == NULL) { DEBUG(0, ("Got NULL buffer\n")); return; @@ -735,7 +740,10 @@ static void process_open_retry_message(struct messaging_context *msg_ctx, server_id_str(talloc_tos(), &src), file_id_string_tos(&msg.id), (unsigned long long)msg.op_mid)); - schedule_deferred_open_message_smb(msg.op_mid); + sconn = msg_ctx_to_sconn(msg_ctx); + if (sconn != NULL) { + schedule_deferred_open_message_smb(sconn, msg.op_mid); + } } /**************************************************************************** diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 86e8347..b105de7 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -41,7 +41,8 @@ extern bool global_machine_password_needs_changing; static void construct_reply_common(struct smb_request *req, const char *inbuf, char *outbuf); -static struct pending_message_list *get_deferred_open_message_smb(uint64_t mid); +static struct pending_message_list *get_deferred_open_message_smb( + struct smbd_server_connection *sconn, uint64_t mid); static bool smbd_lock_socket_internal(struct smbd_server_connection *sconn) { @@ -580,9 +581,9 @@ static void smbd_deferred_open_timer(struct event_context *ev, msg->seqnum, msg->encrypted, &msg->pcd); /* If it's still there and was processed, remove it. */ - msg = get_deferred_open_message_smb(mid); + msg = get_deferred_open_message_smb(smbd_server_conn, mid); if (msg && msg->processed) { - remove_deferred_open_message_smb(mid); + remove_deferred_open_message_smb(smbd_server_conn, mid); } } @@ -640,7 +641,8 @@ static bool push_queued_message(struct smb_request *req, return false; } - DLIST_ADD_END(deferred_open_queue, msg, struct pending_message_list *); + DLIST_ADD_END(req->sconn->deferred_open_queue, msg, + struct pending_message_list *); DEBUG(10,("push_message: pushed message length %u on " "deferred_open_queue\n", (unsigned int)msg_len)); @@ -652,22 +654,23 @@ static bool push_queued_message(struct smb_request *req, Function to delete a sharing violation open message by mid. ****************************************************************************/ -void remove_deferred_open_message_smb(uint64_t mid) +void remove_deferred_open_message_smb(struct smbd_server_connection *sconn, + uint64_t mid) { struct pending_message_list *pml; - if (smbd_server_conn->using_smb2) { - remove_deferred_open_message_smb2(smbd_server_conn, mid); + if (sconn->using_smb2) { + remove_deferred_open_message_smb2(sconn, mid); return; } - for (pml = deferred_open_queue; pml; pml = pml->next) { + for (pml = sconn->deferred_open_queue; pml; pml = pml->next) { if (mid == (uint64_t)SVAL(pml->buf.data,smb_mid)) { DEBUG(10,("remove_deferred_open_message_smb: " "deleting mid %llu len %u\n", (unsigned long long)mid, (unsigned int)pml->buf.length )); - DLIST_REMOVE(deferred_open_queue, pml); + DLIST_REMOVE(sconn->deferred_open_queue, pml); TALLOC_FREE(pml); return; } @@ -679,17 +682,18 @@ void remove_deferred_open_message_smb(uint64_t mid) schedule it for immediate processing. ****************************************************************************/ -void schedule_deferred_open_message_smb(uint64_t mid) +void schedule_deferred_open_message_smb(struct smbd_server_connection *sconn, + uint64_t mid) { struct pending_message_list *pml; int i = 0; - if (smbd_server_conn->using_smb2) { - schedule_deferred_open_message_smb2(smbd_server_conn, mid); + if (sconn->using_smb2) { + schedule_deferred_open_message_smb2(sconn, mid); return; } - for (pml = deferred_open_queue; pml; pml = pml->next) { + for (pml = sconn->deferred_open_queue; pml; pml = pml->next) { uint64_t msg_mid = (uint64_t)SVAL(pml->buf.data,smb_mid); DEBUG(10,("schedule_deferred_open_message_smb: [%d] " @@ -727,7 +731,7 @@ void schedule_deferred_open_message_smb(uint64_t mid) TALLOC_FREE(pml->te); pml->te = te; - DLIST_PROMOTE(deferred_open_queue, pml); + DLIST_PROMOTE(sconn->deferred_open_queue, pml); return; } } @@ -741,15 +745,15 @@ void schedule_deferred_open_message_smb(uint64_t mid) Return true if this mid is on the deferred queue and was not yet processed. ****************************************************************************/ -bool open_was_deferred(uint64_t mid) +bool open_was_deferred(struct smbd_server_connection *sconn, uint64_t mid) { struct pending_message_list *pml; - if (smbd_server_conn->using_smb2) { - return open_was_deferred_smb2(smbd_server_conn, mid); + if (sconn->using_smb2) { + return open_was_deferred_smb2(sconn, mid); } - for (pml = deferred_open_queue; pml; pml = pml->next) { + for (pml = sconn->deferred_open_queue; pml; pml = pml->next) { if (((uint64_t)SVAL(pml->buf.data,smb_mid)) == mid && !pml->processed) { return True; } @@ -761,11 +765,12 @@ bool open_was_deferred(uint64_t mid) Return the message queued by this mid. ****************************************************************************/ -static struct pending_message_list *get_deferred_open_message_smb(uint64_t mid) +static struct pending_message_list *get_deferred_open_message_smb( + struct smbd_server_connection *sconn, uint64_t mid) { struct pending_message_list *pml; - for (pml = deferred_open_queue; pml; pml = pml->next) { + for (pml = sconn->deferred_open_queue; pml; pml = pml->next) { if (((uint64_t)SVAL(pml->buf.data,smb_mid)) == mid) { return pml; } @@ -789,7 +794,7 @@ bool get_deferred_open_message_state(struct smb_request *smbreq, pp_state); } - pml = get_deferred_open_message_smb(smbreq->mid); + pml = get_deferred_open_message_smb(smbreq->sconn, smbreq->mid); if (!pml) { return false; } diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 2b24f70..49fc8c7 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -771,9 +771,11 @@ int srv_set_message(char *buf, int num_words, int num_bytes, bool zero); -void remove_deferred_open_message_smb(uint64_t mid); -void schedule_deferred_open_message_smb(uint64_t mid); -bool open_was_deferred(uint64_t mid); +void remove_deferred_open_message_smb(struct smbd_server_connection *sconn, + uint64_t mid); +void schedule_deferred_open_message_smb(struct smbd_server_connection *sconn, + uint64_t mid); +bool open_was_deferred(struct smbd_server_connection *sconn, uint64_t mid); bool get_deferred_open_message_state(struct smb_request *smbreq, struct timeval *p_request_time, void **pp_state); diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 59ec8f2..2bc80f4 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -1816,7 +1816,7 @@ void reply_open(struct smb_request *req) &info); /* pinfo */ if (!NT_STATUS_IS_OK(status)) { - if (open_was_deferred(req->mid)) { + if (open_was_deferred(req->sconn, req->mid)) { /* We have re-scheduled this call. */ goto out; } @@ -1993,7 +1993,7 @@ void reply_open_and_X(struct smb_request *req) &smb_action); /* pinfo */ if (!NT_STATUS_IS_OK(status)) { - if (open_was_deferred(req->mid)) { + if (open_was_deferred(req->sconn, req->mid)) { /* We have re-scheduled this call. */ goto out; } @@ -2215,7 +2215,7 @@ void reply_mknew(struct smb_request *req) NULL); /* pinfo */ if (!NT_STATUS_IS_OK(status)) { - if (open_was_deferred(req->mid)) { + if (open_was_deferred(req->sconn, req->mid)) { /* We have re-scheduled this call. */ goto out; } @@ -2347,7 +2347,7 @@ void reply_ctemp(struct smb_request *req) close(tmpfd); if (!NT_STATUS_IS_OK(status)) { - if (open_was_deferred(req->mid)) { + if (open_was_deferred(req->sconn, req->mid)) { /* We have re-scheduled this call. */ goto out; } @@ -2822,7 +2822,7 @@ void reply_unlink(struct smb_request *req) status = unlink_internals(conn, req, dirtype, smb_fname, path_contains_wcard); if (!NT_STATUS_IS_OK(status)) { - if (open_was_deferred(req->mid)) { + if (open_was_deferred(req->sconn, req->mid)) { /* We have re-scheduled this call. */ goto out; } @@ -5663,7 +5663,7 @@ void reply_rmdir(struct smb_request *req) &info); /* pinfo */ if (!NT_STATUS_IS_OK(status)) { - if (open_was_deferred(req->mid)) { + if (open_was_deferred(req->sconn, req->mid)) { /* We have re-scheduled this call. */ goto out; } @@ -6678,7 +6678,7 @@ void reply_mv(struct smb_request *req) attrs, False, src_has_wcard, dest_has_wcard, DELETE_ACCESS); if (!NT_STATUS_IS_OK(status)) { - if (open_was_deferred(req->mid)) { + if (open_was_deferred(req->sconn, req->mid)) { /* We have re-scheduled this call. */ goto out; } diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c index 7c6b4bc..aaa461c 100644 --- a/source3/smbd/smb2_create.c +++ b/source3/smbd/smb2_create.c @@ -719,7 +719,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx, &result, &info); if (!NT_STATUS_IS_OK(status)) { - if (open_was_deferred(smb1req->mid)) { + if (open_was_deferred(smb1req->sconn, smb1req->mid)) { return req; } tevent_req_nterror(req, status); diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c -- Samba Shared Repository