| | |
| | | } |
| | | |
| | | /** |
| | | * Create a new DN pattern matcher to match a suffix. |
| | | * @param pattern The suffix pattern string. |
| | | * @throws org.opends.server.types.DirectoryException If the pattern string |
| | | * is not valid. |
| | | * @return A new DN pattern matcher. |
| | | */ |
| | | public static PatternDN decodeSuffix(String pattern) throws DirectoryException |
| | | { |
| | | AttributeType fakeType = |
| | | DirectoryServer.getAttributeType(PATTERN_DN_FAKE_TYPE_NAME); |
| | | if (fakeType == null) |
| | | { |
| | | fakeType = |
| | | DirectoryServer.getDefaultAttributeType(PATTERN_DN_FAKE_TYPE_NAME); |
| | | } |
| | | |
| | | SearchFilter filter; |
| | | DN patternDN = DN.decode(pattern); |
| | | String filterStr = PATTERN_DN_FAKE_TYPE_NAME + "=*" + |
| | | patternDN.toNormalizedString(); |
| | | filter=SearchFilter.createFilterFromString(filterStr); |
| | | |
| | | return new PatternDN(fakeType, filter); |
| | | } |
| | | |
| | | /** |
| | | * Determine whether a given DN matches this pattern. |
| | | * @param dn The DN to be matched. |
| | | * @return true if the DN matches the pattern. |
| | |
| | | LDAPURL targetURL = LDAPURL.decode(target, false); |
| | | if(targetURL.getRawBaseDN().indexOf("*") != -1) { |
| | | this.isPattern=true; |
| | | patternDN = PatternDN.decode(targetURL.getRawBaseDN()); |
| | | patternDN = PatternDN.decodeSuffix(targetURL.getRawBaseDN()); |
| | | } else { |
| | | urlDN=targetURL.getBaseDN(); |
| | | if(!urlDN.isDescendantOf(aciDN)) { |
| | |
| | | // "uid=bjensen,ou=people,dc=example,dc=com", |
| | | // }, |
| | | // </FAIL> |
| | | { |
| | | "ou=aci branch,o=ACI Tests,dc=example,dc=com", |
| | | "(target=\"ldap:///ou=Peo*,ou=aci branch, o=ACI Tests," + |
| | | "dc=example,dc=com\")(targetattr=\"*\")" + |
| | | "(version 3.0; acl \"add_aci3\"; allow" + |
| | | "(search,read) userdn=\"ldap:///all\";)", |
| | | "uid=scarter,ou=People,ou=aci branch,o=ACI Tests," + |
| | | "dc=example,dc=com", |
| | | }, |
| | | { |
| | | "ou=aci branch,o=ACI Tests,dc=example,dc=com", |
| | | "(target=\"ldap:///ou=*eople,ou=aci branch,o=ACI Tests," + |
| | | "dc=example,dc=com\")(targetattr=\"*\")" + |
| | | "(version 3.0; acl \"add_aci3\"; allow" + |
| | | "(search,read) userdn=\"ldap:///all\";)", |
| | | "uid=scarter,ou=People,ou=aci branch,o=ACI Tests," + |
| | | "dc=example,dc=com", |
| | | }, |
| | | { |
| | | "ou=aci branch,o=ACI Tests,dc=example,dc=com", |
| | | "(target=\"ldap:///ou=Pe*le,ou=aci branch,o=ACI Tests," + |
| | | "dc=example,dc=com\")(targetattr=\"*\")" + |
| | | "(version 3.0; acl \"add_aci3\"; allow" + |
| | | "(search,read) userdn=\"ldap:///all\";)", |
| | | "uid=scarter,ou=People,ou=aci branch,o=ACI Tests," + |
| | | "dc=example,dc=com", |
| | | }, |
| | | { |
| | | "ou=aci branch,o=ACI Tests,dc=example,dc=com", |
| | | "(target=\"ldap:///ou=Pe*l*,ou=aci branch,o=ACI Tests," + |
| | | "dc=example,dc=com\")(targetattr=\"*\")" + |
| | | "(version 3.0; acl \"add_aci3\"; allow" + |
| | | "(search,read) userdn=\"ldap:///all\";)", |
| | | "uid=scarter,ou=People,ou=aci branch,o=ACI Tests," + |
| | | "dc=example,dc=com", |
| | | }, |
| | | }; |
| | | } |
| | | |
| | | |
| | | @DataProvider |
| | | public Object[][] nonApplicableTargets() |
| | | { |