Fix for 94775. Strip off trailing '/' of input realm, if present, before making comparison in si_GetURL(). r=morse, sr=bienvenu.

git-svn-id: svn://10.0.0.236/trunk@122111 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
cavin%netscape.com
2002-05-23 23:04:13 +00:00
parent a7e6103928
commit 0e77f84cff

View File

@@ -753,11 +753,19 @@ si_GetURL(const char * passwordRealm) {
}
return (si_SignonURLStruct *) (si_signon_list->ElementAt(0));
}
PRInt32 urlCount = LIST_COUNT(si_signon_list);
for (PRInt32 i=0; i<urlCount; i++) {
url = NS_STATIC_CAST(si_SignonURLStruct*, si_signon_list->ElementAt(i));
if(url->passwordRealm && !PL_strcmp(passwordRealm, url->passwordRealm)) {
return url;
if (urlCount) {
// If the last char of passwordRealm is '/' then strip it before making comparison.
nsCAutoString realmWithoutTrailingSlash(passwordRealm);
if (realmWithoutTrailingSlash.Last() == '/')
realmWithoutTrailingSlash.SetLength(realmWithoutTrailingSlash.Length()-1);
for (PRInt32 i=0; i<urlCount; i++) {
url = NS_STATIC_CAST(si_SignonURLStruct*, si_signon_list->ElementAt(i));
if(url->passwordRealm && !PL_strcmp(realmWithoutTrailingSlash.get(), url->passwordRealm)) {
return url;
}
}
}
return (NULL);