Browse code

Fixes #581 regarding the reporting of SSL verification issues. Other problems of this issues should already be fixed.

Florent Viard authored on 2015/09/11 23:16:39
Showing 1 changed files
... ...
@@ -45,6 +45,8 @@ from optparse import OptionParser, Option, OptionValueError, IndentedHelpFormatt
45 45
 from logging import debug, info, warning, error
46 46
 from distutils.spawn import find_executable
47 47
 
48
+from ssl import SSLError
49
+
48 50
 def output(message):
49 51
     sys.stdout.write(message + "\n")
50 52
     sys.stdout.flush()
... ...
@@ -2742,6 +2744,11 @@ if __name__ == '__main__':
2742 2742
         sys.stderr.write("See ya!\n")
2743 2743
         sys.exit(EX_BREAK)
2744 2744
 
2745
+    except SSLError, e:
2746
+        # SSLError is a subtype of IOError
2747
+        error("SSL certificate verification failure: %s" % e)
2748
+        sys.exit(EX_ACCESSDENIED)
2749
+
2745 2750
     except IOError, e:
2746 2751
         if e.errno == errno.EPIPE:
2747 2752
             # Fail silently on SIGPIPE. This likely means we wrote to a closed