[Pkg-mozext-commits] [perspectives-extension] 01/03: Pers_client_policy - Add checks against quorum size 0

David Prévot taffit at alioth.debian.org
Mon Sep 30 02:15:03 UTC 2013


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

taffit pushed a commit to branch patch-queue/wheezy
in repository perspectives-extension.

commit a8fd756067d9e4787e8d222d8a460ee77ddba3f0
Author: Dave Schaefer <dave.schaefer at gmail.com>
Date:   Wed Sep 18 21:26:48 2013 -0600

    Pers_client_policy - Add checks against quorum size 0
    
    We should never return true nor report any duration for sizes < 1.
    
    Origin: upstream, https://github.com/danwent/Perspectives/commit/cb3d9913217afb0973281275cd4269ed0c1acc2c
    Bug: https://github.com/danwent/Perspectives/issues/87
---
 plugin/chrome/content/client_policy.js |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/plugin/chrome/content/client_policy.js b/plugin/chrome/content/client_policy.js
index fd74f43..72f31c6 100644
--- a/plugin/chrome/content/client_policy.js
+++ b/plugin/chrome/content/client_policy.js
@@ -119,6 +119,10 @@ get_all_key_changes : function(results) {
 } , 
 
 check_current_consistency : function(test_key,results,quorum_size,stale_limit_secs,cur_time) {
+	if (quorum_size < 1) {
+		Pers_debug.d_print("error", "ERROR: quorum size cannot be less than 1.");
+		return false;
+	}
   	//get_all_key_changes(results); 
 	var num_valid = Pers_client_policy.get_num_valid_notaries(test_key,results,stale_limit_secs,cur_time);
 	Pers_debug.d_print("policy", 
@@ -127,6 +131,10 @@ check_current_consistency : function(test_key,results,quorum_size,stale_limit_se
 }, 
 
 has_quorum_at_time : function(test_key, results, quorum_size, time) {
+	if (quorum_size < 1) {
+		Pers_debug.d_print("error", "ERROR: quorum size cannot be less than 1.");
+		return false;
+	}
 	Pers_debug.d_print("policy", "testing quorum for time " + time + 
 			" and key: " + test_key); 
 	var total_valid = 0; 
@@ -156,6 +164,11 @@ has_quorum_at_time : function(test_key, results, quorum_size, time) {
 // returns duration in seconds - i.e. days * 24 * 3600.
 get_quorum_duration : function(test_key, results, quorum_size, stale_limit_secs, unixtime) { 
 
+	if (quorum_size < 1) {
+		Pers_debug.d_print("error", "ERROR: quorum size cannot be less than 1.");
+		return false;
+	}
+
 	if(! Pers_client_policy.check_current_consistency(test_key,results,quorum_size,
 					stale_limit_secs,unixtime)) { 
 		Pers_debug.d_print("policy","current_consistency_failed"); 

-- 
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