mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Change LDAP autocomplete default minStringLength to only autocomplete against strings >= 2 chars long to avoid a possible hang on NT as well as unindexed searches (bug 84566; r=leif@netscape.com, sr=darin@netscape.com) and default searchFilterTemplate to catch people whose cn contains their middle name or initial (bug 90535; r=leif@netscape.com, rs=darin@netscape.com). This second patch also fixes a bug where filter templates sometimes ignored the last token of the entered string
This commit is contained in:
parent
9465aa7f97
commit
31d4fa1710
@ -974,7 +974,17 @@ nsLDAPService::CountTokens(nsReadingIterator<PRUnichar> aIter,
|
||||
++aIter; // move past the space
|
||||
break;
|
||||
}
|
||||
++aIter; // move to next char and continue with this token
|
||||
|
||||
++aIter; // move to next char
|
||||
|
||||
// if we've hit the end of this token and the end of this
|
||||
// iterator simultaneous, be sure to bump the count, since we're
|
||||
// never gonna hit the IsAsciiSpace where it's normally done.
|
||||
//
|
||||
if (aIter == aIterEnd) {
|
||||
++count;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,8 +36,15 @@ interface nsILDAPAutoCompleteSession : nsIAutoCompleteSession {
|
||||
* A template used to construct the RFC 1960 LDAP search filter to use
|
||||
* while autocompleting.
|
||||
*
|
||||
* XXX syntax to-be-determined in an upcoming checkin
|
||||
*
|
||||
* The authoritative documentation for the format in use can be found at
|
||||
* at <http://docs.iplanet.com/docs/manuals/dirsdk/csdk41/html/filter.htm>.
|
||||
* The Linux/OpenLDAP man page for ldapfilter.conf(5) does a pretty decent
|
||||
* job as well, however.
|
||||
*
|
||||
* As of this writing, the "@mozilla.org/autocompleteSession;1?type=ldap"
|
||||
* contractid happens to use a default value of
|
||||
* (|(cn=%v1*%v2-*)(mail=%v1*%v2-*)(sn=%v1*%v2-*))
|
||||
*
|
||||
* @exception NS_ERROR_NULL_POINTER NULL pointer passed to getter
|
||||
* @exception NS_ERROR_OUT_OF_MEMORY Getter couldn't allocate string
|
||||
*/
|
||||
@ -90,7 +97,9 @@ interface nsILDAPAutoCompleteSession : nsIAutoCompleteSession {
|
||||
* configured to not search on substrings so short that they
|
||||
* aren't indexed by the LDAP server (such searches can use significantly
|
||||
* more server resources and return a very large number of entries).
|
||||
* The default is 0, meaning that no such limit is in effect.
|
||||
* As of this writing, the "@mozilla.org/autocompleteSession;1?type=ldap"
|
||||
* contractid uses a default of two, as this avoids unindexed searches
|
||||
* with at least one widely-deployed webserver.
|
||||
*
|
||||
* @exception NS_ERROR_NULL_POINTER NULL pointer passed to getter
|
||||
*/
|
||||
|
@ -50,8 +50,9 @@ NS_IMPL_ISUPPORTS3(nsLDAPAutoCompleteSession, nsIAutoCompleteSession,
|
||||
|
||||
nsLDAPAutoCompleteSession::nsLDAPAutoCompleteSession() :
|
||||
mState(UNBOUND),
|
||||
mFilterTemplate(NS_LITERAL_STRING("(|(cn=%v*)(mail=%v*)(sn=%v*))")),
|
||||
mMaxHits(100), mMinStringLength(0), mSearchAttrs(0), mSearchAttrsSize(0)
|
||||
mFilterTemplate(NS_LITERAL_STRING(
|
||||
"(|(cn=%v1*%v2-*)(mail=%v1*%v2-*)(sn=%v1*%v2-*))")),
|
||||
mMaxHits(100), mMinStringLength(2), mSearchAttrs(0), mSearchAttrsSize(0)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user