Skip to content

Commit c444ce7

Browse files
author
Tor Didriksen
committed
Bug #34688683 Allow using 32-bit MIT Kerberos for client plugin on windows
WL #15336 added support for using MIT Kerberos to build authentication_kerberos_client on Windows. The cmake code assumed 64bit libraries. Fix cmake code to look for 32bit libraries for 32bit builds. Also fix some build warnings, and a build break (redefined typedef) for typedef SSIZE_T ssize_t; Change-Id: I30d0b9c434202c3fb51ce8d1c9329abd737038e2
1 parent 78e982d commit c444ce7

File tree

4 files changed

+51
-1
lines changed

4 files changed

+51
-1
lines changed

cmake/kerberos.cmake

+34
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,23 @@ IF (WIN32)
179179
krbcc64.dll
180180
gssapi64.dll
181181
)
182+
# We still support 32bit build for -DWITHOUT_SERVER=ON
183+
IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
184+
SET(CUSTOM_KERBEROS_EXTRA_LIBRARIES
185+
k5sprt32.lib
186+
comerr32.lib
187+
xpprof32.lib
188+
krbcc32.lib
189+
gssapi32.lib
190+
)
191+
SET(CUSTOM_KERBEROS_EXTRA_DLLS
192+
k5sprt32.dll
193+
comerr32.dll
194+
xpprof32.dll
195+
krbcc32.dll
196+
gssapi32.dll
197+
)
198+
ENDIF()
182199
ELSE()
183200
SET(CUSTOM_KERBEROS_EXTRA_LIBRARIES
184201
com_err
@@ -234,6 +251,23 @@ MACRO(FIND_CUSTOM_KERBEROS)
234251
NO_CMAKE_ENVIRONMENT_PATH
235252
NO_SYSTEM_ENVIRONMENT_PATH
236253
)
254+
# We still support 32bit build for -DWITHOUT_SERVER=ON
255+
IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
256+
FIND_FILE(KERBEROS_CUSTOM_LIBRARY
257+
NAMES krb5_32.lib
258+
PATHS ${KERBEROS_ROOT_DIR}/lib
259+
NO_CMAKE_PATH
260+
NO_CMAKE_ENVIRONMENT_PATH
261+
NO_SYSTEM_ENVIRONMENT_PATH
262+
)
263+
FIND_FILE(KERBEROS_CUSTOM_DLL
264+
NAMES krb5_32.dll
265+
PATHS ${KERBEROS_ROOT_DIR}/bin
266+
NO_CMAKE_PATH
267+
NO_CMAKE_ENVIRONMENT_PATH
268+
NO_SYSTEM_ENVIRONMENT_PATH
269+
)
270+
ENDIF()
237271

238272
IF(KERBEROS_INCLUDE_DIR AND KERBEROS_CUSTOM_LIBRARY AND
239273
KERBEROS_CUSTOM_DLL AND CCAPISERVER_EXECUTABLE)

include/my_inttypes.h

+4
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,12 @@ typedef int myf; /* Type of MyFlags in my_funcs */
102102
#define MY_INT64_NUM_DECIMAL_DIGITS 21U
103103

104104
#if defined(_WIN32) && !defined(MYSQL_ABI_CHECK)
105+
#ifndef SSIZE_T_DEFINED
106+
/* krb5/win-mac.h has a conflicting typedef */
107+
#define SSIZE_T_DEFINED 1
105108
typedef SSIZE_T ssize_t;
106109
#endif
110+
#endif
107111

108112
/*
109113
This doesn't really belong here, but it was the only reasonable place

mysys/stacktrace.cc

+7-1
Original file line numberDiff line numberDiff line change
@@ -434,13 +434,19 @@ void my_print_stacktrace(const uchar * /* stack_bottom */,
434434
/*Prepare stackframe for the first StackWalk64 call*/
435435
frame.AddrFrame.Mode = frame.AddrPC.Mode = frame.AddrStack.Mode =
436436
AddrModeFlat;
437-
#if (defined _M_X64)
437+
#if (defined _M_IX86)
438+
machine = IMAGE_FILE_MACHINE_I386;
439+
frame.AddrFrame.Offset = context.Ebp;
440+
frame.AddrPC.Offset = context.Eip;
441+
frame.AddrStack.Offset = context.Esp;
442+
#elif (defined _M_X64)
438443
machine = IMAGE_FILE_MACHINE_AMD64;
439444
frame.AddrFrame.Offset = context.Rbp;
440445
frame.AddrPC.Offset = context.Rip;
441446
frame.AddrStack.Offset = context.Rsp;
442447
#else
443448
/*There is currently no need to support IA64*/
449+
/* Warning C4068: unknown pragma 'error' */
444450
#pragma error("unsupported architecture")
445451
#endif
446452

vio/viosocket.cc

+6
Original file line numberDiff line numberDiff line change
@@ -508,8 +508,14 @@ int vio_shutdown(Vio *vio) {
508508
#ifndef NDEBUG
509509

510510
#ifdef _WIN32
511+
#ifdef _WIN64
511512
#define SOCKET_PRINTF_FORMAT "%llu"
512513
#else
514+
#define SOCKET_PRINTF_FORMAT "%lu"
515+
#endif
516+
517+
#else // _WIN32
518+
513519
#define SOCKET_PRINTF_FORMAT "%d"
514520
#endif
515521

0 commit comments

Comments
 (0)