From: Volker Lendecke Date: Thu, 12 Sep 2024 19:33:54 +0000 (+0200) Subject: auth: Fix CID 1615191 Uninitialized scalar variable X-Git-Tag: tdb-1.4.13~1183 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=81ecdb125bf10433d49f865f1ab2dfae9f965857;p=thirdparty%2Fsamba.git auth: Fix CID 1615191 Uninitialized scalar variable Protect against winbind successfully returning 0 groups Signed-off-by: Volker Lendecke Reviewed-by: Noel Power Autobuild-User(master): Volker Lendecke Autobuild-Date(master): Fri Sep 20 18:25:54 UTC 2024 on atb-devel-224 --- diff --git a/source3/auth/server_info.c b/source3/auth/server_info.c index 1eae63664cb..b61a386bf87 100644 --- a/source3/auth/server_info.c +++ b/source3/auth/server_info.c @@ -672,9 +672,11 @@ NTSTATUS passwd_to_SamInfo3(TALLOC_CTX *mem_ctx, * Winbind is running and the first element of the user_sids * is the primary group. */ - if (num_sids > 0) { - group_sid = user_sids[0]; + if (num_sids == 0) { + DBG_INFO("User %s has no groups\n", unix_username); + return NT_STATUS_NO_SUCH_USER; } + group_sid = user_sids[0]; } else { /* * Winbind is not running, try to create the group_sid from the