[tor-commits] [flashproxy/master] Add M2Crypto check to flashproxy-reg-url.

dcf at torproject.org dcf at torproject.org
Sun May 19 06:29:08 UTC 2013


commit e182e4b68fee4fdfe9358e7e238fc9902aae2d29
Author: David Fifield <david at bamsoftware.com>
Date:   Sat May 18 23:28:19 2013 -0700

    Add M2Crypto check to flashproxy-reg-url.
    
    Like in flashproxy-reg-email.
---
 flashproxy-reg-url |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/flashproxy-reg-url b/flashproxy-reg-url
index 77935e1..b30c550 100755
--- a/flashproxy-reg-url
+++ b/flashproxy-reg-url
@@ -7,7 +7,11 @@ import socket
 import sys
 import urlparse
 
-from M2Crypto import RSA, BIO
+try:
+    from M2Crypto import BIO, RSA
+except ImportError:
+    # Defer the error reporting so that --help works even without M2Crypto.
+    RSA = None
 
 DEFAULT_REMOTE_ADDRESS = None
 DEFAULT_REMOTE_PORT = 9000
@@ -124,6 +128,17 @@ if not remote_addr[0]:
     print >> sys.stderr, "An IP address (not just a port) is required."
     sys.exit(1)
 
+if RSA is None:
+    print >> sys.stderr, """\
+This program requires the M2Crypto library, which is not installed.
+
+You can install it using one of the packages at
+http://chandlerproject.org/Projects/MeTooCrypto#Downloads.
+
+On Debian-like systems, use the command "apt-get install python-m2crypto".\
+"""
+    sys.exit(1)
+
 reg_plain = (u"client=%s" % format_addr(remote_addr)).encode("utf-8")
 rsa = get_facilitator_pubkey()
 reg_crypt = rsa.public_encrypt(reg_plain, RSA.pkcs1_oaep_padding)



More information about the tor-commits mailing list