Skip to content

Commit bb193e6

Browse files
committed
WL#16053: Support GSSAPI/Kerberos authentication on Windows using authentication_ldap_sasl_client plug-in for C-extension
This work log adds SASL authentication support for the C-extension using the GSSAPI (Kerberos) authentication method on Windows via the authentication_ldap_sasl_client plugin. Change-Id: I7e9c6f4168558a39ba15f76df1566a6bb4397a98
1 parent e51e5ea commit bb193e6

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

CHANGES.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ Copyright (c) 2009, 2024, Oracle and/or its affiliates.
88
Full release notes:
99
http://dev.mysql.com/doc/relnotes/connector-python/en/
1010

11+
v8.4.0
12+
======
13+
14+
- WL#16053: Support GSSAPI/Kerberos authentication on Windows using authentication_ldap_sasl_client plug-in for C-extension
15+
1116
v8.3.0
1217
======
1318

mysql-connector-python/cpydist/__init__.py

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,10 @@
3333
import platform
3434
import shutil
3535
import sys
36-
import tempfile
3736

3837
from glob import glob
3938
from pathlib import Path
40-
from subprocess import PIPE, Popen, check_call
39+
from subprocess import PIPE, Popen
4140
from sysconfig import get_config_vars, get_python_version
4241

4342
from setuptools import Command
@@ -111,6 +110,18 @@
111110
LOGGER.addHandler(handler)
112111
LOGGER.setLevel(logging.WARNING)
113112

113+
SASL_WIN_LIBS = [
114+
"libsasl.dll",
115+
"k5sprt64.dll",
116+
"comerr64.dll",
117+
"xpprof64.dll",
118+
"krbcc64.dll",
119+
"gssapi64.dll",
120+
"krb5_64.dll",
121+
]
122+
123+
SASL_WIN_LIBS_AUTH_METHODS = ["saslSCRAM.dll", "saslGSSAPI.dll"]
124+
114125

115126
def get_otel_src_package_data():
116127
"""Get a list including all py.typed and dist-info files corresponding
@@ -390,9 +401,36 @@ def _copy_vendor_libraries(self):
390401
site_packages_files.append(
391402
os.path.join(self.with_mysql_capi, "lib", "libmysql.dll")
392403
)
404+
405+
# `SASL_WIN_LIBS` are loaded automatically as dependency of
406+
# authentication_ldap_sasl_client.dll. On Windows, they are expected to be
407+
# at `lib/site-packages` - next to `_mysql_connector`.
408+
sasl_dll_paths = [
409+
os.path.join(self.with_mysql_capi, "bin", dll) for dll in SASL_WIN_LIBS
410+
]
411+
site_packages_files.extend(
412+
[path for path in sasl_dll_paths if os.path.exists(path)]
413+
)
414+
393415
self.distribution.data_files = [
394416
("lib\\site-packages\\", site_packages_files)
395417
]
418+
419+
# Also, we need to include the DLLs corresponding to the
420+
# SASL authorization methods.
421+
sasl_dll_auth_method_paths = [
422+
os.path.join(self.with_mysql_capi, "bin", "sasl2", dll)
423+
for dll in SASL_WIN_LIBS_AUTH_METHODS
424+
if os.path.exists(
425+
os.path.join(self.with_mysql_capi, "bin", "sasl2", dll)
426+
)
427+
]
428+
429+
if sasl_dll_auth_method_paths:
430+
self.distribution.data_files.append(
431+
("lib\\site-packages\\sasl2", sasl_dll_auth_method_paths)
432+
)
433+
396434
self.log.debug("# site_packages_files: %s", self.distribution.data_files)
397435
elif bundle_plugin_libs:
398436
# Bundle SASL libs

0 commit comments

Comments
 (0)