From 4a9f282bf7a153eecc5b205268df69cbeb4111b3 Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Thu, 16 Apr 2015 21:53:16 +0200 Subject: Implement connection_setup for beinc_weechat.py --- beinc_poller.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'beinc_poller.py') diff --git a/beinc_poller.py b/beinc_poller.py index f9c5cca..d4eb1e5 100755 --- a/beinc_poller.py +++ b/beinc_poller.py @@ -180,12 +180,11 @@ def poll_notifications(scheduler, args): if sys.hexversion >= 0x20709f0: # Python >= 2.7.9 context = ssl.SSLContext(ssl_version) - context.verify_mode = ssl.CERT_REQUIRED - if args.no_cert_validate: - context.verify_mode = ssl.CERT_NONE - context.check_hostname = bool(not args.disable_hostname_check) - if args.cert and not args.no_cert_validate: + context.verify_mode = ssl.CERT_NONE + if args.cert: + context.verify_mode = ssl.CERT_REQUIRED context.load_verify_locations(os.path.expanduser(args.cert)) + context.check_hostname = bool(not args.disable_hostname_check) if args.ciphers: context.set_ciphers(args.ciphers) transport = xmlrpclib.SafeTransport(context=context) @@ -193,9 +192,8 @@ def poll_notifications(scheduler, args): # Python < 2.7.9 ssl_options = {} ssl_options['ssl_version'] = ssl_version - if args.cert and not args.no_cert_validate: + if args.cert: ssl_options['ca_certs'] = os.path.expanduser(args.cert) - if not args.no_cert_validate: ssl_options['cert_reqs'] = ssl.CERT_REQUIRED if args.ciphers: ssl_options['ciphers'] = args.ciphers @@ -300,12 +298,6 @@ def main(): dest='rname', required=True, help='The name of the BEINC-resource on the remote server') - parser.add_argument( - '--no-cert-validate', - action='store_true', - dest='no_cert_validate', - default=False, - help='Do not validate server certificate') parser.add_argument( '-o', '--osd-system', metavar='SYSTEM', -- cgit v1.3