[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [bridgedb/develop] Add whitelist attribute to bridgedb.Dist.EmailBasedDistributor.



commit 2795e102abfa067516bab89b834949a191e88dd8
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date:   Mon Jun 9 19:47:48 2014 +0000

    Add whitelist attribute to bridgedb.Dist.EmailBasedDistributor.
    
     * ADD bridgedb.Dist.EmailBasedDistributor.whitelist attribute which
       should hold the contents of the EMAIL_WHITELIST setting in
       bridgedb.conf.
    
     * CHANGE createBridgeRings() function in bridgedb.Main module to use
       the new email distributor whitelist attribute, and pass it the
       settings from the parsed config file.
---
 lib/bridgedb/Dist.py |    6 +++++-
 lib/bridgedb/Main.py |    3 ++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/bridgedb/Dist.py b/lib/bridgedb/Dist.py
index 5c0cbac..0ba2233 100644
--- a/lib/bridgedb/Dist.py
+++ b/lib/bridgedb/Dist.py
@@ -348,7 +348,7 @@ class EmailBasedDistributor(Distributor):
     """
 
     def __init__(self, key, domainmap, domainrules,
-                 answerParameters=None):
+                 answerParameters=None, whitelist=None):
         """Create a bridge distributor which uses email.
 
         :type emailHmac: callable
@@ -359,6 +359,9 @@ class EmailBasedDistributor(Distributor):
             in `bridgedb.conf`.
         :param domainrules: DOCDOC
         :param answerParameters: DOCDOC
+        :type whitelist: dict or ``None``
+        :param whitelist: A dictionary that maps whitelisted email addresses
+            to GnuPG fingerprints.
         """
         key1 = getHMAC(key, "Map-Addresses-To-Ring")
         self.emailHmac = getHMACFunc(key1, hex=False)
@@ -367,6 +370,7 @@ class EmailBasedDistributor(Distributor):
         # XXXX clear the store when the period rolls over!
         self.domainmap = domainmap
         self.domainrules = domainrules
+        self.whitelist = whitelist or dict()
         self.answerParameters = answerParameters
 
         #XXX cache options not implemented
diff --git a/lib/bridgedb/Main.py b/lib/bridgedb/Main.py
index ccc844d..4f138f0 100644
--- a/lib/bridgedb/Main.py
+++ b/lib/bridgedb/Main.py
@@ -383,7 +383,8 @@ def createBridgeRings(cfg, proxyList, key):
             crypto.getHMAC(key, "Email-Dist-Key"),
             cfg.EMAIL_DOMAIN_MAP.copy(),
             cfg.EMAIL_DOMAIN_RULES.copy(),
-            answerParameters=ringParams)
+            answerParameters=ringParams,
+            whitelist=cfg.EMAIL_WHITELIST.copy())
         splitter.addRing(emailDistributor, "email", cfg.EMAIL_SHARE)
 
     # As appropriate, tell the splitter to leave some bridges unallocated.



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits