}
public NamingEnumeration<SearchResult> search(String url, String filter,
Object[] objs, SearchControls searchControls)
throws NamingException {
LdapUrlParser parser = LdapUtils.parserURL(url, true);
String dn = parser.getBaseObject();
String host = parser.getHost();
int port = parser.getPort();
LdapClient client = LdapClient.newInstance(host, port, environment);
LdapContextImpl context = null;
try {
context = new LdapContextImpl(client,
(Hashtable<Object, Object>) environment, dn);
Filter f = parser.getFilter();
if (f == null) {
f = LdapUtils.parseFilter(filter, objs);
}
if (searchControls == null) {
searchControls = new SearchControls();
}
if (parser.getControls() != null) {
SearchControls controls = parser.getControls();
if (parser.hasAttributes()) {
searchControls.setReturningAttributes(controls
.getReturningAttributes());
}
if (parser.hasScope()) {
searchControls.setSearchScope(controls.getSearchScope());
}
}
LdapSearchResult result = context.doSearch(dn, f,