]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
auth: Fix CID 1615191 Uninitialized scalar variable
authorVolker Lendecke <vl@samba.org>
Thu, 12 Sep 2024 19:33:54 +0000 (21:33 +0200)
committerVolker Lendecke <vl@samba.org>
Fri, 20 Sep 2024 18:25:53 +0000 (18:25 +0000)
Protect against winbind successfully returning 0 groups

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Sep 20 18:25:54 UTC 2024 on atb-devel-224

source3/auth/server_info.c

index 1eae63664cbcd099191d858c67bde04c3378dc24..b61a386bf873c38746819d17ba7986f2e975e6c4 100644 (file)
@@ -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