r989: Calling sid_to_gid from within winbind makes no sense, as this calls
authorVolker Lendecke <vlendec@samba.org>
Thu, 3 Jun 2004 09:25:01 +0000 (09:25 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:51:52 +0000 (10:51 -0500)
winbind_sid_to_gid. For the consistency check, local_sid_to_gid must set the
name_type it found.

Volker

source/nsswitch/winbindd_group.c
source/passdb/passdb.c

index 0e6c98e5d365b02da1926056221c60b2522d7e30..346a2711b6c8b75aa8a13f6e5b4416e3b4d5c954 100644 (file)
@@ -963,9 +963,17 @@ static void add_local_gids_from_sid(DOM_SID *sid, gid_t **gids, int *num)
                return;
 
        for (j=0; j<num_aliases; j++) {
+               enum SID_NAME_USE type;
 
-               if (!NT_STATUS_IS_OK(sid_to_gid(&aliases[j], &gid)))
+               if (!local_sid_to_gid(&gid, &aliases[j], &type)) {
+                       DEBUG(1, ("Got an alias membership with no alias\n"));
                        continue;
+               }
+
+               if ((type != SID_NAME_ALIAS) && (type != SID_NAME_WKN_GRP)) {
+                       DEBUG(1, ("Got an alias membership in a non-alias\n"));
+                       continue;
+               }
 
                add_gid_to_array_unique(gid, gids, num);
        }
index 75f8171a25db7d16584e63ec8d9e7ead84f666b4..c3a423c2636200f44cb90fd6cb7107a15abfcfe7 100644 (file)
@@ -1287,6 +1287,7 @@ BOOL local_sid_to_gid(gid_t *pgid, const DOM_SID *psid, enum SID_NAME_USE *name_
        }
 
        *pgid = group.gid;
+       *name_type = group.sid_name_use;
 
        DEBUG(10,("local_sid_to_gid: SID %s -> gid (%u)\n", sid_string_static(psid),
                (unsigned int)*pgid));