Fix #6130: Don't crash in winbindd_rpc lookup_groupmem() on unmapped members
authorVolker Lendecke <vl@samba.org>
Mon, 16 Mar 2009 12:17:04 +0000 (13:17 +0100)
committerMichael Adam <obnox@samba.org>
Thu, 19 Mar 2009 17:03:51 +0000 (18:03 +0100)
Thanks to François Legal <devel@thom.fr.eu.org> for reporting this bug

source/winbindd/winbindd_rpc.c

index efc9dab1c91e8cfcf686fa263dfd055e5f2ef7c1..14f7c0c7750a729dd1e856c5f801ed5e2ac75bde 100644 (file)
@@ -855,14 +855,15 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain *domain,
                }
 
                for (r=0; r<tmp_names.count; r++) {
-                       (*names)[i+r] = fill_domain_username_talloc(mem_ctx,
-                                               domain->name,
-                                               tmp_names.names[r].string,
-                                               true);
-                       (*name_types)[i+r] = tmp_types.ids[r];
+                       if (tmp_types.ids[r] == SID_NAME_UNKNOWN) {
+                               continue;
+                       }
+                       (*names)[total_names] = fill_domain_username_talloc(
+                               mem_ctx, domain->name,
+                               tmp_names.names[r].string, true);
+                       (*name_types)[total_names] = tmp_types.ids[r];
+                       total_names += 1;
                }
-
-               total_names += tmp_names.count;
         }
 
         *num_names = total_names;