From: Volker Lendecke Date: Fri, 9 Feb 2024 11:37:53 +0000 (+0100) Subject: smbd: Simplify an if-condition X-Git-Tag: tdb-1.4.11~1227 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=811c184bbb30f8364a6c2f1835732d0c25e1b9c7;p=thirdparty%2Fsamba.git smbd: Simplify an if-condition current_sid == NULL is true if and only if we could not assign current_sid because num_sids was too small. Make that more explicit. Signed-off-by: Volker Lendecke Reviewed-by: Andrew Bartlett --- diff --git a/source3/smbd/smbXsrv_open.c b/source3/smbd/smbXsrv_open.c index f2a6fc27784..ed2cf6f8a9f 100644 --- a/source3/smbd/smbXsrv_open.c +++ b/source3/smbd/smbXsrv_open.c @@ -529,17 +529,11 @@ NTSTATUS smbXsrv_open_create(struct smbXsrv_connection *conn, } current_token = session_info->security_token; - if (current_token == NULL) { - return NT_STATUS_INVALID_HANDLE; - } - - if (current_token->num_sids > PRIMARY_USER_SID_INDEX) { - current_sid = ¤t_token->sids[PRIMARY_USER_SID_INDEX]; - } - - if (current_sid == NULL) { + if ((current_token == NULL) || + (current_token->num_sids <= PRIMARY_USER_SID_INDEX)) { return NT_STATUS_INVALID_HANDLE; } + current_sid = ¤t_token->sids[PRIMARY_USER_SID_INDEX]; if (table->local.num_opens >= table->local.max_opens) { return NT_STATUS_INSUFFICIENT_RESOURCES;