Bug 401292 - application and addon updates fail when Danish Government browser extension is installed; Second patch v1; r=dveditz
authorJesper Kristensen <bugzilla@jesperkristensen.dk>
Sat, 06 Dec 2008 18:31:39 +0100
changeset 22435 7482683c532a2bf452f6f4e38e3e0956c0183442
parent 22434 7650cecd9913e5d7a3f86648e379e01a24a58359
child 22436 2ee44f184ffc00e78682482b5b83194bd845ed77
push idunknown
push userunknown
push dateunknown
reviewersdveditz
bugs401292
milestone1.9.2a1pre
Bug 401292 - application and addon updates fail when Danish Government browser extension is installed; Second patch v1; r=dveditz
security/manager/ssl/public/nsIX509Cert3.idl
xpinstall/src/nsXPInstallManager.cpp
--- a/security/manager/ssl/public/nsIX509Cert3.idl
+++ b/security/manager/ssl/public/nsIX509Cert3.idl
@@ -75,17 +75,17 @@ interface nsIX509Cert3 : nsIX509Cert2 {
                    [retval, array, size_is(length)] out octet data);
 
   readonly attribute boolean isSelfSigned;
 
   /**
    * Human readable names identifying all hardware or
    * software tokens the certificate is stored on.
    *
-   * @param On success, the number of entries in the returned array.
+   * @param length On success, the number of entries in the returned array.
    * @return On success, an array containing the names of all tokens 
    *         the certificate is stored on (may be empty).
    *         On failure the function throws/returns an error.
    */
   void getAllTokenNames(out unsigned long length,
                        [retval, array, size_is(length)] out wstring
                        tokenNames);
 };
--- a/xpinstall/src/nsXPInstallManager.cpp
+++ b/xpinstall/src/nsXPInstallManager.cpp
@@ -79,16 +79,17 @@
 #include "nsIScriptGlobalObject.h"
 #include "nsXPCOM.h"
 #include "nsISupportsPrimitives.h"
 #include "nsIObserverService.h"
 
 #include "nsISSLStatusProvider.h"
 #include "nsISSLStatus.h"
 #include "nsIX509Cert.h"
+#include "nsIX509Cert3.h"
 
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 
 #include "CertReader.h"
 
 #include "nsEmbedCID.h"
 
@@ -1096,21 +1097,26 @@ nsXPInstallManager::CheckCert(nsIChannel
     PRBool equal;
     while (issuer && NS_SUCCEEDED(cert->Equals(issuer, &equal)) && !equal) {
         cert = issuer;
         rv = cert->GetIssuer(getter_AddRefs(issuer));
         NS_ENSURE_SUCCESS(rv, rv);
     }
 
     if (issuer) {
-        nsAutoString tokenName;
-        rv = issuer->GetTokenName(tokenName);
+        PRUint32 length;
+        PRUnichar** tokenNames;
+        nsCOMPtr<nsIX509Cert3> issuer2(do_QueryInterface(issuer));
+        NS_ENSURE_TRUE(status, NS_ERROR_FAILURE);
+        rv = issuer2->GetAllTokenNames(&length, &tokenNames);
         NS_ENSURE_SUCCESS(rv ,rv);
-        if (tokenName.Equals(NS_LITERAL_STRING("Builtin Object Token")))
-            return NS_OK;
+        for (PRUint32 i = 0; i < length; i++) {
+            if (nsDependentString(tokenNames[i]).Equals(NS_LITERAL_STRING("Builtin Object Token")))
+                return NS_OK;
+        }
     }
     return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 nsXPInstallManager::OnStartRequest(nsIRequest* request, nsISupports *ctxt)
 {
     nsresult rv = NS_ERROR_FAILURE;