permission-find no longer crashes with --targetgroup

Target Group parameter was not processed correctly which caused
permission-find to always crash when this search parameter was used.
Fix the crash and create a unit test case to avoid future regression.

https://fedorahosted.org/freeipa/ticket/3335
This commit is contained in:
Martin Kosek
2013-01-10 12:13:39 +01:00
parent 746181a88d
commit cb7e93bb91
2 changed files with 26 additions and 2 deletions

View File

@@ -815,8 +815,9 @@ class aci_find(crud.Search):
found = False
if 'target' in a.target:
target = a.target['target']['expression']
if api.env.container_group in target:
targetdn = DN(target.replace('ldap:///',''))
targetdn = DN(target.replace('ldap:///',''))
group_container_dn = DN(api.env.container_group, api.env.basedn)
if targetdn.endswith(group_container_dn):
try:
cn = targetdn[0]['cn']
except (IndexError, KeyError):