From d28fa8faab5de5979dcd5535a7cd7095d3233e29 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 9 Jun 2010 19:12:02 -0700 Subject: Rename "allow_smb2" -> "using_smb2" and make the usage clearer. --- source3/modules/onefs_cbrl.c | 4 ++-- source3/smbd/blocking.c | 6 +++--- source3/smbd/conn.c | 6 +++--- source3/smbd/globals.h | 2 +- source3/smbd/msdfs.c | 2 +- source3/smbd/oplock.c | 6 +++--- source3/smbd/password.c | 2 +- source3/smbd/process.c | 27 ++++++++++++++++++--------- source3/smbd/reply.c | 2 +- 9 files changed, 33 insertions(+), 24 deletions(-) (limited to 'source3') diff --git a/source3/modules/onefs_cbrl.c b/source3/modules/onefs_cbrl.c index 6d5d8c65ae..4b0600b35c 100644 --- a/source3/modules/onefs_cbrl.c +++ b/source3/modules/onefs_cbrl.c @@ -90,7 +90,7 @@ static void onefs_cbrl_enumerate_blq(const char *fn) DEBUG(10, ("CBRL BLR records (%s):\n", fn)); - if (sconn->allow_smb2) { + if (sconn->using_smb2) { struct smbd_smb2_request *smb2req; for (smb2req = sconn->smb2.requests; smb2req; smb2req = nextreq) { blr = get_pending_smb2req_blr(smb2req); @@ -112,7 +112,7 @@ static struct blocking_lock_record *onefs_cbrl_find_blr(uint64_t id) onefs_cbrl_enumerate_blq("onefs_cbrl_find_blr"); - if (sconn->allow_smb2) { + if (sconn->using_smb2) { struct smbd_smb2_request *smb2req; for (smb2req = sconn->smb2.requests; smb2req; smb2req = nextreq) { blr = get_pending_smb2req_blr(smb2req); diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c index da14ce89c9..f2ef4b2aa9 100644 --- a/source3/smbd/blocking.c +++ b/source3/smbd/blocking.c @@ -41,7 +41,7 @@ void brl_timeout_fn(struct event_context *event_ctx, { struct smbd_server_connection *sconn = smbd_server_conn; - if (sconn->allow_smb2) { + if (sconn->using_smb2) { SMB_ASSERT(sconn->smb2.locks.brl_timeout == te); TALLOC_FREE(sconn->smb2.locks.brl_timeout); } else { @@ -578,7 +578,7 @@ void cancel_pending_lock_requests_by_fid(files_struct *fsp, struct smbd_server_connection *sconn = smbd_server_conn; struct blocking_lock_record *blr, *blr_cancelled, *next = NULL; - if (sconn->allow_smb2) { + if (sconn->using_smb2) { cancel_pending_lock_requests_by_fid_smb2(fsp, br_lck, close_type); @@ -713,7 +713,7 @@ void process_blocking_lock_queue(void) struct timeval tv_curr = timeval_current(); struct blocking_lock_record *blr, *next = NULL; - if (sconn->allow_smb2) { + if (sconn->using_smb2) { process_blocking_lock_queue_smb2(tv_curr); return; } diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c index 707f6c4aa1..eaaddabc84 100644 --- a/source3/smbd/conn.c +++ b/source3/smbd/conn.c @@ -94,7 +94,7 @@ connection_struct *conn_new(struct smbd_server_connection *sconn) int i; int find_offset = 1; - if (sconn->allow_smb2) { + if (sconn->using_smb2) { if (!(conn=TALLOC_ZERO_P(NULL, connection_struct)) || !(conn->params = TALLOC_P(conn, struct share_params))) { DEBUG(0,("TALLOC_ZERO() failed!\n")); @@ -177,7 +177,7 @@ return true if any were closed ****************************************************************************/ bool conn_close_all(struct smbd_server_connection *sconn) { - if (sconn->allow_smb2) { + if (sconn->using_smb2) { /* SMB2 */ if (sconn->smb2.sessions.list && sconn->smb2.sessions.list->tcons.list) { @@ -314,7 +314,7 @@ void conn_free(connection_struct *conn) return; } - if (conn->sconn->allow_smb2) { + if (conn->sconn->using_smb2) { conn_free_internal(conn); return; } diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h index 3533d60e7a..38019463c2 100644 --- a/source3/smbd/globals.h +++ b/source3/smbd/globals.h @@ -453,7 +453,7 @@ struct smbd_server_connection { struct { bool got_session; } nbt; - bool allow_smb2; + bool using_smb2; struct { struct fd_event *fde; diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c index 92c3e0ebad..433de8aea3 100644 --- a/source3/smbd/msdfs.c +++ b/source3/smbd/msdfs.c @@ -78,7 +78,7 @@ static NTSTATUS parse_dfs_path(connection_struct *conn, sepchar = pdp->posix_path ? '/' : '\\'; - if (!sconn->allow_smb2 && (*pathname != sepchar)) { + if (!sconn->using_smb2 && (*pathname != sepchar)) { DEBUG(10,("parse_dfs_path: path %s doesn't start with %c\n", pathname, sepchar )); /* diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index a6702a5595..88fce91954 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -403,7 +403,7 @@ void break_level2_to_none_async(files_struct *fsp) fsp_str_dbg(fsp))); /* Now send a break to none message to our client. */ - if (sconn->allow_smb2) { + if (sconn->using_smb2) { send_break_message_smb2(fsp, OPLOCKLEVEL_NONE); } else { send_break_message_smb1(fsp, OPLOCKLEVEL_NONE); @@ -542,7 +542,7 @@ static void process_oplock_break_message(struct messaging_context *msg_ctx, wait_before_sending_break(); } - if (sconn->allow_smb2) { + if (sconn->using_smb2) { send_break_message_smb2(fsp, break_to_level2 ? OPLOCKLEVEL_II : OPLOCKLEVEL_NONE); } else { @@ -608,7 +608,7 @@ static void process_kernel_oplock_break(struct messaging_context *msg_ctx, return; } - if (sconn->allow_smb2) { + if (sconn->using_smb2) { send_break_message_smb2(fsp, OPLOCKLEVEL_NONE); } else { send_break_message_smb1(fsp, OPLOCKLEVEL_NONE); diff --git a/source3/smbd/password.c b/source3/smbd/password.c index e85f23074f..e4f39dbb46 100644 --- a/source3/smbd/password.c +++ b/source3/smbd/password.c @@ -128,7 +128,7 @@ void invalidate_vuid(struct smbd_server_connection *sconn, uint16 vuid) void invalidate_all_vuids(struct smbd_server_connection *sconn) { - if (sconn->allow_smb2) { + if (sconn->using_smb2) { return; } diff --git a/source3/smbd/process.c b/source3/smbd/process.c index f032e6ab78..1baf3538c6 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -606,7 +606,7 @@ void remove_deferred_open_message_smb(uint64_t mid) { struct pending_message_list *pml; - if (smbd_server_conn->allow_smb2) { + if (smbd_server_conn->using_smb2) { remove_deferred_open_message_smb2(mid); return; } @@ -634,7 +634,7 @@ void schedule_deferred_open_message_smb(uint64_t mid) struct pending_message_list *pml; int i = 0; - if (smbd_server_conn->allow_smb2) { + if (smbd_server_conn->using_smb2) { schedule_deferred_open_message_smb2(mid); return; } @@ -695,7 +695,7 @@ bool open_was_deferred(uint64_t mid) { struct pending_message_list *pml; - if (smbd_server_conn->allow_smb2) { + if (smbd_server_conn->using_smb2) { return open_was_deferred_smb2(mid); } @@ -733,7 +733,7 @@ bool get_deferred_open_message_state(struct smb_request *smbreq, { struct pending_message_list *pml; - if (smbd_server_conn->allow_smb2) { + if (smbd_server_conn->using_smb2) { return get_deferred_open_message_state_smb2(smbreq->smb2req, p_request_time, pp_state); @@ -1629,7 +1629,9 @@ static void process_smb(struct smbd_server_connection *conn, goto done; } - if (smbd_server_conn->allow_smb2) { + if (smbd_server_conn->using_smb2) { + /* At this point we're not really using smb2, + * we make the decision here.. */ if (smbd_is_smb2_header(inbuf, nread)) { smbd_smb2_first_negprot(smbd_server_conn, inbuf, nread); return; @@ -1637,7 +1639,7 @@ static void process_smb(struct smbd_server_connection *conn, && CVAL(inbuf, smb_com) != 0x72) { /* This is a non-negprot SMB1 packet. Disable SMB2 from now on. */ - smbd_server_conn->allow_smb2 = false; + smbd_server_conn->using_smb2 = false; } } @@ -2397,7 +2399,7 @@ static bool keepalive_fn(const struct timeval *now, void *private_data) struct smbd_server_connection *sconn = smbd_server_conn; bool ret; - if (sconn->allow_smb2) { + if (sconn->using_smb2) { /* Don't do keepalives on an SMB2 connection. */ return false; } @@ -2420,7 +2422,7 @@ static bool deadtime_fn(const struct timeval *now, void *private_data) { struct smbd_server_connection *sconn = smbd_server_conn; - if (sconn->allow_smb2) { + if (sconn->using_smb2) { /* TODO: implement real idle check */ if (sconn->smb2.sessions.list) { return true; @@ -2856,7 +2858,14 @@ void smbd_process(void) if (lp_maxprotocol() == PROTOCOL_SMB2 && lp_security() != SEC_SHARE && !lp_async_smb_echo_handler()) { - smbd_server_conn->allow_smb2 = true; + /* + * We're not making the desion here, + * we're just allowing the client + * to decide between SMB1 and SMB2 + * with the first negprot + * packet. + */ + smbd_server_conn->using_smb2 = true; } /* Ensure child is set to blocking mode */ diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 330e89df18..10bab7b851 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -7224,7 +7224,7 @@ NTSTATUS smbd_do_locking(struct smb_request *req, * * Replacement for do_lock_spin(). JRA. */ - if (!smbd_server_conn->allow_smb2 && + if (!smbd_server_conn->using_smb2 && br_lck && lp_blocking_locks(SNUM(conn)) && lp_lock_spin_time() && !blocking_lock && NT_STATUS_EQUAL((status), -- cgit