From 0e77f84cffabf8480db0d764fa44ccc2add15f53 Mon Sep 17 00:00:00 2001 From: "cavin%netscape.com" Date: Thu, 23 May 2002 23:04:13 +0000 Subject: [PATCH] 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 --- mozilla/extensions/wallet/src/singsign.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/mozilla/extensions/wallet/src/singsign.cpp b/mozilla/extensions/wallet/src/singsign.cpp index 781280eb848..eeded0f1591 100644 --- a/mozilla/extensions/wallet/src/singsign.cpp +++ b/mozilla/extensions/wallet/src/singsign.cpp @@ -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; iElementAt(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; iElementAt(i)); + if(url->passwordRealm && !PL_strcmp(realmWithoutTrailingSlash.get(), url->passwordRealm)) { + return url; + } } } return (NULL);