Skip to content

Commit

Permalink
Added optional support of SSL. Since at least at the moment, C/C does
Browse files Browse the repository at this point in the history
not link OpenSsl statically, we need to link against it in case of SSL support selected.
Added search of OpenSsl files. Ssl settings page in the setup dialog
displayed only if ssl support selected
  • Loading branch information
lawrinn committed Mar 14, 2016
1 parent 91825b7 commit 1afa0a5
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
26 changes: 26 additions & 0 deletions CMakeLists.txt
Expand Up @@ -156,14 +156,40 @@ IF(WIN32)
ENDFOREACH()
ENDFOREACH()
ENDIF()

ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
ENDIF()

# Check for OpenSSL. For platforms others than Windows, we build with OpenSSL by default. Optional otherwise
IF(NOT WIN32 OR WITH_OPENSSL)
FIND_PACKAGE(OpenSSL)

IF(OPENSSL_FOUND)
MESSAGE(STATUS "Configuring to build with OpenSSL")

ADD_DEFINITIONS(-DHAVE_OPENSSL)
INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
SET(SSL_LIBRARIES ${OPENSSL_LIBRARIES})

IF(OPENSSL_CRYPTO_LIBRARIES)
SET(SSL_LIBRARIES ${SSL_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARIES})
ENDIF()

SET(PLATFORM_DEPENDENCIES ${PLATFORM_DEPENDENCIES} ${SSL_LIBRARIES})
ELSE()
MESSAGE(FATAL_ERROR "OpenSSL not found. Please install OpenSSL or disable SSL support via option -DWITH_OPENSSL=Off")
ENDIF()
ELSE()
MESSAGE(STATUS "Configuring to build without SSL support")
ENDIF()

SET(UNICODE "W")

SET(LIBRARY_NAME "maodbc")
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/mariadb-odbc-driver.def.in
${CMAKE_SOURCE_DIR}/mariadb-odbc-driver-uni.def)

####### MAODBC #######
ADD_LIBRARY(maodbc SHARED ${MARIADB_ODBC_SOURCES} ${CMAKE_SOURCE_DIR}/mariadb-odbc-driver-uni.def maodbcu.rc)
SET_TARGET_PROPERTIES(maodbc PROPERTIES LANGUAGE C)
TARGET_LINK_LIBRARIES(maodbc ${MARIADB_LIB} ${ODBC_INSTLIBS} ${PLATFORM_DEPENDENCIES})
Expand Down
14 changes: 10 additions & 4 deletions dsn/odbc_dsn.c
Expand Up @@ -47,9 +47,15 @@ const int *EffectiveDisabledPages= NULL,
*EffectiveDisabledControls= NULL;
BOOL OpenCurSelection= TRUE;

#ifdef HAVE_OPENSSL
# define SSL_DISABLED 0
#else
# define SSL_DISABLED 1
#endif

const int DisabledPages[MAODBC_PROMPT_REQUIRED + 1][LASTPAGE + 1]= {
{ 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, SSL_DISABLED, 0},
{ 0, 0, 0, 0, SSL_DISABLED, 0},
{ 1, 0, 1, 1, 1, 1}
};
const int PromptDisabledControls[]= { txtDsnName, 0 },
Expand All @@ -68,8 +74,8 @@ MADB_DsnMap DsnMap[] = {
{&DsnKeys[7], 1, txtServerName, 128, 0},
{&DsnKeys[8], 1, txtUserName, 64, 0},
{&DsnKeys[9], 1, txtPassword, 64, 0},
{&DsnKeys[10], 1, cbDatabase, 0, 0},
{&DsnKeys[11], 1, txtPort, 5, 0},
{&DsnKeys[10], 1, cbDatabase, 0, 0},
{&DsnKeys[11], 1, txtPort, 5, 0},
{&DsnKeys[12], 2, txtInitCmd, 2048, 0},
{&DsnKeys[13], 2, txtConnectionTimeOut, 5, 0},
{&DsnKeys[14], 2, ckReconnect, 0, 0},
Expand Down

0 comments on commit 1afa0a5

Please sign in to comment.