Hello,

This patch addresses the current behavior of the LDAP Search operation. Under the 
current version, LDAP Searches that are successful but do not return results are 
marked as successful. The LDAP RFC states that result code 0 will be returned if no 
results were returned.

However, this makes the results from jMeter misleading. Consider this example:
 - Thread Group
  - LDAP Sampler: add
   - Server: Master Directory Server, incorrect user name, valid DN
  - LDAP Sampler: search
   - Server: Replicate Directory Server, same DN as in "Add"

(Assume a working one-way replication agreement between the Master and the Replicate)

Under these circumstances, the "Add" operation against the Master Directory Server 
will fail with error 32, 34, or 50 (depending on the server implementation). However, 
the search for the new record against the Replicate Directory Server will appear (to 
the end user) to be successful. In fact, it will have returned no results.

The patched version addresses this behavior. If no results are returned, jMeter will 
mark the search as failed.

Thank you,


Kayne McGladrey
Member - Technical Group
AT&T Wireless



--- LdapClient.java.backup      2003-11-05 16:31:38.000000000 -0800
+++ LdapClient.java     2003-11-06 14:24:00.000000000 -0800
@@ -65,6 +65,8 @@
 import javax.naming.directory.ModificationItem;
 import javax.naming.directory.SearchControls;

+import javax.naming.NamingEnumeration;
+
 import org.apache.jorphan.logging.LoggingManager;
 import org.apache.log.Logger;

@@ -136,7 +138,11 @@
     {
         SearchControls searchcontrols =
             new SearchControls(2, 1L, 0, null, false, false);
-        dirContext.search(searchBase, searchFilter, searchcontrols);
+        //dirContext.search(searchBase, searchFilter, searchcontrols);
+               NamingEnumeration result = dirContext.search(searchBase, searchFilter, 
searchcontrols);
+        if (! result.hasMore()) {
+                       throw new NamingException(" [LDAP: error code 0 - No Results 
Returned];");
+        }
     }

     /**

Reply via email to