1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

smbd: Remove sconn->using_smb2

We have the same information available via conn_using_smb2()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
This commit is contained in:
Volker Lendecke 2024-02-13 13:05:42 +01:00 committed by Martin Schwenke
parent 59d7850ffa
commit 80cd127b20
13 changed files with 25 additions and 27 deletions

View File

@ -1480,7 +1480,7 @@ static NTSTATUS close_directory(struct smb_request *req, files_struct *fsp,
SMB_ASSERT(fsp->fsp_flags.is_fsa); SMB_ASSERT(fsp->fsp_flags.is_fsa);
if (fsp->conn->sconn->using_smb2) { if (conn_using_smb2(fsp->conn->sconn)) {
notify_status = NT_STATUS_NOTIFY_CLEANUP; notify_status = NT_STATUS_NOTIFY_CLEANUP;
} else { } else {
notify_status = NT_STATUS_OK; notify_status = NT_STATUS_OK;

View File

@ -238,7 +238,7 @@ static void conn_force_tdis_done(struct tevent_req *req)
return; return;
} }
if (conn->sconn->using_smb2) { if (conn_using_smb2(conn->sconn)) {
vuid = conn->vuid; vuid = conn->vuid;
} }

View File

@ -252,7 +252,7 @@ NTSTATUS dptr_create(connection_struct *conn,
dptr->attr = attr; dptr->attr = attr;
if (sconn->using_smb2) { if (conn_using_smb2(sconn)) {
goto done; goto done;
} }
@ -328,7 +328,7 @@ void dptr_CloseDir(files_struct *fsp)
DBG_INFO("closing dptr key %d\n", fsp->dptr->dnum); DBG_INFO("closing dptr key %d\n", fsp->dptr->dnum);
if (sconn != NULL && !sconn->using_smb2) { if (sconn != NULL && !conn_using_smb2(sconn)) {
DLIST_REMOVE(sconn->searches.dirptrs, fsp->dptr); DLIST_REMOVE(sconn->searches.dirptrs, fsp->dptr);
/* /*

View File

@ -43,7 +43,7 @@ uint32_t ucf_flags_from_smb_request(struct smb_request *req)
if (req->posix_pathnames) { if (req->posix_pathnames) {
ucf_flags |= UCF_POSIX_PATHNAMES; ucf_flags |= UCF_POSIX_PATHNAMES;
if (!req->sconn->using_smb2) { if (!conn_using_smb2(req->sconn)) {
ucf_flags |= UCF_LCOMP_LNK_OK; ucf_flags |= UCF_LCOMP_LNK_OK;
} }
} }

View File

@ -781,7 +781,6 @@ struct smbd_server_connection {
struct messaging_context *msg_ctx; struct messaging_context *msg_ctx;
struct dcesrv_context *dce_ctx; struct dcesrv_context *dce_ctx;
struct notify_context *notify_ctx; struct notify_context *notify_ctx;
bool using_smb2;
int trans_num; int trans_num;
size_t num_users; size_t num_users;

View File

@ -4399,7 +4399,7 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
* According to Samba4, SEC_FILE_READ_ATTRIBUTE is always granted, * According to Samba4, SEC_FILE_READ_ATTRIBUTE is always granted,
* but we don't have to store this - just ignore it on access check. * but we don't have to store this - just ignore it on access check.
*/ */
if (conn->sconn->using_smb2) { if (conn_using_smb2(conn->sconn)) {
/* /*
* SMB2 doesn't return it (according to Microsoft tests). * SMB2 doesn't return it (according to Microsoft tests).
* Test Case: TestSuite_ScenarioNo009GrantedAccessTestS0 * Test Case: TestSuite_ScenarioNo009GrantedAccessTestS0
@ -6033,7 +6033,7 @@ static NTSTATUS create_file_unixpath(connection_struct *conn,
goto fail; goto fail;
} }
if (conn->sconn->using_smb2 && if (conn_using_smb2(conn->sconn) &&
(access_mask == SEC_FLAG_SYSTEM_SECURITY)) (access_mask == SEC_FLAG_SYSTEM_SECURITY))
{ {
/* /*

View File

@ -1017,7 +1017,7 @@ static void set_current_case_sensitive(connection_struct *conn, uint16_t flags)
enum remote_arch_types ra_type; enum remote_arch_types ra_type;
SMB_ASSERT(conn != NULL); SMB_ASSERT(conn != NULL);
SMB_ASSERT(!conn->sconn->using_smb2); SMB_ASSERT(!conn_using_smb2(conn->sconn));
snum = SNUM(conn); snum = SNUM(conn);
@ -2119,7 +2119,7 @@ bool keepalive_fn(const struct timeval *now, void *private_data)
struct smbXsrv_connection *xconn = NULL; struct smbXsrv_connection *xconn = NULL;
bool ret; bool ret;
if (sconn->using_smb2) { if (conn_using_smb2(sconn)) {
/* Don't do keepalives on an SMB2 connection. */ /* Don't do keepalives on an SMB2 connection. */
return false; return false;
} }

View File

@ -805,8 +805,6 @@ NTSTATUS smbd_smb2_request_process_negprot(struct smbd_smb2_request *req)
SIVAL(outbody.data, 0x3C, SIVAL(outbody.data, 0x3C,
out_negotiate_context_offset); /* reserved/NegotiateContextOffset */ out_negotiate_context_offset); /* reserved/NegotiateContextOffset */
req->sconn->using_smb2 = true;
if (dialect == SMB2_DIALECT_REVISION_2FF) { if (dialect == SMB2_DIALECT_REVISION_2FF) {
return smbd_smb2_request_done(req, outbody, &outdyn); return smbd_smb2_request_done(req, outbody, &outdyn);
} }

View File

@ -184,7 +184,7 @@ static bool check_smb2_posix_chmod_ace(const struct files_struct *fsp,
* MS NFS style mode entry coming in on a POSIX * MS NFS style mode entry coming in on a POSIX
* handle over SMB2+. * handle over SMB2+.
*/ */
if (!fsp->conn->sconn->using_smb2) { if (!conn_using_smb2(fsp->conn->sconn)) {
return false; return false;
} }

View File

@ -1033,7 +1033,7 @@ static void process_oplock_break_message(struct messaging_context *msg_ctx,
} }
#if defined(WITH_SMB1SERVER) #if defined(WITH_SMB1SERVER)
if (sconn->using_smb2) { if (conn_using_smb2(sconn)) {
#endif #endif
send_break_message_smb2(fsp, break_from, break_to); send_break_message_smb2(fsp, break_from, break_to);
#if defined(WITH_SMB1SERVER) #if defined(WITH_SMB1SERVER)
@ -1119,7 +1119,7 @@ static void process_kernel_oplock_break(struct messaging_context *msg_ctx,
} }
#if defined(WITH_SMB1SERVER) #if defined(WITH_SMB1SERVER)
if (sconn->using_smb2) { if (conn_using_smb2(sconn)) {
#endif #endif
send_break_message_smb2(fsp, 0, OPLOCKLEVEL_NONE); send_break_message_smb2(fsp, 0, OPLOCKLEVEL_NONE);
#if defined(WITH_SMB1SERVER) #if defined(WITH_SMB1SERVER)

View File

@ -222,7 +222,7 @@ void remove_deferred_open_message_smb(struct smbXsrv_connection *xconn,
struct smbd_server_connection *sconn = xconn->client->sconn; struct smbd_server_connection *sconn = xconn->client->sconn;
struct pending_message_list *pml; struct pending_message_list *pml;
if (sconn->using_smb2) { if (conn_using_smb2(sconn)) {
remove_deferred_open_message_smb2(xconn, mid); remove_deferred_open_message_smb2(xconn, mid);
return; return;
} }
@ -295,7 +295,7 @@ bool schedule_deferred_open_message_smb(struct smbXsrv_connection *xconn,
struct pending_message_list *pml; struct pending_message_list *pml;
int i = 0; int i = 0;
if (sconn->using_smb2) { if (conn_using_smb2(sconn)) {
return schedule_deferred_open_message_smb2(xconn, mid); return schedule_deferred_open_message_smb2(xconn, mid);
} }
@ -365,7 +365,7 @@ bool open_was_deferred(struct smbXsrv_connection *xconn, uint64_t mid)
struct smbd_server_connection *sconn = xconn->client->sconn; struct smbd_server_connection *sconn = xconn->client->sconn;
struct pending_message_list *pml; struct pending_message_list *pml;
if (sconn->using_smb2) { if (conn_using_smb2(sconn)) {
return open_was_deferred_smb2(xconn, mid); return open_was_deferred_smb2(xconn, mid);
} }
@ -404,7 +404,7 @@ bool get_deferred_open_message_state(struct smb_request *smbreq,
{ {
struct pending_message_list *pml; struct pending_message_list *pml;
if (smbreq->sconn->using_smb2) { if (conn_using_smb2(smbreq->sconn)) {
return get_deferred_open_message_state_smb2(smbreq->smb2req, return get_deferred_open_message_state_smb2(smbreq->smb2req,
p_request_time, p_request_time,
open_rec); open_rec);

View File

@ -818,7 +818,7 @@ NTSTATUS make_connection_snum(struct smbXsrv_connection *xconn,
tsocket_address_string(conn->sconn->remote_address, tsocket_address_string(conn->sconn->remote_address,
talloc_tos()) ); talloc_tos()) );
#if defined(WITH_SMB1SERVER) #if defined(WITH_SMB1SERVER)
if (sconn->using_smb2) { if (conn_using_smb2(sconn)) {
#endif #endif
signing_active = smb2_signing_key_valid( signing_active = smb2_signing_key_valid(
session->global->encryption_key); session->global->encryption_key);

View File

@ -648,7 +648,7 @@ unsigned int estimate_ea_size(files_struct *fsp)
&total_ea_len, &total_ea_len,
&ea_list); &ea_list);
if(fsp->conn->sconn->using_smb2) { if(conn_using_smb2(fsp->conn->sconn)) {
unsigned int ret_data_size; unsigned int ret_data_size;
/* /*
* We're going to be using fill_ea_chained_buffer() to * We're going to be using fill_ea_chained_buffer() to
@ -1741,7 +1741,7 @@ static NTSTATUS smbd_marshall_dir_entry(TALLOC_CTX *ctx,
DBG_DEBUG("SMB2_FILE_POSIX_INFORMATION\n"); DBG_DEBUG("SMB2_FILE_POSIX_INFORMATION\n");
if (!(conn->sconn->using_smb2)) { if (!conn_using_smb2(conn->sconn)) {
return NT_STATUS_INVALID_LEVEL; return NT_STATUS_INVALID_LEVEL;
} }
@ -1990,7 +1990,7 @@ static bool fsinfo_unix_valid_level(connection_struct *conn,
struct files_struct *fsp, struct files_struct *fsp,
uint16_t info_level) uint16_t info_level)
{ {
if (conn->sconn->using_smb2 && if (conn_using_smb2(conn->sconn) &&
fsp->posix_flags == FSP_POSIX_FLAGS_OPEN && fsp->posix_flags == FSP_POSIX_FLAGS_OPEN &&
info_level == SMB2_FS_POSIX_INFORMATION_INTERNAL) info_level == SMB2_FS_POSIX_INFORMATION_INTERNAL)
{ {
@ -3038,7 +3038,7 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
ok = true; ok = true;
} }
if (conn->sconn->using_smb2 && if (conn_using_smb2(conn->sconn) &&
(fsp->posix_flags & FSP_POSIX_FLAGS_OPEN)) (fsp->posix_flags & FSP_POSIX_FLAGS_OPEN))
{ {
DBG_DEBUG("SMB2 posix open\n"); DBG_DEBUG("SMB2 posix open\n");
@ -3407,7 +3407,8 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
{ {
char *nfname = NULL; char *nfname = NULL;
if (fsp == NULL || !fsp->conn->sconn->using_smb2) { if (fsp == NULL ||
!conn_using_smb2(fsp->conn->sconn)) {
return NT_STATUS_INVALID_LEVEL; return NT_STATUS_INVALID_LEVEL;
} }
@ -3696,7 +3697,7 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
}; };
enum ndr_err_code ndr_err; enum ndr_err_code ndr_err;
if (!(conn->sconn->using_smb2)) { if (!conn_using_smb2(conn->sconn)) {
return NT_STATUS_INVALID_LEVEL; return NT_STATUS_INVALID_LEVEL;
} }
if (fsp == NULL) { if (fsp == NULL) {
@ -5202,7 +5203,7 @@ NTSTATUS smbd_do_setfilepathinfo(connection_struct *conn,
case SMB_FILE_LINK_INFORMATION: case SMB_FILE_LINK_INFORMATION:
{ {
if (conn->sconn->using_smb2) { if (conn_using_smb2(conn->sconn)) {
status = smb2_file_link_information(conn, status = smb2_file_link_information(conn,
req, req,
pdata, pdata,