1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

smbd: move target code out of loop body

Reduces indentation of the code code that is run in this function and prepares
for adding more of it.

Review with: git show -w

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Ralph Boehme 2024-01-23 15:19:12 +01:00 committed by Stefan Metzmacher
parent 7fc74c7883
commit 630f1228d1

View File

@ -168,42 +168,46 @@ connection_struct *conn_new(struct smbd_server_connection *sconn)
static void conn_clear_vuid_cache(connection_struct *conn, uint64_t vuid)
{
struct vuid_cache_entry *ent = NULL;
int i;
for (i=0; i<VUID_CACHE_SIZE; i++) {
struct vuid_cache_entry *ent;
ent = &conn->vuid_cache->array[i];
if (ent->vuid == vuid) {
ent->vuid = UID_FIELD_INVALID;
/*
* We need to keep conn->session_info around
* if it's equal to ent->session_info as a SMBulogoff
* is often followed by a SMBtdis (with an invalid
* vuid). The debug code (or regular code in
* vfs_full_audit) wants to refer to the
* conn->session_info pointer to print debug
* statements. Theoretically this is a bug,
* as once the vuid is gone the session_info
* on the conn struct isn't valid any more,
* but there's enough code that assumes
* conn->session_info is never null that
* it's easier to hold onto the old pointer
* until we get a new sessionsetupX.
* As everything is hung off the
* conn pointer as a talloc context we're not
* leaking memory here. See bug #6315. JRA.
*/
if (conn->session_info == ent->session_info) {
ent->session_info = NULL;
} else {
TALLOC_FREE(ent->session_info);
}
ent->read_only = False;
ent->share_access = 0;
if (ent->vuid != vuid) {
continue;
}
}
if (i == VUID_CACHE_SIZE) {
return;
}
ent->vuid = UID_FIELD_INVALID;
/*
* We need to keep conn->session_info around
* if it's equal to ent->session_info as a SMBulogoff
* is often followed by a SMBtdis (with an invalid
* vuid). The debug code (or regular code in
* vfs_full_audit) wants to refer to the
* conn->session_info pointer to print debug
* statements. Theoretically this is a bug,
* as once the vuid is gone the session_info
* on the conn struct isn't valid any more,
* but there's enough code that assumes
* conn->session_info is never null that
* it's easier to hold onto the old pointer
* until we get a new sessionsetupX.
* As everything is hung off the
* conn pointer as a talloc context we're not
* leaking memory here. See bug #6315. JRA.
*/
if (conn->session_info == ent->session_info) {
ent->session_info = NULL;
} else {
TALLOC_FREE(ent->session_info);
}
ent->read_only = False;
ent->share_access = 0;
}
/****************************************************************************