diff options
| author | Simeon Simeonov | 2015-04-16 21:53:16 +0200 |
|---|---|---|
| committer | Simeon Simeonov | 2015-04-16 21:53:16 +0200 |
| commit | 4a9f282bf7a153eecc5b205268df69cbeb4111b3 (patch) | |
| tree | 6bc93fbc11c2bbf2f2fc28835d0486c8624d2bc3 /beinc_poller.py | |
| parent | 9c06ebe90039423809f51af1d62098ae7f5c813e (diff) | |
Implement connection_setup for beinc_weechat.py
Diffstat (limited to 'beinc_poller.py')
| -rwxr-xr-x | beinc_poller.py | 18 |
1 files changed, 5 insertions, 13 deletions
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): | |||
| 180 | if sys.hexversion >= 0x20709f0: | 180 | if sys.hexversion >= 0x20709f0: |
| 181 | # Python >= 2.7.9 | 181 | # Python >= 2.7.9 |
| 182 | context = ssl.SSLContext(ssl_version) | 182 | context = ssl.SSLContext(ssl_version) |
| 183 | context.verify_mode = ssl.CERT_REQUIRED | 183 | context.verify_mode = ssl.CERT_NONE |
| 184 | if args.no_cert_validate: | 184 | if args.cert: |
| 185 | context.verify_mode = ssl.CERT_NONE | 185 | context.verify_mode = ssl.CERT_REQUIRED |
| 186 | context.check_hostname = bool(not args.disable_hostname_check) | ||
| 187 | if args.cert and not args.no_cert_validate: | ||
| 188 | context.load_verify_locations(os.path.expanduser(args.cert)) | 186 | context.load_verify_locations(os.path.expanduser(args.cert)) |
| 187 | context.check_hostname = bool(not args.disable_hostname_check) | ||
| 189 | if args.ciphers: | 188 | if args.ciphers: |
| 190 | context.set_ciphers(args.ciphers) | 189 | context.set_ciphers(args.ciphers) |
| 191 | transport = xmlrpclib.SafeTransport(context=context) | 190 | transport = xmlrpclib.SafeTransport(context=context) |
| @@ -193,9 +192,8 @@ def poll_notifications(scheduler, args): | |||
| 193 | # Python < 2.7.9 | 192 | # Python < 2.7.9 |
| 194 | ssl_options = {} | 193 | ssl_options = {} |
| 195 | ssl_options['ssl_version'] = ssl_version | 194 | ssl_options['ssl_version'] = ssl_version |
| 196 | if args.cert and not args.no_cert_validate: | 195 | if args.cert: |
| 197 | ssl_options['ca_certs'] = os.path.expanduser(args.cert) | 196 | ssl_options['ca_certs'] = os.path.expanduser(args.cert) |
| 198 | if not args.no_cert_validate: | ||
| 199 | ssl_options['cert_reqs'] = ssl.CERT_REQUIRED | 197 | ssl_options['cert_reqs'] = ssl.CERT_REQUIRED |
| 200 | if args.ciphers: | 198 | if args.ciphers: |
| 201 | ssl_options['ciphers'] = args.ciphers | 199 | ssl_options['ciphers'] = args.ciphers |
| @@ -301,12 +299,6 @@ def main(): | |||
| 301 | required=True, | 299 | required=True, |
| 302 | help='The name of the BEINC-resource on the remote server') | 300 | help='The name of the BEINC-resource on the remote server') |
| 303 | parser.add_argument( | 301 | parser.add_argument( |
| 304 | '--no-cert-validate', | ||
| 305 | action='store_true', | ||
| 306 | dest='no_cert_validate', | ||
| 307 | default=False, | ||
| 308 | help='Do not validate server certificate') | ||
| 309 | parser.add_argument( | ||
| 310 | '-o', '--osd-system', | 302 | '-o', '--osd-system', |
| 311 | metavar='SYSTEM', | 303 | metavar='SYSTEM', |
| 312 | type=str, | 304 | type=str, |
