Fix LDAP autocomplete session to work properly with servers with search filters that are not parenthesized (bug 86144). r=leif@netscape.com, sr=darin@netscape.com

This commit is contained in:
dmose%netscape.com 2005-11-15 20:08:43 +00:00
parent 8698941da6
commit a54d5daab7

View File

@ -947,7 +947,19 @@ nsLDAPAutoCompleteSession::StartLDAPSearch()
//
nsAutoString prefix, suffix;
if (urlFilter[0] != 0 && nsCRT::strcmp(urlFilter, "(objectclass=*)")) {
prefix = NS_LITERAL_STRING("(&") + NS_ConvertUTF8toUCS2(urlFilter);
// if urlFilter isn't parenthesized, we need to add in parens so that
// the filter works as a term to &
//
if (urlFilter[0] != '(') {
prefix = NS_LITERAL_STRING("(&(") +
NS_ConvertUTF8toUCS2(urlFilter) +
NS_LITERAL_STRING(")");
} else {
prefix = NS_LITERAL_STRING("(&") +
NS_ConvertUTF8toUCS2(urlFilter);
}
suffix = PRUnichar(')');
}