mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
smbd: Simplify check_user_ok()
Don't walk the cache at all if we get UID_FIELD_INVALID Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
95c031b660
commit
0e8a0f3bd4
@ -268,7 +268,6 @@ static bool check_user_ok(connection_struct *conn,
|
||||
{
|
||||
const struct loadparm_substitution *lp_sub =
|
||||
loadparm_s3_global_substitution();
|
||||
unsigned int i;
|
||||
bool readonly_share = false;
|
||||
bool admin_user = false;
|
||||
struct vuid_cache_entry *ent = NULL;
|
||||
@ -276,24 +275,21 @@ static bool check_user_ok(connection_struct *conn,
|
||||
NTSTATUS status;
|
||||
bool ok;
|
||||
|
||||
for (i=0; i<VUID_CACHE_SIZE; i++) {
|
||||
ent = &conn->vuid_cache->array[i];
|
||||
if (ent->vuid == vuid) {
|
||||
if (vuid == UID_FIELD_INVALID) {
|
||||
/*
|
||||
* Slow path, we don't care
|
||||
* about the array traversal.
|
||||
*/
|
||||
continue;
|
||||
if (vuid != UID_FIELD_INVALID) {
|
||||
unsigned int i;
|
||||
|
||||
for (i=0; i<VUID_CACHE_SIZE; i++) {
|
||||
ent = &conn->vuid_cache->array[i];
|
||||
if (ent->vuid == vuid) {
|
||||
free_conn_state_if_unused(conn);
|
||||
conn->session_info = ent->session_info;
|
||||
conn->read_only = ent->read_only;
|
||||
conn->share_access = ent->share_access;
|
||||
conn->vuid = ent->vuid;
|
||||
conn->veto_list = ent->veto_list;
|
||||
conn->hide_list = ent->hide_list;
|
||||
return(True);
|
||||
}
|
||||
free_conn_state_if_unused(conn);
|
||||
conn->session_info = ent->session_info;
|
||||
conn->read_only = ent->read_only;
|
||||
conn->share_access = ent->share_access;
|
||||
conn->vuid = ent->vuid;
|
||||
conn->veto_list = ent->veto_list;
|
||||
conn->hide_list = ent->hide_list;
|
||||
return(True);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user