Skip to content

Commit

Permalink
cqlshlib/sslhandling: fix logic of ssl_check_hostname
Browse files Browse the repository at this point in the history
the logic was broken, and could lead to `AttributeError`,
like the following:
```
E       AssertionError: Traceback (most recent call last):
E           File "/jenkins/workspace/scylla-master/gating-dtest-release/scylla/.ccm/scylla-repository/18591/share/cassandra/libexec/cqlsh.py", line 2723, in <module>
E             main(*read_options(sys.argv[1:], os.environ))
E           File "/jenkins/workspace/scylla-master/gating-dtest-release/scylla/.ccm/scylla-repository/18591/share/cassandra/libexec/cqlsh.py", line 2664, in main
E             shell = Shell(hostname,
E                     ^^^^^^^^^^^^^^^
E           File "/jenkins/workspace/scylla-master/gating-dtest-release/scylla/.ccm/scylla-repository/18591/share/cassandra/libexec/cqlsh.py", line 495, in __init__
E             kwargs['ssl_context'] = sslhandling.ssl_settings(hostname, CONFIG_FILE) if ssl else None
E                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E           File "/jenkins/workspace/scylla-master/gating-dtest-release/scylla/.ccm/scylla-repository/18591/share/cassandra/libexec/../pylib/cqlshlib/sslhandling.py", line 64, in ssl_settings
E             ssl_check_hostname = ssl_check_hostname is not None or ssl_check_hostname.lower() != 'false'
E                                                                    ^^^^^^^^^^^^^^^^^^^^^^^^
E         AttributeError: 'NoneType' object has no attribute 'lower'
```
  • Loading branch information
fruch committed May 12, 2024
1 parent 28a95c0 commit c815855
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pylib/cqlshlib/sslhandling.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def get_best_tls_protocol(ssl_ver_str):
ssl_check_hostname = env.get('SSL_CHECK_HOSTNAME')
if ssl_check_hostname is None:
ssl_check_hostname = get_option('ssl', 'check_hostname')
ssl_check_hostname = ssl_check_hostname is not None or ssl_check_hostname.lower() != 'false'
ssl_check_hostname = ssl_check_hostname is not None and ssl_check_hostname.lower() != 'false'

if ssl_check_hostname and not ssl_validate:
sys.exit("SSL certificate hostname checking "
Expand Down

0 comments on commit c815855

Please sign in to comment.