commit 044227d4f553ca4996a6c3e289c0df547025317b Author: Isis Lovecruft isis@torproject.org Date: Mon Apr 22 00:29:25 2013 +0000
Fix #8440, set the self.host attribute when given the --host option.
* Port option doesn't need to be fixed. It does what the option help string always said it does (which is actually slightly confusing and perhaps should be changed): it sets *all* the hosts' ports to --port. So, given a file of host:ports and a '--host 1.2.3.4:4343' cmdline option, if also given '--port 443', it will check every host, both in the file and the cmdline directives, on port 443. This is useful for checking a specific port, like if we wanted to check TLSv1 on the IMAPS (993) port for every host. --- nettests/experimental/tls_handshake.py | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-)
diff --git a/nettests/experimental/tls_handshake.py b/nettests/experimental/tls_handshake.py index 35955dc..1ac3661 100644 --- a/nettests/experimental/tls_handshake.py +++ b/nettests/experimental/tls_handshake.py @@ -147,22 +147,11 @@ class HandshakeTest(nettest.NetTestCase): options = self.localOptions
## check that we're testing an IP:PORT, else exit gracefully: - if not ((options['host'] and options['port']) or options['file']): - sys.exit("Need --host and --port, or --file!") + if not (options['host'] or options['file']): + raise SystemExit("Need --host or --file!") + if options['host']: + self.host = options['host']
- ## xxx TODO there's nothing that tells the user they can only have - ## one of the TLS/SSL methods at a time. - - ## set the SSL/TLS method to use: - if options['ssl2']: - if not options['ssl3']: - self.context = SSL.Context(SSL.SSLv2_METHOD) - else: - self.context = SSL.Context(SSL.SSLv23_METHOD) - elif options['ssl3']: - self.context = SSL.Context(SSL.SSLv3_METHOD) - elif options['tls1']: - self.context = SSL.Context(SSL.TLSv1_METHOD) else: try: raise NoSSLContextError(
tor-commits@lists.torproject.org