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_generic_client.py | |
| parent | 9c06ebe90039423809f51af1d62098ae7f5c813e (diff) | |
Implement connection_setup for beinc_weechat.py
Diffstat (limited to 'beinc_generic_client.py')
| -rwxr-xr-x | beinc_generic_client.py | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/beinc_generic_client.py b/beinc_generic_client.py index 48d6a13..ae4762d 100755 --- a/beinc_generic_client.py +++ b/beinc_generic_client.py | |||
| @@ -109,12 +109,11 @@ def action_execute(args): | |||
| 109 | if sys.hexversion >= 0x20709f0: | 109 | if sys.hexversion >= 0x20709f0: |
| 110 | # Python >= 2.7.9 | 110 | # Python >= 2.7.9 |
| 111 | context = ssl.SSLContext(ssl_version) | 111 | context = ssl.SSLContext(ssl_version) |
| 112 | context.verify_mode = ssl.CERT_REQUIRED | 112 | context.verify_mode = ssl.CERT_NONE |
| 113 | if args.no_cert_validate: | 113 | if args.cert: |
| 114 | context.verify_mode = ssl.CERT_NONE | 114 | context.verify_mode = ssl.CERT_REQUIRED |
| 115 | context.check_hostname = bool(not args.disable_hostname_check) | ||
| 116 | if args.cert and not args.no_cert_validate: | ||
| 117 | context.load_verify_locations(os.path.expanduser(args.cert)) | 115 | context.load_verify_locations(os.path.expanduser(args.cert)) |
| 116 | context.check_hostname = bool(not args.disable_hostname_check) | ||
| 118 | if args.ciphers: | 117 | if args.ciphers: |
| 119 | context.set_ciphers(args.ciphers) | 118 | context.set_ciphers(args.ciphers) |
| 120 | transport = xmlrpclib.SafeTransport(context=context) | 119 | transport = xmlrpclib.SafeTransport(context=context) |
| @@ -122,9 +121,8 @@ def action_execute(args): | |||
| 122 | # Python < 2.7.9 | 121 | # Python < 2.7.9 |
| 123 | ssl_options = {} | 122 | ssl_options = {} |
| 124 | ssl_options['ssl_version'] = ssl_version | 123 | ssl_options['ssl_version'] = ssl_version |
| 125 | if args.cert and not args.no_cert_validate: | 124 | if args.cert: |
| 126 | ssl_options['ca_certs'] = os.path.expanduser(args.cert) | 125 | ssl_options['ca_certs'] = os.path.expanduser(args.cert) |
| 127 | if not args.no_cert_validate: | ||
| 128 | ssl_options['cert_reqs'] = ssl.CERT_REQUIRED | 126 | ssl_options['cert_reqs'] = ssl.CERT_REQUIRED |
| 129 | if args.ciphers: | 127 | if args.ciphers: |
| 130 | ssl_options['ciphers'] = args.ciphers | 128 | ssl_options['ciphers'] = args.ciphers |
| @@ -200,12 +198,6 @@ def main(): | |||
| 200 | required=True, | 198 | required=True, |
| 201 | help='The name of the BEINC-resource on the remote server') | 199 | help='The name of the BEINC-resource on the remote server') |
| 202 | parser.add_argument( | 200 | parser.add_argument( |
| 203 | '--no-cert-validate', | ||
| 204 | action='store_true', | ||
| 205 | dest='no_cert_validate', | ||
| 206 | default=False, | ||
| 207 | help='Do not validate server certificate') | ||
| 208 | parser.add_argument( | ||
| 209 | '-p', '--password', | 201 | '-p', '--password', |
| 210 | metavar='PASSWORD[FILE]', | 202 | metavar='PASSWORD[FILE]', |
| 211 | type=str, | 203 | type=str, |
