mysqlx-connector-python 8.3.0__tar.gz → 8.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. mysqlx-connector-python-8.4.0/INFO_BIN +2 -0
  2. mysqlx-connector-python-8.4.0/INFO_SRC +4 -0
  3. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/LICENSE.txt +49 -13
  4. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/README.rst +16 -2
  5. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/README.txt +5 -1
  6. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/__init__.py +5 -5
  7. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/authentication.py +5 -5
  8. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/charsets.py +5 -5
  9. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/connection.py +37 -27
  10. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/constants.py +10 -67
  11. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/crud.py +5 -5
  12. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/dbdoc.py +5 -5
  13. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/errorcode.py +5 -5
  14. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/errors.py +5 -5
  15. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/expr.py +8 -8
  16. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/helpers.py +8 -8
  17. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/locales/__init__.py +5 -5
  18. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/locales/eng/__init__.py +5 -5
  19. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/locales/eng/client_error.py +5 -5
  20. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/logger.py +5 -5
  21. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/protobuf/__init__.py +5 -5
  22. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/protobuf/mysqlx_connection_pb2.py +5 -5
  23. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/protobuf/mysqlx_crud_pb2.py +5 -5
  24. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/protobuf/mysqlx_cursor_pb2.py +5 -5
  25. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/protobuf/mysqlx_datatypes_pb2.py +5 -5
  26. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/protobuf/mysqlx_expect_pb2.py +5 -5
  27. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/protobuf/mysqlx_expr_pb2.py +5 -5
  28. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/protobuf/mysqlx_notice_pb2.py +5 -5
  29. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/protobuf/mysqlx_pb2.py +5 -5
  30. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/protobuf/mysqlx_prepare_pb2.py +5 -5
  31. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/protobuf/mysqlx_resultset_pb2.py +5 -5
  32. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/protobuf/mysqlx_session_pb2.py +5 -5
  33. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/protobuf/mysqlx_sql_pb2.py +5 -5
  34. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/protocol.py +5 -5
  35. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/result.py +5 -5
  36. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/statement.py +5 -5
  37. mysqlx-connector-python-8.4.0/mysqlx/tls_ciphers.py +168 -0
  38. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/types.py +28 -0
  39. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/utils.py +47 -5
  40. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/version.py +6 -6
  41. {mysqlx-connector-python-8.3.0/mysqlx_connector_python-8.3.0-py3.8.egg-info → mysqlx-connector-python-8.4.0/mysqlx_connector_python-8.4.0-py3.8.egg-info}/PKG-INFO +1 -1
  42. {mysqlx-connector-python-8.3.0/mysqlx_connector_python-8.3.0-py3.8.egg-info → mysqlx-connector-python-8.4.0/mysqlx_connector_python-8.4.0-py3.8.egg-info}/SOURCES.txt +2 -0
  43. mysqlx-connector-python-8.3.0/INFO_BIN +0 -2
  44. mysqlx-connector-python-8.3.0/INFO_SRC +0 -4
  45. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/CONTRIBUTING.rst +0 -0
  46. {mysqlx-connector-python-8.3.0 → mysqlx-connector-python-8.4.0}/mysqlx/py.typed +0 -0
  47. {mysqlx-connector-python-8.3.0/mysqlx_connector_python-8.3.0-py3.8.egg-info → mysqlx-connector-python-8.4.0/mysqlx_connector_python-8.4.0-py3.8.egg-info}/dependency_links.txt +0 -0
  48. {mysqlx-connector-python-8.3.0/mysqlx_connector_python-8.3.0-py3.8.egg-info → mysqlx-connector-python-8.4.0/mysqlx_connector_python-8.4.0-py3.8.egg-info}/requires.txt +0 -0
  49. {mysqlx-connector-python-8.3.0/mysqlx_connector_python-8.3.0-py3.8.egg-info → mysqlx-connector-python-8.4.0/mysqlx_connector_python-8.4.0-py3.8.egg-info}/top_level.txt +0 -0
@@ -0,0 +1,2 @@
1
+ build-date: 2024-03-15 06:21:01
2
+ os-info: Linux-5.15.0-1052-oracle-x86_64-with-glibc2.35
@@ -0,0 +1,4 @@
1
+ version: 8.4.0
2
+ branch: release/8.4.0
3
+ commit: dc71cebe53615110ff00dbb8b629f5457ece1ddb
4
+ short: dc71ceb
@@ -1,6 +1,6 @@
1
1
  Licensing Information User Manual
2
2
 
3
- MySQL Connector/Python 8.3.0 Community
3
+ MySQL Connector/Python 8.4.0 Community
4
4
  __________________________________________________________________
5
5
 
6
6
  Introduction
@@ -8,25 +8,25 @@ Introduction
8
8
  This License Information User Manual contains Oracle's product license
9
9
  and other licensing information, including licensing information for
10
10
  third-party software which may be included in this distribution of
11
- MySQL Connector/Python 8.3.0 Community.
11
+ MySQL Connector/Python 8.4.0 Community.
12
12
 
13
- Last updated: November 2023
13
+ Last updated: March 2024
14
14
 
15
15
  Licensing Information
16
16
 
17
- This release of MySQL Connector/Python 8.3.0 Community is brought to
17
+ This release of MySQL Connector/Python 8.4.0 Community is brought to
18
18
  you by the MySQL team at Oracle. This software is released under
19
19
  version 2 of the GNU General Public License (GPLv2), as set forth
20
20
  below, with the following additional permissions:
21
21
 
22
- This distribution of MySQL Connector/Python 8.3.0 Community is
23
- distributed with certain software (including but not limited to
24
- OpenSSL) that is licensed under separate terms, as designated in a
25
- particular file or component or in the license documentation. Without
26
- limiting your rights under the GPLv2, the authors of MySQL hereby grant
27
- you an additional permission to link the program and your derivative
28
- works with the separately licensed software that they have included
29
- with the program.
22
+ This distribution of MySQL Connector/Python 8.4.0 Community is designed
23
+ to work with certain software (including but not limited to OpenSSL)
24
+ that is licensed under separate terms, as designated in a particular
25
+ file or component or in the license documentation. Without limiting
26
+ your rights under the GPLv2, the authors of MySQL hereby grant you an
27
+ additional permission to link the program and your derivative works
28
+ with the separately licensed software that they have either included
29
+ with the program or referenced in the documentation.
30
30
 
31
31
  Without limiting the foregoing grant of rights under the GPLv2 and
32
32
  additional permission as to separately licensed software, this
@@ -34,7 +34,7 @@ Licensing Information
34
34
  a copy of which is reproduced below and can also be found along with
35
35
  its FAQ at http://oss.oracle.com/licenses/universal-foss-exception.
36
36
 
37
- Copyright (c) 2012, 2023, Oracle and/or its affiliates.
37
+ Copyright (c) 2012, 2024, Oracle and/or its affiliates.
38
38
 
39
39
  Election of GPLv2
40
40
 
@@ -642,6 +642,35 @@ of the input file used when generating it. This code is not
642
642
  standalone and requires a support library to be linked with it. This
643
643
  support library is itself covered by the above license.
644
644
 
645
+ 4th party - abseil-cpp
646
+ ----------------------
647
+
648
+ === Header in source files:
649
+ // Copyright 2017 The Abseil Authors.
650
+ //
651
+ // Licensed under the Apache License, Version 2.0 (the "License");
652
+ // you may not use this file except in compliance with the License.
653
+ // You may obtain a copy of the License at
654
+ //
655
+ // https://www.apache.org/licenses/LICENSE-2.0
656
+ //
657
+ // Unless required by applicable law or agreed to in writing, software
658
+ // distributed under the License is distributed on an "AS IS" BASIS,
659
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
660
+ // See the License for the specific language governing permissions and
661
+ // limitations under the License.
662
+ //
663
+ // This header file contains C++11 versions of standard <utility> header
664
+ // abstractions available within C++14 and C++17, and are designed to be
665
+ // drop-in replacement for code compliant with C++14 and C++17.
666
+
667
+ Apache License
668
+ Version 2.0, January 2004
669
+ https://www.apache.org/licenses/
670
+
671
+ A copy of the Apache License v2.0, January 2004 license can be found
672
+ in the 'Standard Licenses' section.
673
+
645
674
  ======================================================================
646
675
  ======================================================================
647
676
 
@@ -2114,6 +2143,13 @@ See Apache License v2.0, January 2004 in the
2114
2143
 
2115
2144
  OpenTelemetry C++
2116
2145
 
2146
+ You may be receiving a copy of the opentelemetry-cpp library with
2147
+ this MySQL product. The terms of the Oracle license do NOT apply
2148
+ to the opentelemetry-cpp library; it is licensed under the following
2149
+ license, separately from the Oracle programs you receive.
2150
+ If you do not wish to install this program, you may delete its files
2151
+ but the Oracle program might not operate properly or at all without it.
2152
+
2117
2153
  // Copyright The OpenTelemetry Authors
2118
2154
  // SPDX-License-Identifier: Apache-2.0
2119
2155
 
@@ -12,16 +12,30 @@ MySQL Connector/Python enables Python programs to access MySQL databases, using
12
12
 
13
13
  Installation
14
14
  ------------
15
-
16
15
  The recommended way to install Connector/Python is via `pip <https://pip.pypa.io/>`_.
17
16
 
18
17
  Make sure you have a recent `pip <https://pip.pypa.io/>`_ version installed on your system. If your system already has ``pip`` installed, you might need to update it. Or you can use the `standalone pip installer <https://pip.pypa.io/en/latest/installing/#installing-with-get-pip-py>`_.
19
18
 
19
+ +++++++
20
+ Classic
21
+ +++++++
22
+
20
23
  .. code-block:: bash
21
24
 
22
25
  shell> pip install mysql-connector-python
23
26
 
24
- Please refer to the `installation tutorial <https://dev.mysql.com/doc/dev/connector-python/8.0/installation.html>`_ for installation alternatives.
27
+
28
+ +++++++
29
+ XDevAPI
30
+ +++++++
31
+
32
+ .. code-block:: bash
33
+
34
+ shell> pip install mysqlx-connector-python
35
+
36
+
37
+ Please refer to the `installation tutorial <https://dev.mysql.com/doc/dev/connector-python/8.0/installation.html>`_ for installation alternatives of the X DevAPI.
38
+
25
39
 
26
40
  Getting Started
27
41
  ---------------
@@ -2,12 +2,16 @@ Copyright (c) 2009, 2024, Oracle and/or its affiliates.
2
2
 
3
3
  This is a release of MySQL Connector/Python, Oracle's Python driver for MySQL.
4
4
 
5
+ MySQL Connector/Python enables Python programs to access MySQL databases,
6
+ using an API that is compliant with the Python Database API Specification
7
+ v2.0 (PEP 249). It also contains an implementation of the XDevAPI.
8
+
5
9
  License information can be found in the LICENSE.txt file.
6
10
 
7
11
  This distribution may include materials developed by third parties. For license
8
12
  and attribution notices for these materials, please refer to the LICENSE.txt file.
9
13
 
10
- For more information on MySQL Connector/Python, visit
14
+ For more information on MySQL Connector/Python XDevAPI, visit
11
15
  https://dev.mysql.com/doc/dev/connector-python/
12
16
 
13
17
  For additional downloads and the source of MySQL Connector/Python, visit
@@ -1,16 +1,16 @@
1
- # Copyright (c) 2016, 2023, Oracle and/or its affiliates.
1
+ # Copyright (c) 2016, 2024, Oracle and/or its affiliates.
2
2
  #
3
3
  # This program is free software; you can redistribute it and/or modify
4
4
  # it under the terms of the GNU General Public License, version 2.0, as
5
5
  # published by the Free Software Foundation.
6
6
  #
7
- # This program is also distributed with certain software (including
7
+ # This program is designed to work with certain software (including
8
8
  # but not limited to OpenSSL) that is licensed under separate terms,
9
9
  # as designated in a particular file or component or in included license
10
- # documentation. The authors of MySQL hereby grant you an
10
+ # documentation. The authors of MySQL hereby grant you an
11
11
  # additional permission to link the program and your derivative works
12
- # with the separately licensed software that they have included with
13
- # MySQL.
12
+ # with the separately licensed software that they have either included with
13
+ # the program or referenced in the documentation.
14
14
  #
15
15
  # Without limiting anything contained in the foregoing, this file,
16
16
  # which is part of MySQL Connector/Python, is also subject to the
@@ -1,16 +1,16 @@
1
- # Copyright (c) 2016, 2023, Oracle and/or its affiliates.
1
+ # Copyright (c) 2016, 2024, Oracle and/or its affiliates.
2
2
  #
3
3
  # This program is free software; you can redistribute it and/or modify
4
4
  # it under the terms of the GNU General Public License, version 2.0, as
5
5
  # published by the Free Software Foundation.
6
6
  #
7
- # This program is also distributed with certain software (including
7
+ # This program is designed to work with certain software (including
8
8
  # but not limited to OpenSSL) that is licensed under separate terms,
9
9
  # as designated in a particular file or component or in included license
10
- # documentation. The authors of MySQL hereby grant you an
10
+ # documentation. The authors of MySQL hereby grant you an
11
11
  # additional permission to link the program and your derivative works
12
- # with the separately licensed software that they have included with
13
- # MySQL.
12
+ # with the separately licensed software that they have either included with
13
+ # the program or referenced in the documentation.
14
14
  #
15
15
  # Without limiting anything contained in the foregoing, this file,
16
16
  # which is part of MySQL Connector/Python, is also subject to the
@@ -1,18 +1,18 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
- # Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
3
+ # Copyright (c) 2013, 2024, Oracle and/or its affiliates.
4
4
  #
5
5
  # This program is free software; you can redistribute it and/or modify
6
6
  # it under the terms of the GNU General Public License, version 2.0, as
7
7
  # published by the Free Software Foundation.
8
8
  #
9
- # This program is also distributed with certain software (including
9
+ # This program is designed to work with certain software (including
10
10
  # but not limited to OpenSSL) that is licensed under separate terms,
11
11
  # as designated in a particular file or component or in included license
12
- # documentation. The authors of MySQL hereby grant you an
12
+ # documentation. The authors of MySQL hereby grant you an
13
13
  # additional permission to link the program and your derivative works
14
- # with the separately licensed software that they have included with
15
- # MySQL.
14
+ # with the separately licensed software that they have either included with
15
+ # the program or referenced in the documentation.
16
16
  #
17
17
  # Without limiting anything contained in the foregoing, this file,
18
18
  # which is part of MySQL Connector/Python, is also subject to the
@@ -1,16 +1,16 @@
1
- # Copyright (c) 2016, 2023, Oracle and/or its affiliates.
1
+ # Copyright (c) 2016, 2024, Oracle and/or its affiliates.
2
2
  #
3
3
  # This program is free software; you can redistribute it and/or modify
4
4
  # it under the terms of the GNU General Public License, version 2.0, as
5
5
  # published by the Free Software Foundation.
6
6
  #
7
- # This program is also distributed with certain software (including
7
+ # This program is designed to work with certain software (including
8
8
  # but not limited to OpenSSL) that is licensed under separate terms,
9
9
  # as designated in a particular file or component or in included license
10
- # documentation. The authors of MySQL hereby grant you an
10
+ # documentation. The authors of MySQL hereby grant you an
11
11
  # additional permission to link the program and your derivative works
12
- # with the separately licensed software that they have included with
13
- # MySQL.
12
+ # with the separately licensed software that they have either included with
13
+ # the program or referenced in the documentation.
14
14
  #
15
15
  # Without limiting anything contained in the foregoing, this file,
16
16
  # which is part of MySQL Connector/Python, is also subject to the
@@ -39,8 +39,6 @@ try:
39
39
 
40
40
  SSL_AVAILABLE = True
41
41
  TLS_VERSIONS = {
42
- "TLSv1": ssl.PROTOCOL_TLSv1,
43
- "TLSv1.1": ssl.PROTOCOL_TLSv1_1,
44
42
  "TLSv1.2": ssl.PROTOCOL_TLSv1_2,
45
43
  }
46
44
  # TLSv1.3 included in PROTOCOL_TLS, but PROTOCOL_TLS is not included on 3.4
@@ -65,7 +63,6 @@ import socket
65
63
  import sys
66
64
  import threading
67
65
  import uuid
68
- import warnings
69
66
 
70
67
  from typing import Any, Callable, Dict, List, Mapping, Optional, Tuple, Type, Union
71
68
 
@@ -85,7 +82,6 @@ from urllib.parse import parse_qsl, unquote, urlparse
85
82
  from .authentication import MySQL41AuthPlugin, PlainAuthPlugin, Sha256MemoryAuthPlugin
86
83
  from .constants import (
87
84
  COMPRESSION_ALGORITHMS,
88
- DEPRECATED_TLS_VERSIONS,
89
85
  OPENSSL_CS_NAMES,
90
86
  SUPPORTED_TLS_VERSIONS,
91
87
  TLS_CIPHER_SUITES,
@@ -126,7 +122,12 @@ from .types import ColumnType, MessageType, ResultBaseType, StatementType
126
122
 
127
123
  sys.path.append("..")
128
124
 
129
- from .utils import linux_distribution
125
+ from .tls_ciphers import UNACCEPTABLE_TLS_CIPHERSUITES, UNACCEPTABLE_TLS_VERSIONS
126
+ from .utils import (
127
+ linux_distribution,
128
+ warn_ciphersuites_deprecated,
129
+ warn_tls_version_deprecated,
130
+ )
130
131
  from .version import LICENSE, VERSION
131
132
 
132
133
  DUPLICATED_IN_LIST_ERROR = (
@@ -139,7 +140,7 @@ TLS_VERSION_ERROR = (
139
140
  "TLS protocol version (should be one of {})."
140
141
  )
141
142
 
142
- TLS_VERSION_DEPRECATED_ERROR = (
143
+ TLS_VERSION_UNACCEPTABLE_ERROR = (
143
144
  "The given tls_version: '{}' are no longer allowed (should be one of {})."
144
145
  )
145
146
 
@@ -438,15 +439,11 @@ class SocketStream:
438
439
 
439
440
  self._is_ssl = True
440
441
 
441
- # Raise a deprecation warning if TLSv1 or TLSv1.1 is being used
442
- tls_version = self._socket.version()
443
- if tls_version in ("TLSv1", "TLSv1.1"):
444
- warn_msg = (
445
- f"This connection is using {tls_version} which is now "
446
- "deprecated and will be removed in a future release of "
447
- "MySQL Connector/Python"
448
- )
449
- warnings.warn(warn_msg, DeprecationWarning)
442
+ # Raise a deprecation warning if a deprecated TLS cipher or
443
+ # version is being used.
444
+ cipher, tls_version, _ = self._socket.cipher()
445
+ warn_tls_version_deprecated(tls_version)
446
+ warn_ciphersuites_deprecated(cipher, tls_version)
450
447
 
451
448
  def is_ssl(self) -> bool:
452
449
  """Verifies if SSL is being used.
@@ -1544,6 +1541,7 @@ class ConnectionPool(queue.Queue):
1544
1541
  """
1545
1542
 
1546
1543
  def __init__(self, name: str, **kwargs: Any) -> None:
1544
+ self.name: Optional[str] = None
1547
1545
  self._set_pool_name(name)
1548
1546
  self._open_sessions: int = 0
1549
1547
  self._connections_openned: List[PooledConnection] = []
@@ -3093,13 +3091,13 @@ def _validate_tls_versions(settings: Dict[str, Any]) -> None:
3093
3091
  )
3094
3092
 
3095
3093
  use_tls_versions = []
3096
- deprecated_tls_versions = []
3094
+ unacceptable_tls_versions = []
3097
3095
  not_tls_versions = []
3098
3096
  for tls_ver in tls_versions:
3099
3097
  if tls_ver in SUPPORTED_TLS_VERSIONS:
3100
3098
  use_tls_versions.append(tls_ver)
3101
- if tls_ver in DEPRECATED_TLS_VERSIONS:
3102
- deprecated_tls_versions.append(tls_ver)
3099
+ if tls_ver in UNACCEPTABLE_TLS_VERSIONS:
3100
+ unacceptable_tls_versions.append(tls_ver)
3103
3101
  else:
3104
3102
  not_tls_versions.append(tls_ver)
3105
3103
 
@@ -3108,12 +3106,11 @@ def _validate_tls_versions(settings: Dict[str, Any]) -> None:
3108
3106
  raise NotSupportedError(
3109
3107
  TLS_VER_NO_SUPPORTED.format(tls_versions, SUPPORTED_TLS_VERSIONS)
3110
3108
  )
3111
- use_tls_versions.sort()
3112
3109
  settings["tls-versions"] = use_tls_versions
3113
- elif deprecated_tls_versions:
3110
+ elif unacceptable_tls_versions:
3114
3111
  raise NotSupportedError(
3115
- TLS_VERSION_DEPRECATED_ERROR.format(
3116
- deprecated_tls_versions, SUPPORTED_TLS_VERSIONS
3112
+ TLS_VERSION_UNACCEPTABLE_ERROR.format(
3113
+ unacceptable_tls_versions, SUPPORTED_TLS_VERSIONS
3117
3114
  )
3118
3115
  )
3119
3116
  elif not_tls_versions:
@@ -3206,6 +3203,19 @@ def _validate_tls_ciphersuites(settings: Dict[str, Any]) -> None:
3206
3203
  "No valid cipher suite found in the 'tls-ciphersuites' list"
3207
3204
  )
3208
3205
 
3206
+ # raise an error when using an unacceptable cipher
3207
+ for cipher_as_ossl in translated_names:
3208
+ for tls_ver in SUPPORTED_TLS_VERSIONS[
3209
+ : SUPPORTED_TLS_VERSIONS.index(newer_tls_ver) + 1
3210
+ ]:
3211
+ if (
3212
+ cipher_as_ossl
3213
+ in UNACCEPTABLE_TLS_CIPHERSUITES.get(tls_ver, {}).values()
3214
+ ):
3215
+ raise NotSupportedError(
3216
+ f"Cipher {cipher_as_ossl} when used with {tls_ver} is unacceptable."
3217
+ )
3218
+
3209
3219
  settings["tls-ciphersuites"] = translated_names
3210
3220
 
3211
3221
 
@@ -1,16 +1,16 @@
1
- # Copyright (c) 2016, 2023, Oracle and/or its affiliates.
1
+ # Copyright (c) 2016, 2024, Oracle and/or its affiliates.
2
2
  #
3
3
  # This program is free software; you can redistribute it and/or modify
4
4
  # it under the terms of the GNU General Public License, version 2.0, as
5
5
  # published by the Free Software Foundation.
6
6
  #
7
- # This program is also distributed with certain software (including
7
+ # This program is designed to work with certain software (including
8
8
  # but not limited to OpenSSL) that is licensed under separate terms,
9
9
  # as designated in a particular file or component or in included license
10
- # documentation. The authors of MySQL hereby grant you an
10
+ # documentation. The authors of MySQL hereby grant you an
11
11
  # additional permission to link the program and your derivative works
12
- # with the separately licensed software that they have included with
13
- # MySQL.
12
+ # with the separately licensed software that they have either included with
13
+ # the program or referenced in the documentation.
14
14
  #
15
15
  # Without limiting anything contained in the foregoing, this file,
16
16
  # which is part of MySQL Connector/Python, is also subject to the
@@ -30,6 +30,8 @@
30
30
 
31
31
  from enum import Enum
32
32
 
33
+ from . import tls_ciphers
34
+
33
35
 
34
36
  class Auth(Enum):
35
37
  """Enum to identify the authentication mechanisms."""
@@ -74,66 +76,11 @@ COMPRESSION_ALGORITHMS = {
74
76
  "zstd_stream": "zstd_stream",
75
77
  }
76
78
 
77
- TLS_VERSIONS = ["TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3"]
78
- SUPPORTED_TLS_VERSIONS = ["TLSv1.2", "TLSv1.3"]
79
- DEPRECATED_TLS_VERSIONS = ["TLSv1", "TLSv1.1"]
80
79
 
81
- # TLS v1.0 cipher suites IANI to OpenSSL name translation
82
- TLSV1_CIPHER_SUITES = {
83
- "TLS_RSA_WITH_NULL_MD5": "NULL-MD5",
84
- "TLS_RSA_WITH_NULL_SHA": "NULL-SHA",
85
- "TLS_RSA_WITH_RC4_128_MD5": "RC4-MD5",
86
- "TLS_RSA_WITH_RC4_128_SHA": "RC4-SHA",
87
- "TLS_RSA_WITH_IDEA_CBC_SHA": "IDEA-CBC-SHA",
88
- "TLS_RSA_WITH_3DES_EDE_CBC_SHA": "DES-CBC3-SHA",
89
- "TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA": "Not implemented.",
90
- "TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA": "Not implemented.",
91
- "TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA": "DHE-DSS-DES-CBC3-SHA",
92
- "TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA": "DHE-RSA-DES-CBC3-SHA",
93
- "TLS_DH_anon_WITH_RC4_128_MD5": "ADH-RC4-MD5",
94
- "TLS_DH_anon_WITH_3DES_EDE_CBC_SHA": "ADH-DES-CBC3-SHA",
95
- # AES cipher suites from RFC3268, extending TLS v1.0
96
- "TLS_RSA_WITH_AES_128_CBC_SHA": "AES128-SHA",
97
- "TLS_RSA_WITH_AES_256_CBC_SHA": "AES256-SHA",
98
- "TLS_DH_DSS_WITH_AES_128_CBC_SHA": "DH-DSS-AES128-SHA",
99
- "TLS_DH_DSS_WITH_AES_256_CBC_SHA": "DH-DSS-AES256-SHA",
100
- "TLS_DH_RSA_WITH_AES_128_CBC_SHA": "DH-RSA-AES128-SHA",
101
- "TLS_DH_RSA_WITH_AES_256_CBC_SHA": "DH-RSA-AES256-SHA",
102
- "TLS_DHE_DSS_WITH_AES_128_CBC_SHA": "DHE-DSS-AES128-SHA",
103
- "TLS_DHE_DSS_WITH_AES_256_CBC_SHA": "DHE-DSS-AES256-SHA",
104
- "TLS_DHE_RSA_WITH_AES_128_CBC_SHA": "DHE-RSA-AES128-SHA",
105
- "TLS_DHE_RSA_WITH_AES_256_CBC_SHA": "DHE-RSA-AES256-SHA",
106
- "TLS_DH_anon_WITH_AES_128_CBC_SHA": "ADH-AES128-SHA",
107
- "TLS_DH_anon_WITH_AES_256_CBC_SHA": "ADH-AES256-SHA",
108
- # Camellia cipher suites from RFC4132, extending TLS v1.0
109
- "TLS_RSA_WITH_CAMELLIA_128_CBC_SHA": "CAMELLIA128-SHA",
110
- "TLS_RSA_WITH_CAMELLIA_256_CBC_SHA": "CAMELLIA256-SHA",
111
- "TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA": "DH-DSS-CAMELLIA128-SHA",
112
- "TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA": "DH-DSS-CAMELLIA256-SHA",
113
- "TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA": "DH-RSA-CAMELLIA128-SHA",
114
- "TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA": "DH-RSA-CAMELLIA256-SHA",
115
- "TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA": "DHE-DSS-CAMELLIA128-SHA",
116
- "TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA": "DHE-DSS-CAMELLIA256-SHA",
117
- "TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA": "DHE-RSA-CAMELLIA128-SHA",
118
- "TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA": "DHE-RSA-CAMELLIA256-SHA",
119
- "TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA": "ADH-CAMELLIA128-SHA",
120
- "TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA": "ADH-CAMELLIA256-SHA",
121
- # SEED cipher suites from RFC4162, extending TLS v1.0
122
- "TLS_RSA_WITH_SEED_CBC_SHA": "SEED-SHA",
123
- "TLS_DH_DSS_WITH_SEED_CBC_SHA": "DH-DSS-SEED-SHA",
124
- "TLS_DH_RSA_WITH_SEED_CBC_SHA": "DH-RSA-SEED-SHA",
125
- "TLS_DHE_DSS_WITH_SEED_CBC_SHA": "DHE-DSS-SEED-SHA",
126
- "TLS_DHE_RSA_WITH_SEED_CBC_SHA": "DHE-RSA-SEED-SHA",
127
- "TLS_DH_anon_WITH_SEED_CBC_SHA": "ADH-SEED-SHA",
128
- # GOST cipher suites from draft-chudov-cryptopro-cptls, extending TLS v1.0
129
- "TLS_GOSTR341094_WITH_28147_CNT_IMIT": "GOST94-GOST89-GOST89",
130
- "TLS_GOSTR341001_WITH_28147_CNT_IMIT": "GOST2001-GOST89-GOST89",
131
- "TLS_GOSTR341094_WITH_NULL_GOSTR3411": "GOST94-NULL-GOST94",
132
- "TLS_GOSTR341001_WITH_NULL_GOSTR3411": "GOST2001-NULL-GOST94",
133
- }
80
+ SUPPORTED_TLS_VERSIONS = (
81
+ tls_ciphers.APPROVED_TLS_VERSIONS + tls_ciphers.DEPRECATED_TLS_VERSIONS
82
+ )
134
83
 
135
- # TLS v1.1 cipher suites IANI to OpenSSL name translation
136
- TLSV1_1_CIPHER_SUITES = TLSV1_CIPHER_SUITES
137
84
 
138
85
  # TLS v1.2 cipher suites IANI to OpenSSL name translation
139
86
  TLSV1_2_CIPHER_SUITES = {
@@ -283,15 +230,11 @@ TLSV1_3_CIPHER_SUITES = {
283
230
  }
284
231
 
285
232
  TLS_CIPHER_SUITES = {
286
- "TLSv1": TLSV1_CIPHER_SUITES,
287
- "TLSv1.1": TLSV1_1_CIPHER_SUITES,
288
233
  "TLSv1.2": TLSV1_2_CIPHER_SUITES,
289
234
  "TLSv1.3": TLSV1_3_CIPHER_SUITES,
290
235
  }
291
236
 
292
237
  OPENSSL_CS_NAMES = {
293
- "TLSv1": TLSV1_CIPHER_SUITES.values(),
294
- "TLSv1.1": TLSV1_1_CIPHER_SUITES.values(),
295
238
  "TLSv1.2": TLSV1_2_CIPHER_SUITES.values(),
296
239
  "TLSv1.3": TLSV1_3_CIPHER_SUITES.values(),
297
240
  }
@@ -1,16 +1,16 @@
1
- # Copyright (c) 2016, 2023, Oracle and/or its affiliates.
1
+ # Copyright (c) 2016, 2024, Oracle and/or its affiliates.
2
2
  #
3
3
  # This program is free software; you can redistribute it and/or modify
4
4
  # it under the terms of the GNU General Public License, version 2.0, as
5
5
  # published by the Free Software Foundation.
6
6
  #
7
- # This program is also distributed with certain software (including
7
+ # This program is designed to work with certain software (including
8
8
  # but not limited to OpenSSL) that is licensed under separate terms,
9
9
  # as designated in a particular file or component or in included license
10
- # documentation. The authors of MySQL hereby grant you an
10
+ # documentation. The authors of MySQL hereby grant you an
11
11
  # additional permission to link the program and your derivative works
12
- # with the separately licensed software that they have included with
13
- # MySQL.
12
+ # with the separately licensed software that they have either included with
13
+ # the program or referenced in the documentation.
14
14
  #
15
15
  # Without limiting anything contained in the foregoing, this file,
16
16
  # which is part of MySQL Connector/Python, is also subject to the
@@ -1,16 +1,16 @@
1
- # Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
1
+ # Copyright (c) 2016, 2024, Oracle and/or its affiliates.
2
2
  #
3
3
  # This program is free software; you can redistribute it and/or modify
4
4
  # it under the terms of the GNU General Public License, version 2.0, as
5
5
  # published by the Free Software Foundation.
6
6
  #
7
- # This program is also distributed with certain software (including
7
+ # This program is designed to work with certain software (including
8
8
  # but not limited to OpenSSL) that is licensed under separate terms,
9
9
  # as designated in a particular file or component or in included license
10
- # documentation. The authors of MySQL hereby grant you an
10
+ # documentation. The authors of MySQL hereby grant you an
11
11
  # additional permission to link the program and your derivative works
12
- # with the separately licensed software that they have included with
13
- # MySQL.
12
+ # with the separately licensed software that they have either included with
13
+ # the program or referenced in the documentation.
14
14
  #
15
15
  # Without limiting anything contained in the foregoing, this file,
16
16
  # which is part of MySQL Connector/Python, is also subject to the
@@ -1,18 +1,18 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
- # Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
3
+ # Copyright (c) 2013, 2024, Oracle and/or its affiliates.
4
4
  #
5
5
  # This program is free software; you can redistribute it and/or modify
6
6
  # it under the terms of the GNU General Public License, version 2.0, as
7
7
  # published by the Free Software Foundation.
8
8
  #
9
- # This program is also distributed with certain software (including
9
+ # This program is designed to work with certain software (including
10
10
  # but not limited to OpenSSL) that is licensed under separate terms,
11
11
  # as designated in a particular file or component or in included license
12
- # documentation. The authors of MySQL hereby grant you an
12
+ # documentation. The authors of MySQL hereby grant you an
13
13
  # additional permission to link the program and your derivative works
14
- # with the separately licensed software that they have included with
15
- # MySQL.
14
+ # with the separately licensed software that they have either included with
15
+ # the program or referenced in the documentation.
16
16
  #
17
17
  # Without limiting anything contained in the foregoing, this file,
18
18
  # which is part of MySQL Connector/Python, is also subject to the
@@ -1,16 +1,16 @@
1
- # Copyright (c) 2016, 2023, Oracle and/or its affiliates.
1
+ # Copyright (c) 2016, 2024, Oracle and/or its affiliates.
2
2
  #
3
3
  # This program is free software; you can redistribute it and/or modify
4
4
  # it under the terms of the GNU General Public License, version 2.0, as
5
5
  # published by the Free Software Foundation.
6
6
  #
7
- # This program is also distributed with certain software (including
7
+ # This program is designed to work with certain software (including
8
8
  # but not limited to OpenSSL) that is licensed under separate terms,
9
9
  # as designated in a particular file or component or in included license
10
- # documentation. The authors of MySQL hereby grant you an
10
+ # documentation. The authors of MySQL hereby grant you an
11
11
  # additional permission to link the program and your derivative works
12
- # with the separately licensed software that they have included with
13
- # MySQL.
12
+ # with the separately licensed software that they have either included with
13
+ # the program or referenced in the documentation.
14
14
  #
15
15
  # Without limiting anything contained in the foregoing, this file,
16
16
  # which is part of MySQL Connector/Python, is also subject to the
@@ -1,16 +1,16 @@
1
- # Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
1
+ # Copyright (c) 2016, 2024, Oracle and/or its affiliates.
2
2
  #
3
3
  # This program is free software; you can redistribute it and/or modify
4
4
  # it under the terms of the GNU General Public License, version 2.0, as
5
5
  # published by the Free Software Foundation.
6
6
  #
7
- # This program is also distributed with certain software (including
7
+ # This program is designed to work with certain software (including
8
8
  # but not limited to OpenSSL) that is licensed under separate terms,
9
9
  # as designated in a particular file or component or in included license
10
- # documentation. The authors of MySQL hereby grant you an
10
+ # documentation. The authors of MySQL hereby grant you an
11
11
  # additional permission to link the program and your derivative works
12
- # with the separately licensed software that they have included with
13
- # MySQL.
12
+ # with the separately licensed software that they have either included with
13
+ # the program or referenced in the documentation.
14
14
  #
15
15
  # Without limiting anything contained in the foregoing, this file,
16
16
  # which is part of MySQL Connector/Python, is also subject to the
@@ -973,9 +973,9 @@ class ExprParser:
973
973
  msg_expr["position"] = self.placeholder_name_to_position[place_holder_name]
974
974
  else:
975
975
  msg_expr["position"] = self.positional_placeholder_count
976
- self.placeholder_name_to_position[
977
- place_holder_name
978
- ] = self.positional_placeholder_count
976
+ self.placeholder_name_to_position[place_holder_name] = (
977
+ self.positional_placeholder_count
978
+ )
979
979
  self.positional_placeholder_count += 1
980
980
  return msg_expr
981
981