зеркало из https://github.com/mozilla/pjs.git
Bug #232453 --> ldap quick search and advanced search does not honor search filters
when applied to the ldap directory properties dialog. r=dmose sr=bienvenu
This commit is contained in:
Родитель
2c03598e56
Коммит
2fff9f432b
|
@ -733,6 +733,32 @@ NS_IMETHODIMP nsAbLDAPDirectoryQuery::DoQuery(nsIAbDirectoryQueryArguments* argu
|
|||
rv = mDirectoryUrl->GetOptions(&options);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
// get the directoryFilter from the directory url and merge it with the user's
|
||||
// search filter
|
||||
nsCAutoString urlFilter;
|
||||
rv = mDirectoryUrl->GetFilter(urlFilter);
|
||||
|
||||
// if urlFilter is unset (or set to the default "objectclass=*"), there's
|
||||
// no need to AND in an empty search term, so leave prefix and suffix empty
|
||||
|
||||
nsCAutoString searchFilter;
|
||||
if (urlFilter.Length() && !urlFilter.Equals(NS_LITERAL_CSTRING("(objectclass=*)")))
|
||||
{
|
||||
|
||||
// if urlFilter isn't parenthesized, we need to add in parens so that
|
||||
// the filter works as a term to &
|
||||
//
|
||||
if (urlFilter[0] != '(')
|
||||
searchFilter = NS_LITERAL_CSTRING("(&(") + urlFilter + NS_LITERAL_CSTRING(")");
|
||||
else
|
||||
searchFilter = NS_LITERAL_CSTRING("(&") + urlFilter;
|
||||
|
||||
searchFilter += filter;
|
||||
searchFilter += ')';
|
||||
}
|
||||
else
|
||||
searchFilter = filter;
|
||||
|
||||
nsCString ldapSearchUrlString;
|
||||
char* _ldapSearchUrlString =
|
||||
PR_smprintf ("ldap%s://%s:%d/%s?%s?%s?%s",
|
||||
|
@ -742,7 +768,7 @@ NS_IMETHODIMP nsAbLDAPDirectoryQuery::DoQuery(nsIAbDirectoryQueryArguments* argu
|
|||
dn.get (),
|
||||
returnAttributes.get (),
|
||||
scope.get (),
|
||||
filter.get ());
|
||||
searchFilter.get ());
|
||||
if (!_ldapSearchUrlString)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
ldapSearchUrlString = _ldapSearchUrlString;
|
||||
|
|
|
@ -909,7 +909,7 @@ nsLDAPAutoCompleteSession::StartLDAPSearch()
|
|||
// no need to AND in an empty search term, so leave prefix and suffix empty
|
||||
//
|
||||
nsCAutoString prefix, suffix;
|
||||
if (!urlFilter.Equals(NS_LITERAL_CSTRING("(objectclass=*)"))) {
|
||||
if (urlFilter.Length() && !urlFilter.Equals(NS_LITERAL_CSTRING("(objectclass=*)"))) {
|
||||
|
||||
// if urlFilter isn't parenthesized, we need to add in parens so that
|
||||
// the filter works as a term to &
|
||||
|
|
Загрузка…
Ссылка в новой задаче