Hi,
Consider the following unit test :
public void testHandcodedSearchOne() throws Exception {
LdapConnection con = new LdapConnection("obm23.buffy.kvm", 389);
con.bind();
Cursor<SearchResponse> result = con.search("dc=local",
"(uid=thomas)",
SearchScope.SUBTREE, "*");
assertNotNull(result);
if (!result.next()) {
fail("no entry found while something should match.");
}
result.close();
con.close();
}
This one fails on "no entry found while something should match.". Well ok...
Now consider the second test :
public void testHandcodedSearchAll() throws Exception {
LdapConnection con = new LdapConnection("obm23.buffy.kvm", 389);
con.bind();
Cursor<SearchResponse> result = con.search("dc=local",
"(uid=*)",
SearchScope.SUBTREE, "*");
assertNotNull(result);
if (!result.next()) {
fail("no entry found while something should match.");
}
SearchResponse data = result.get();
System.out.println("data: "+data);
result.close();
con.close();
}
This one outputs :
2010-03-11 20:09:15,604 Asn1Decoder WARN - The PDU has been fully
decoded but there are still bytes in the buffer.
data: LdapMessage
message Id : 2
controls :
2010-03-11 20:09:15,618 LdapConnection ERROR - There is no future
asscoiated with operation message ID 2, perhaps the operation would
have been completed
2010-03-11 20:09:15,627 IoHandlerAdapter WARN - EXCEPTION, please
implement org.apache.directory.ldap.client.api.LdapConnection.exceptionCaught()
for proper handling:
org.apache.mina.core.write.WriteToClosedSessionException
at
org.apache.mina.core.polling.AbstractPollingIoProcessor.clearWriteRequestQueue(AbstractPollingIoProcessor.java:573)
at
org.apache.mina.core.polling.AbstractPollingIoProcessor.removeNow(AbstractPollingIoProcessor.java:525)
at
org.apache.mina.core.polling.AbstractPollingIoProcessor.removeSessions(AbstractPollingIoProcessor.java:497)
at
org.apache.mina.core.polling.AbstractPollingIoProcessor.access$600(AbstractPollingIoProcessor.java:61)
at
org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:974)
at
org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Openldap logs for the second test are :
Mar 11 20:09:14 obm23 slapd[8780]: conn=45 fd=32 ACCEPT from
IP=10.0.0.1:39830 (IP=0.0.0.0:389)
Mar 11 20:09:14 obm23 slapd[8780]: conn=45 op=0 BIND dn="" method=128
Mar 11 20:09:14 obm23 slapd[8780]: conn=45 op=0 RESULT tag=97 err=0 text=
Mar 11 20:09:14 obm23 slapd[8780]: conn=45 op=1 SRCH base="dc=local"
scope=2 deref=3 filter="(uid=*)"
Mar 11 20:09:14 obm23 slapd[8780]: conn=45 op=1 SRCH attr=*
Mar 11 20:09:14 obm23 slapd[8780]: conn=45 op=1 SEARCH RESULT tag=101
err=0 nentries=8 text=
Mar 11 20:09:14 obm23 slapd[8780]: conn=45 op=2 ABANDON msg=2
Mar 11 20:09:14 obm23 slapd[8780]: conn=45 fd=32 closed (connection lost)
So everything seems ok. However, when the filter is "(uid=thomas)"
something seems broken :
Mar 11 20:07:31 obm23 slapd[8780]: conn=42 fd=32 ACCEPT from
IP=10.0.0.1:42442 (IP=0.0.0.0:389)
Mar 11 20:07:31 obm23 slapd[8780]: conn=42 op=0 BIND dn="" method=128
Mar 11 20:07:31 obm23 slapd[8780]: conn=42 op=0 RESULT tag=97 err=0 text=
Mar 11 20:07:31 obm23 slapd[8780]: conn=42 op=1 SRCH base="dc=local"
scope=2 deref=3 filter="(?=undefined)"
Mar 11 20:07:31 obm23 slapd[8780]: conn=42 op=1 SRCH attr=*
Mar 11 20:07:31 obm23 slapd[8780]: conn=42 op=1 SEARCH RESULT tag=101
err=0 nentries=0 text=
Mar 11 20:07:32 obm23 slapd[8780]: conn=42 fd=32 closed (connection lost)
Look at the "(?=undefined)" filter in the logs.
I might be doing something wrong, but I don't see anything obvious. Any help ?
Regards,
Thomas.