You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2011/01/04 18:35:07 UTC

svn commit: r1055115 - in /tomcat/trunk: java/org/apache/catalina/realm/JNDIRealm.java webapps/docs/changelog.xml webapps/docs/config/realm.xml

Author: markt
Date: Tue Jan  4 17:35:06 2011
New Revision: 1055115

URL: http://svn.apache.org/viewvc?rev=1055115&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50541
Add support for sizeLimit and timeLimit on the JNDIRealm

Modified:
    tomcat/trunk/java/org/apache/catalina/realm/JNDIRealm.java
    tomcat/trunk/webapps/docs/changelog.xml
    tomcat/trunk/webapps/docs/config/realm.xml

Modified: tomcat/trunk/java/org/apache/catalina/realm/JNDIRealm.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/realm/JNDIRealm.java?rev=1055115&r1=1055114&r2=1055115&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/realm/JNDIRealm.java (original)
+++ tomcat/trunk/java/org/apache/catalina/realm/JNDIRealm.java Tue Jan  4 17:35:06 2011
@@ -389,6 +389,18 @@ public class JNDIRealm extends RealmBase
      */
     protected String connectionTimeout = "5000";
     
+    /**
+     * The sizeLimit (also known as the countLimit) to use when the realm is
+     * configured with {@link #userSearch}. Zero for no limit.
+     */
+    protected long sizeLimit = 0;
+
+    /**
+     * The timeLimit (in milliseconds) to use when the realm is configured with
+     * {@link #userSearch}. Zero for no limit.
+     */
+    protected int timeLimit = 0;
+
     // ------------------------------------------------------------- Properties
 
     /**
@@ -900,6 +912,26 @@ public class JNDIRealm extends RealmBase
     }
 
 
+    public long getSizeLimit() {
+        return sizeLimit;
+    }
+
+
+    public void setSizeLimit(long sizeLimit) {
+        this.sizeLimit = sizeLimit;
+    }
+
+
+    public int getTimeLimit() {
+        return timeLimit;
+    }
+
+
+    public void setTimeLimit(int timeLimit) {
+        this.timeLimit = timeLimit;
+    }
+
+
     /**
      * Return descriptive information about this Realm implementation and
      * the corresponding version number, in the format
@@ -1334,6 +1366,9 @@ public class JNDIRealm extends RealmBase
             constraints.setSearchScope(SearchControls.ONELEVEL_SCOPE);
         }
 
+        constraints.setCountLimit(sizeLimit);
+        constraints.setTimeLimit(timeLimit);
+
         // Specify the attributes to be retrieved
         if (attrIds == null)
             attrIds = new String[0];

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1055115&r1=1055114&r2=1055115&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Tue Jan  4 17:35:06 2011
@@ -157,6 +157,11 @@
         Log a warning if context.xml files define values for properties  that do
         not exist (e.g. if there is a typo in a property name). (markt)
       </fix>
+      <add>
+        <bug>50541</bug>: Add support for setting the size limit and time limit
+        for LDAP seaches when using the JNDI Realm with <code>userSearch</code>.
+        (markt)
+      </add>
     </changelog>
   </subsection>
   <subsection name="Coyote">

Modified: tomcat/trunk/webapps/docs/config/realm.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/realm.xml?rev=1055115&r1=1055114&r2=1055115&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/config/realm.xml (original)
+++ tomcat/trunk/webapps/docs/config/realm.xml Tue Jan  4 17:35:06 2011
@@ -420,6 +420,19 @@
         to be searched.</p>
       </attribute>
 
+      <attribute name="sizeLimit" required="false">
+        <p>Specifies the maximum number of records to return when using the
+        <code>userSearch</code> attribute. If not specified, the default of
+        <code>0</code> is used which indicates no limit.</p>
+      </attribute>
+
+      <attribute name="timeLimit" required="false">
+        <p>Specifies the time (in milliseconds) to wait for records to be
+        returned when using the <code>userSearch</code> attribute. If not
+        specified, the default of <code>0</code> is used which indicates no
+        limit.</p>
+      </attribute>
+
       <attribute name="userBase" required="false">
         <p>The base element for user searches performed using the
         <code>userSearch</code> expression.  Not used if you are using



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org