mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-09-03 20:52:56 -05:00
ipaserver/dcerpc: attempt to resolve SIDs through SSSD first
Attempt to resolve SIDs through SSSD first to avoid using trust account password. This makes possible to run HBAC test requests without being in 'trusted admins' group. https://fedorahosted.org/freeipa/ticket/3803
This commit is contained in:
@@ -400,17 +400,14 @@ class hbactest(Command):
|
||||
ldap = self.api.Backend.ldap2
|
||||
group_container = DN(api.env.container_group, api.env.basedn)
|
||||
try:
|
||||
entries, truncated = ldap.find_entries(filter_sids, ['cn', 'memberOf'], group_container)
|
||||
entries, truncated = ldap.find_entries(filter_sids, ['cn'], group_container)
|
||||
except errors.NotFound:
|
||||
request.user.groups = []
|
||||
else:
|
||||
groups = []
|
||||
for dn, entry in entries:
|
||||
memberof_dns = entry.get('memberof', [])
|
||||
for memberof_dn in memberof_dns:
|
||||
if memberof_dn.endswith(group_container):
|
||||
# this is a group object
|
||||
groups.append(memberof_dn[0][0].value)
|
||||
if dn.endswith(group_container):
|
||||
groups.append(dn[0][0].value)
|
||||
request.user.groups = sorted(set(groups))
|
||||
else:
|
||||
# try searching for a local user
|
||||
|
||||
Reference in New Issue
Block a user