[Pkg-mozext-commits] [perspectives-extension] 31/72: Fixed #132 distrust_all_certificates fixed in distrust_all_certificates: cert needs to query for nsIX509CertDB first otherwise setCertTrust() wont work changed in distrust_all_certificates: renamed distrusts_all_certificates() to distrust_all_certificates() added in distrust_all_certificates: number of current and trusted certificates, alerts and localized strings

David Prévot taffit at moszumanska.debian.org
Thu Dec 11 02:12:48 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository perspectives-extension.

commit 345c3919dff15b89103dca4be9755d3282c74089
Author: Gerold Meisinger <gerold.meisinger at gmail.com>
Date:   Sat Oct 18 11:23:37 2014 +0100

    Fixed #132 distrust_all_certificates
    fixed in distrust_all_certificates: cert needs to query for nsIX509CertDB first otherwise setCertTrust() wont work
    changed in distrust_all_certificates: renamed distrusts_all_certificates() to distrust_all_certificates()
    added in distrust_all_certificates: number of current and trusted certificates, alerts and localized strings
---
 plugin/chrome/content/statusbar.js             | 66 ++++++++++++++++++--------
 plugin/chrome/content/statusbar.xul            |  6 +--
 plugin/chrome/locale/de/notaries.properties    |  8 ++++
 plugin/chrome/locale/en-US/notaries.properties |  8 ++++
 plugin/chrome/locale/es-MX/notaries.properties |  8 ++++
 plugin/chrome/locale/fi/notaries.properties    |  8 ++++
 plugin/chrome/locale/fr/notaries.properties    |  8 ++++
 plugin/chrome/locale/nl/notaries.properties    |  8 ++++
 plugin/chrome/locale/pl/notaries.properties    | 20 +++++---
 plugin/chrome/locale/zh-CN/notaries.properties |  8 ++++
 10 files changed, 120 insertions(+), 28 deletions(-)

diff --git a/plugin/chrome/content/statusbar.js b/plugin/chrome/content/statusbar.js
index a614d31..0ffbaf3 100644
--- a/plugin/chrome/content/statusbar.js
+++ b/plugin/chrome/content/statusbar.js
@@ -122,26 +122,54 @@ var Pers_statusbar = {
 			"Certificate Manager","centerscreen,chrome");
 	},
 
-	distrusts_all_certificates : function() {
-		var PROMPT = "The CA system is broken";
-		var str = window.prompt(
-			"Perspectives - THIS WILL DISTRUST ALL YOUR BROWSER'S CERTIFICATES! - USE WITH CAUTION!\n" +
-			"If you know what you are doing please enter the following sentence: '" + PROMPT + "'", "");
-		if(str.toLowerCase() === PROMPT.toLowerCase()) {
-			var certDB2 = Components.classes["@mozilla.org/security/x509certdb;1"].getService(Components.interfaces.nsIX509CertDB2);
-			certDB2.QueryInterface(Components.interfaces.nsIX509CertDB);
-			var i = 0;
-			var it = certDB2.getCerts().getEnumerator();
-			while(it.hasMoreElements()) {
-				var cert = it.getNext();
-				certDB2.setCertTrust(cert, cert.CA_CERT    , 0);
-				certDB2.setCertTrust(cert, cert.USER_CERT  , 0);
-				certDB2.setCertTrust(cert, cert.EMAIL_CERT , 0);
-				certDB2.setCertTrust(cert, cert.SERVER_CERT, 0);
-				i += 1;
-			}
+	distrust_all_certificates : function() {
+		if(Perspectives.strbundle == null) {
+			Perspectives.strbundle = document.getElementById("notary_strings");
+		}
 
-			alert(i + " certificates have been distrusted.");
+		try
+		{
+			var prompt = window.prompt(
+				Perspectives.strbundle.getString("distrustAllWarning"    ) + "\n" +
+				Perspectives.strbundle.getString("distrustAllDescription") + "\n" +
+				Perspectives.strbundle.getString("distrustAllPrompt"     ) + " " + Perspectives.strbundle.getString("distrustAllPhrase"));
+			var phrase = Perspectives.strbundle.getString("distrustAllPhrase");
+			if(prompt.toLowerCase() === phrase.toLowerCase()) {
+				var Cc = Components.classes
+				var Ci = Components.interfaces
+
+				var nCerts      = 0;
+				var nDistrusted = 0;
+				var certDB2 = Cc["@mozilla.org/security/x509certdb;1"].getService(Ci.nsIX509CertDB2);
+				certDB2.QueryInterface(Ci.nsIX509CertDB);
+				var it = certDB2.getCerts().getEnumerator();
+				while(it.hasMoreElements())
+				{
+					var cert = it.getNext();
+
+					cert.QueryInterface(Ci.nsIX509Cert2);
+					var trustSSL     = certDB2.isCertTrusted(cert, cert.certType, Ci.nsIX509CertDB.TRUSTED_SSL    );
+					var trustEmail   = certDB2.isCertTrusted(cert, cert.certType, Ci.nsIX509CertDB.TRUSTED_EMAIL  );
+					var trustObjsign = certDB2.isCertTrusted(cert, cert.certType, Ci.nsIX509CertDB.TRUSTED_OBJSIGN);
+					if(trustSSL || trustEmail || trustObjsign)
+					{
+						certDB2.setCertTrust(cert, cert.certType, 0);
+						nDistrusted += 1
+					}
+
+					nCerts += 1;
+				}
+
+				Pers_util.pers_alert(Perspectives.strbundle.getFormattedString("distrustAllSuccess", ['' + nCerts, '' + nDistrusted]));
+			}
+			else
+			{
+				Pers_util.pers_alert(Perspectives.strbundle.getString("distrustAllPhraseWrong"));
+			}
+		} catch(e)
+		{
+			Pers_debug.d_print("error", "Perspectives had an internal error in distrust_all_certificates(): " + e);
+			Pers_util.pers_alert(Perspectives.strbundle.getFormattedString("internalError", ["distrust_all_certificates - " + e]));
 		}
 	},
 
diff --git a/plugin/chrome/content/statusbar.xul b/plugin/chrome/content/statusbar.xul
index 5d191c9..a4392d5 100644
--- a/plugin/chrome/content/statusbar.xul
+++ b/plugin/chrome/content/statusbar.xul
@@ -41,7 +41,7 @@
 	<!--      <menuitem label="Refresh All Notary Data"   oncommand="requery()"/> -->
 		  <menuitem label="&Preferences;"             oncommand="Pers_statusbar.open_preferences_dialog()"    />
 		  <menuitem label="&ViewCertificateStore;"    oncommand="Pers_statusbar.openCertificates()"           />
-          <menuitem label="&DistrustAllCertificates;" oncommand="Pers_statusbar.distrusts_all_certificates()" />
+          <menuitem label="&DistrustAllCertificates;" oncommand="Pers_statusbar.distrust_all_certificates()"  />
 		  <menuitem label="&Help;"                    oncommand="Pers_statusbar.openHelp()"                   />
 		  <!-- TODO enable once all strings have been localized
 		  <menuitem label="&About;" oncommand="Pers_statusbar.open_about_dialog()"/>
@@ -61,7 +61,7 @@
       			<menuseparator/>
       			<menuitem label="&Preferences;"             oncommand="Pers_statusbar.open_preferences_dialog()"    />
       			<menuitem label="&ViewCertificateStore;"    oncommand="Pers_statusbar.openCertificates()"           />
-                <menuitem label="&DistrustAllCertificates;" oncommand="Pers_statusbar.distrusts_all_certificates()" />
+                <menuitem label="&DistrustAllCertificates;" oncommand="Pers_statusbar.distrust_all_certificates()"  />
       			<menuitem label="&Help;"                    oncommand="Pers_statusbar.openHelp()"                   />
       			<!-- TODO enable once all strings have been localized
       			<menuitem label="&About;" oncommand="Pers_statusbar.open_about_dialog()"/>
@@ -81,7 +81,7 @@
       			<menuseparator/>
       			<menuitem label="&Preferences;"             oncommand="Pers_statusbar.open_preferences_dialog()"    />
       			<menuitem label="&ViewCertificateStore;"    oncommand="Pers_statusbar.openCertificates()"           />
-                <menuitem label="&DistrustAllCertificates;" oncommand="Pers_statusbar.distrusts_all_certificates()" />
+                <menuitem label="&DistrustAllCertificates;" oncommand="Pers_statusbar.distrust_all_certificates()"  />
       			<menuitem label="&Help;"                    oncommand="Pers_statusbar.openHelp()"                   />
       			<!-- TODO enable once all strings have been localized
       			<menuitem label="&About;" oncommand="Pers_statusbar.open_about_dialog()"/>
diff --git a/plugin/chrome/locale/de/notaries.properties b/plugin/chrome/locale/de/notaries.properties
index 74b035b..485beda 100644
--- a/plugin/chrome/locale/de/notaries.properties
+++ b/plugin/chrome/locale/de/notaries.properties
@@ -69,3 +69,11 @@ updatePrompt=Danke, dass sie Perspectives aktualisiert haben. Seit Perspectives
 updatePromptButtonYes=Ja, Notare für alle HTTPS-Verbindungen kontaktieren
 updatePromptButtonNo=Nein, Notare nur bei Zertifikatsfehlern kontaktieren
 hideNotificationReminders=Diese Nachricht verstecken
+distrustAllTitle=Perspectives - Allen Zertifikaten misstrauen
+distrustAllWarning=HIERMIT WERDEN ALLE ZERTIFIKATE ALS "NICHT VERTRAUENSWÜRDIG" MARKIERT! - BITTE MIT VORSICHT VERWENDEN!
+distrustAllDescription=Die aktuellen Einstellungen zur Vertrauenswürdigkeit der Zertifikate werden nicht gespeichert und können daher auch nicht mehr wiederhergestellt werden. Um den ursprünglichen Browserzustand wiederherzustellen müssen Sie nur die Datei "cert8.db" im Firefox profile Verzeichnis löschen, allerdings gehen damit alle benutzerdefinierten Zertifikate verloren.
+# this phrase has to be entered by the user and should be kept simple
+distrustAllPrompt=Wenn Sie die Warnung verstanden haben und wissen was Sie tun geben Sie bitte folgende Phrase ein:
+distrustAllPhrase=Das CA System ist kaputt
+distrustAllPhraseWrong=Die eingegebene Phrase ist falsch. Es wurde kein Zertifikat geändert.
+distrustAllSuccess=Es wurden %1$S Zertifikate gefunden. %2$S vertrauenswürdige Zertifikate wurden als "nicht vertrauenswürdig" markiert.
diff --git a/plugin/chrome/locale/en-US/notaries.properties b/plugin/chrome/locale/en-US/notaries.properties
index e9845ec..67c34a0 100644
--- a/plugin/chrome/locale/en-US/notaries.properties
+++ b/plugin/chrome/locale/en-US/notaries.properties
@@ -68,3 +68,11 @@ updatePromptTitle=Perspectives Update
 updatePrompt=Thank you for updating Perspectives. As of Perspectives 4.0, the default setting is to contact notaries for *all* HTTPS sites rather than only when there is a certificate error.\n\nDo you want to contact notaries for all HTTPS sites?\n(This can be changed at any time in the Preferences window)
 updatePromptButtonYes=Yes, contact notaries for all HTTPS sites.
 updatePromptButtonNo=No, only check for websites with certificate errors.
+distrustAllTitle=Perspectives - Distrust all certificates
+distrustAllWarning=THIS WILL MARK ALL YOUR BROWSER'S CERTIFICATES AS "NOT TRUSTED" - USE WITH CAUTION!
+distrustAllDescription=The current trust states of your certificates will not be saved and cannot be recovered. If you want to restore the browser's original state you may delete the file "cert8.db" in your Firefox's profile directory, however this will delete all your custom certificates.
+# this phrase has to be entered by the user and should be kept simple
+distrustAllPrompt=If you understand the warning and know what you are doing please enter the following phrase:
+distrustAllPhrase=The CA system is broken
+distrustAllPhraseWrong=The entered phrase is wrong. No certificate has been changed.
+distrustAllSuccess=Found %1$S certificates. %2$S trusted certificates have been marked as "untrusted".
diff --git a/plugin/chrome/locale/es-MX/notaries.properties b/plugin/chrome/locale/es-MX/notaries.properties
index 883f075..f3fdf1a 100644
--- a/plugin/chrome/locale/es-MX/notaries.properties
+++ b/plugin/chrome/locale/es-MX/notaries.properties
@@ -77,3 +77,11 @@ updatePrompt=Thank you for updating Perspectives. As of Perspectives 4.0, the de
 updatePromptButtonYes=Yes, contact notaries for all HTTPS sites
 updatePromptButtonNo=No, only check for websites with certificate errors
 hideNotificationReminders=Hide these messages
+distrustAllTitle=Perspectives - Distrust all certificates
+distrustAllWarning=THIS WILL MARK ALL YOUR BROWSER'S CERTIFICATES AS "NOT TRUSTED" - USE WITH CAUTION!
+distrustAllDescription=The current trust states of your certificates will not be saved and cannot be recovered. If you want to restore the browser's original state you may delete the file "cert8.db" in your Firefox's profile directory, however this will delete all your custom certificates.
+# this phrase has to be entered by the user and should be kept simple
+distrustAllPrompt=If you understand the warning and know what you are doing please enter the following phrase:
+distrustAllPhrase=The CA system is broken
+distrustAllPhraseWrong=The entered phrase is wrong. No certificate has been changed.
+distrustAllSuccess=Found %1$S certificates. %2$S trusted certificates have been marked as "untrusted".
diff --git a/plugin/chrome/locale/fi/notaries.properties b/plugin/chrome/locale/fi/notaries.properties
index 03d6973..1518428 100644
--- a/plugin/chrome/locale/fi/notaries.properties
+++ b/plugin/chrome/locale/fi/notaries.properties
@@ -74,3 +74,11 @@ updatePromptTitle=Perspectives Update
 updatePrompt=Thank you for updating Perspectives. As of Perspectives 4.0, the default setting is to contact notaries for *all* HTTPS sites rather than only when there is a certificate error.\n\nDo you want to contact notaries for all HTTPS sites?\n(This can be changed at any time in the Preferences window)
 updatePromptButtonYes=Yes, contact notaries for all HTTPS sites
 updatePromptButtonNo=No, only check for websites with certificate errors
+distrustAllTitle=Perspectives - Distrust all certificates
+distrustAllWarning=THIS WILL MARK ALL YOUR BROWSER'S CERTIFICATES AS "NOT TRUSTED" - USE WITH CAUTION!
+distrustAllDescription=The current trust states of your certificates will not be saved and cannot be recovered. If you want to restore the browser's original state you may delete the file "cert8.db" in your Firefox's profile directory, however this will delete all your custom certificates.
+# this phrase has to be entered by the user and should be kept simple
+distrustAllPrompt=If you understand the warning and know what you are doing please enter the following phrase:
+distrustAllPhrase=The CA system is broken
+distrustAllPhraseWrong=The entered phrase is wrong. No certificate has been changed.
+distrustAllSuccess=Found %1$S certificates. %2$S trusted certificates have been marked as "untrusted".
diff --git a/plugin/chrome/locale/fr/notaries.properties b/plugin/chrome/locale/fr/notaries.properties
index dc57719..e942f91 100644
--- a/plugin/chrome/locale/fr/notaries.properties
+++ b/plugin/chrome/locale/fr/notaries.properties
@@ -75,3 +75,11 @@ updatePrompt=Thank you for updating Perspectives. As of Perspectives 4.0, the de
 updatePromptButtonYes=Yes, contact notaries for all HTTPS sites
 updatePromptButtonNo=No, only check for websites with certificate errors
 hideNotificationReminders=Hide these messages
+distrustAllTitle=Perspectives - Distrust all certificates
+distrustAllWarning=THIS WILL MARK ALL YOUR BROWSER'S CERTIFICATES AS "NOT TRUSTED" - USE WITH CAUTION!
+distrustAllDescription=The current trust states of your certificates will not be saved and cannot be recovered. If you want to restore the browser's original state you may delete the file "cert8.db" in your Firefox's profile directory, however this will delete all your custom certificates.
+# this phrase has to be entered by the user and should be kept simple
+distrustAllPrompt=If you understand the warning and know what you are doing please enter the following phrase:
+distrustAllPhrase=The CA system is broken
+distrustAllPhraseWrong=The entered phrase is wrong. No certificate has been changed.
+distrustAllSuccess=Found %1$S certificates. %2$S trusted certificates have been marked as "untrusted".
diff --git a/plugin/chrome/locale/nl/notaries.properties b/plugin/chrome/locale/nl/notaries.properties
index f6fa0c2..5e9a052 100644
--- a/plugin/chrome/locale/nl/notaries.properties
+++ b/plugin/chrome/locale/nl/notaries.properties
@@ -74,3 +74,11 @@ updatePrompt=Thank you for updating Perspectives. As of Perspectives 4.0, the de
 updatePromptButtonYes=Yes, contact notaries for all HTTPS sites
 updatePromptButtonNo=No, only check for websites with certificate errors
 hideNotificationReminders=Hide these messages
+distrustAllTitle=Perspectives - Distrust all certificates
+distrustAllWarning=THIS WILL MARK ALL YOUR BROWSER'S CERTIFICATES AS "NOT TRUSTED" - USE WITH CAUTION!
+distrustAllDescription=The current trust states of your certificates will not be saved and cannot be recovered. If you want to restore the browser's original state you may delete the file "cert8.db" in your Firefox's profile directory, however this will delete all your custom certificates.
+# this phrase has to be entered by the user and should be kept simple
+distrustAllPrompt=If you understand the warning and know what you are doing please enter the following phrase:
+distrustAllPhrase=The CA system is broken
+distrustAllPhraseWrong=The entered phrase is wrong. No certificate has been changed.
+distrustAllSuccess=Found %1$S certificates. %2$S trusted certificates have been marked as "untrusted".
diff --git a/plugin/chrome/locale/pl/notaries.properties b/plugin/chrome/locale/pl/notaries.properties
index b11f5fc..3bf8f6c 100644
--- a/plugin/chrome/locale/pl/notaries.properties
+++ b/plugin/chrome/locale/pl/notaries.properties
@@ -61,6 +61,12 @@ keyEnd=koniec
 keyDays=dni
 noResults=Brak wyników
 signature=Podpis
+#strings for the 'update preferences' dialog in prompt_update()
+#this is a lot of text, so we break it up with \ns to make it more readable.
+updatePromptTitle=Aktualizacja Perspectives
+updatePrompt=Dziękujemy za aktualizację Perspectives. Od wersji 4.0 domyślnie ustawione jest kontaktowanie się z notariuszami odnośnie każdej strony HTTPS, a nie tylko i wyłącznie w przypadku niepowodzenia weryfikacji certyfikatu.\n\nCzy chcesz kontaktować się z notariuszami dla wszystkich stron HTTPS?\n(W każdym momencie możesz zmienić swoją decyzję w oknie ustawień)
+updatePromptButtonYes=Tak, kontaktuj się z notariuszami dla wszystkich stron HTTPS
+updatePromptButtonNo=Nie, sprawdzaj tylko strony internetowe, które mają błędne certyfikaty
 # TODO: translate
 trustedButInsecureEmbedded=HTTPS Certificate is trusted, but site contains insecure embedded content.
 trustedWeaklyButInsecureEmbedded=HTTPS Certificate is weakly trusted, but site contains insecure embedded content.
@@ -68,9 +74,11 @@ trustedMultipleByBrowser=This site uses multiple certificates, including the cer
 untrustedMultipleNotSeen=This site regularly uses multiples certificates, and most Notaries have not recently seen the certificate received by the browser.
 untrustedMultipleNotVerifiable=Perspectives is unable to validate this site, because the site regularly uses multiples certificates.
 #
-#strings for the 'update preferences' dialog in prompt_update()
-#this is a lot of text, so we break it up with \ns to make it more readable.
-updatePromptTitle=Aktualizacja Perspectives
-updatePrompt=Dziękujemy za aktualizację Perspectives. Od wersji 4.0 domyślnie ustawione jest kontaktowanie się z notariuszami odnośnie każdej strony HTTPS, a nie tylko i wyłącznie w przypadku niepowodzenia weryfikacji certyfikatu.\n\nCzy chcesz kontaktować się z notariuszami dla wszystkich stron HTTPS?\n(W każdym momencie możesz zmienić swoją decyzję w oknie ustawień)
-updatePromptButtonYes=Tak, kontaktuj się z notariuszami dla wszystkich stron HTTPS
-updatePromptButtonNo=Nie, sprawdzaj tylko strony internetowe, które mają błędne certyfikaty
+distrustAllTitle=Perspectives - Distrust all certificates
+distrustAllWarning=THIS WILL MARK ALL YOUR BROWSER'S CERTIFICATES AS "NOT TRUSTED" - USE WITH CAUTION!
+distrustAllDescription=The current trust states of your certificates will not be saved and cannot be recovered. If you want to restore the browser's original state you may delete the file "cert8.db" in your Firefox's profile directory, however this will delete all your custom certificates.
+# this phrase has to be entered by the user and should be kept simple
+distrustAllPrompt=If you understand the warning and know what you are doing please enter the following phrase:
+distrustAllPhrase=The CA system is broken
+distrustAllPhraseWrong=The entered phrase is wrong. No certificate has been changed.
+distrustAllSuccess=Found %1$S certificates. %2$S trusted certificates have been marked as "untrusted".
diff --git a/plugin/chrome/locale/zh-CN/notaries.properties b/plugin/chrome/locale/zh-CN/notaries.properties
index debe232..8755649 100644
--- a/plugin/chrome/locale/zh-CN/notaries.properties
+++ b/plugin/chrome/locale/zh-CN/notaries.properties
@@ -74,3 +74,11 @@ updatePrompt=Thank you for updating Perspectives. As of Perspectives 4.0, the de
 updatePromptButtonYes=Yes, contact notaries for all HTTPS sites
 updatePromptButtonNo=No, only check for websites with certificate errors
 hideNotificationReminders=Hide these messages
+distrustAllTitle=Perspectives - Distrust all certificates
+distrustAllWarning=THIS WILL MARK ALL YOUR BROWSER'S CERTIFICATES AS "NOT TRUSTED" - USE WITH CAUTION!
+distrustAllDescription=The current trust states of your certificates will not be saved and cannot be recovered. If you want to restore the browser's original state you may delete the file "cert8.db" in your Firefox's profile directory, however this will delete all your custom certificates.
+# this phrase has to be entered by the user and should be kept simple
+distrustAllPrompt=If you understand the warning and know what you are doing please enter the following phrase:
+distrustAllPhrase=The CA system is broken
+distrustAllPhraseWrong=The entered phrase is wrong. No certificate has been changed.
+distrustAllSuccess=Found %1$S certificates. %2$S trusted certificates have been marked as "untrusted".

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/perspectives-extension.git



More information about the Pkg-mozext-commits mailing list