]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:winbindd: consistently use add_sid_to_array_unique() in winbindd_ads.c
authorStefan Metzmacher <metze@samba.org>
Fri, 22 Jul 2022 13:15:02 +0000 (15:15 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 15 Jan 2025 13:03:34 +0000 (13:03 +0000)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/winbindd/winbindd_ads.c

index dcc73dcf375f94d2bc029e2861f1832a84d03829..d2dcc7b295a374018c2080027400e0d5f81bcf5f 100644 (file)
@@ -637,8 +637,10 @@ static NTSTATUS lookup_usergroups_member(struct winbindd_domain *domain,
        num_groups = 0;
 
        /* always add the primary group to the sid array */
-       status = add_sid_to_array(mem_ctx, primary_group, user_sids,
-                                 &num_groups);
+       status = add_sid_to_array_unique(mem_ctx,
+                                        primary_group,
+                                        user_sids,
+                                        &num_groups);
        if (!NT_STATUS_IS_OK(status)) {
                goto done;
        }
@@ -658,8 +660,10 @@ static NTSTATUS lookup_usergroups_member(struct winbindd_domain *domain,
                                continue;
                        }
 
-                       status = add_sid_to_array(mem_ctx, &group_sid,
-                                                 user_sids, &num_groups);
+                       status = add_sid_to_array_unique(mem_ctx,
+                                                        &group_sid,
+                                                        user_sids,
+                                                        &num_groups);
                        if (!NT_STATUS_IS_OK(status)) {
                                goto done;
                        }
@@ -726,8 +730,10 @@ static NTSTATUS lookup_usergroups_memberof(struct winbindd_domain *domain,
        num_groups = 0;
 
        /* always add the primary group to the sid array */
-       status = add_sid_to_array(mem_ctx, primary_group, user_sids,
-                                 &num_groups);
+       status = add_sid_to_array_unique(mem_ctx,
+                                        primary_group,
+                                        user_sids,
+                                        &num_groups);
        if (!NT_STATUS_IS_OK(status)) {
                goto done;
        }
@@ -769,8 +775,10 @@ static NTSTATUS lookup_usergroups_memberof(struct winbindd_domain *domain,
                        continue;
                }
 
-               status = add_sid_to_array(mem_ctx, &group_sids[i], user_sids,
-                                         &num_groups);
+               status = add_sid_to_array_unique(mem_ctx,
+                                                &group_sids[i],
+                                                user_sids,
+                                                &num_groups);
                if (!NT_STATUS_IS_OK(status)) {
                        goto done;
                }
@@ -915,8 +923,10 @@ static NTSTATUS lookup_usergroups(struct winbindd_domain *domain,
        *user_sids = NULL;
        num_groups = 0;
 
-       status = add_sid_to_array(mem_ctx, &primary_group, user_sids,
-                                 &num_groups);
+       status = add_sid_to_array_unique(mem_ctx,
+                                        &primary_group,
+                                        user_sids,
+                                        &num_groups);
        if (!NT_STATUS_IS_OK(status)) {
                goto done;
        }