From 81ecdb125bf10433d49f865f1ab2dfae9f965857 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 12 Sep 2024 21:33:54 +0200 Subject: [PATCH] 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 --- source3/auth/server_info.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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