struct winbindd_domain *find_domain_from_sid_noinit(const DOM_SID *sid)
{
struct winbindd_domain *domain;
+ uint32 discard;
/* Search through list */
for (domain = domain_list(); domain != NULL; domain = domain->next) {
- if (sid_compare_domain(sid, &domain->sid) == 0)
+ /* We need to use sid_peek_check_rid, because we want
+ * to make sure that the SIDs we send to the backends are
+ * as specific as possible.
+ */
+ if (sid_peek_check_rid(&domain->sid, sid, &discard) == 0) {
return domain;
+ }
}
/* Not found */
goto done;
}
- if (sid_peek_check_rid(&global_sid_Builtin, sid, &rid)) {
+ if (sid_check_is_in_builtin(sid) ||
+ sid_check_is_in_wellknown_domain(sid)) {
/* Here we only have aliases */
GROUP_MAP map;
if (!NT_STATUS_IS_OK(methods->getgrsid(methods, &map, *sid))) {