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

smbd: simplify the logic in change_to_user()

We can return early if (vuser == NULL).

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Stefan Metzmacher 2018-06-12 15:39:51 +02:00
parent e469d6c730
commit 35a12e7009

View File

@ -378,15 +378,6 @@ bool change_to_user(connection_struct *conn, uint64_t vuid)
}
vuser = get_valid_user_struct(conn->sconn, vuid);
if ((current_user.conn == conn) &&
(vuser != NULL) && (current_user.vuid == vuid) &&
(current_user.ut.uid == vuser->session_info->unix_token->uid)) {
DEBUG(4,("Skipping user change - already "
"user\n"));
return(True);
}
if (vuser == NULL) {
/* Invalid vuid sent */
DEBUG(2,("Invalid vuid %llu used on share %s.\n",
@ -395,6 +386,14 @@ bool change_to_user(connection_struct *conn, uint64_t vuid)
return false;
}
if ((current_user.conn == conn) &&
(current_user.vuid == vuid) &&
(current_user.ut.uid == vuser->session_info->unix_token->uid))
{
DBG_INFO("Skipping user change - already user\n");
return true;
}
return change_to_user_internal(conn, vuser->session_info, vuid);
}