mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
parent
08ec4f411f
commit
d6d83d4a5c
@ -1,5 +1,6 @@
|
|||||||
project (ClickHouse)
|
project (ClickHouse)
|
||||||
cmake_minimum_required (VERSION 3.3)
|
cmake_minimum_required (VERSION 3.3)
|
||||||
|
cmake_policy(SET CMP0023 NEW)
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ BUILD_TARGETS=clickhouse
|
|||||||
BUILD_TYPE=Debug
|
BUILD_TYPE=Debug
|
||||||
ENABLE_EMBEDDED_COMPILER=0
|
ENABLE_EMBEDDED_COMPILER=0
|
||||||
|
|
||||||
CMAKE_FLAGS="-D CMAKE_C_FLAGS_ADD=-g0 -D CMAKE_CXX_FLAGS_ADD=-g0 -D ENABLE_JEMALLOC=0 -D ENABLE_CAPNP=0 -D ENABLE_RDKAFKA=0 -D ENABLE_UNWIND=0 -D ENABLE_ICU=0 -D ENABLE_POCO_MONGODB=0 -D ENABLE_POCO_NETSSL=0 -D ENABLE_POCO_ODBC=0 -D ENABLE_ODBC=0 -D ENABLE_MYSQL=0"
|
CMAKE_FLAGS="-D CMAKE_C_FLAGS_ADD=-g0 -D CMAKE_CXX_FLAGS_ADD=-g0 -D ENABLE_JEMALLOC=0 -D ENABLE_CAPNP=0 -D ENABLE_RDKAFKA=0 -D ENABLE_UNWIND=0 -D ENABLE_ICU=0 -D ENABLE_POCO_MONGODB=0 -D ENABLE_POCO_NETSSL=0 -D ENABLE_POCO_ODBC=0 -D ENABLE_ODBC=0 -D ENABLE_MYSQL=0 -D ENABLE_SSL=0 -D ENABLE_POCO_NETSSL=0"
|
||||||
|
|
||||||
[[ $(uname) == "FreeBSD" ]] && COMPILER_PACKAGE_VERSION=devel && export COMPILER_PATH=/usr/local/bin
|
[[ $(uname) == "FreeBSD" ]] && COMPILER_PACKAGE_VERSION=devel && export COMPILER_PATH=/usr/local/bin
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Freebsd: contrib/cppkafka/include/cppkafka/detail/endianness.h:53:23: error: 'betoh16' was not declared in this scope
|
# Freebsd: contrib/cppkafka/include/cppkafka/detail/endianness.h:53:23: error: 'betoh16' was not declared in this scope
|
||||||
if (NOT ARCH_ARM AND NOT ARCH_32 AND NOT APPLE AND NOT OS_FREEBSD)
|
if (NOT ARCH_ARM AND NOT ARCH_32 AND NOT APPLE AND NOT OS_FREEBSD AND OPENSSL_FOUND)
|
||||||
option (ENABLE_RDKAFKA "Enable kafka" ON)
|
option (ENABLE_RDKAFKA "Enable kafka" ON)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
@ -1,7 +1,19 @@
|
|||||||
|
option (ENABLE_SSL "Enable ssl" ON)
|
||||||
|
|
||||||
|
if (ENABLE_SSL)
|
||||||
|
|
||||||
if(NOT ARCH_32)
|
if(NOT ARCH_32)
|
||||||
option(USE_INTERNAL_SSL_LIBRARY "Set to FALSE to use system *ssl library instead of bundled" ${NOT_UNBUNDLED})
|
option(USE_INTERNAL_SSL_LIBRARY "Set to FALSE to use system *ssl library instead of bundled" ${NOT_UNBUNDLED})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/ssl/CMakeLists.txt")
|
||||||
|
if(USE_INTERNAL_SSL_LIBRARY)
|
||||||
|
message(WARNING "submodule contrib/ssl is missing. to fix try run: \n git submodule update --init --recursive")
|
||||||
|
endif()
|
||||||
|
set(USE_INTERNAL_SSL_LIBRARY 0)
|
||||||
|
set(MISSING_INTERNAL_SSL_LIBRARY 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
set (OPENSSL_USE_STATIC_LIBS ${USE_STATIC_LIBRARIES})
|
set (OPENSSL_USE_STATIC_LIBS ${USE_STATIC_LIBRARIES})
|
||||||
|
|
||||||
if (NOT USE_INTERNAL_SSL_LIBRARY)
|
if (NOT USE_INTERNAL_SSL_LIBRARY)
|
||||||
@ -28,7 +40,7 @@ if (NOT USE_INTERNAL_SSL_LIBRARY)
|
|||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (NOT OPENSSL_FOUND)
|
if (NOT OPENSSL_FOUND AND NOT MISSING_INTERNAL_SSL_LIBRARY)
|
||||||
set (USE_INTERNAL_SSL_LIBRARY 1)
|
set (USE_INTERNAL_SSL_LIBRARY 1)
|
||||||
set (OPENSSL_ROOT_DIR "${ClickHouse_SOURCE_DIR}/contrib/ssl")
|
set (OPENSSL_ROOT_DIR "${ClickHouse_SOURCE_DIR}/contrib/ssl")
|
||||||
set (OPENSSL_INCLUDE_DIR "${OPENSSL_ROOT_DIR}/include")
|
set (OPENSSL_INCLUDE_DIR "${OPENSSL_ROOT_DIR}/include")
|
||||||
@ -43,4 +55,11 @@ if (NOT OPENSSL_FOUND)
|
|||||||
set (OPENSSL_FOUND 1)
|
set (OPENSSL_FOUND 1)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
message (STATUS "Using ssl=${OPENSSL_FOUND}: ${OPENSSL_INCLUDE_DIR} : ${OPENSSL_LIBRARIES}")
|
if(OPENSSL_FOUND)
|
||||||
|
# we need keep OPENSSL_FOUND for many libs in contrib
|
||||||
|
set(USE_SSL 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
message (STATUS "Using ssl=${USE_SSL}: ${OPENSSL_INCLUDE_DIR} : ${OPENSSL_LIBRARIES}")
|
||||||
|
4
contrib/CMakeLists.txt
vendored
4
contrib/CMakeLists.txt
vendored
@ -125,13 +125,17 @@ endif ()
|
|||||||
if (ENABLE_MYSQL AND USE_INTERNAL_MYSQL_LIBRARY)
|
if (ENABLE_MYSQL AND USE_INTERNAL_MYSQL_LIBRARY)
|
||||||
add_subdirectory (mariadb-connector-c-cmake)
|
add_subdirectory (mariadb-connector-c-cmake)
|
||||||
target_include_directories(mysqlclient BEFORE PRIVATE ${ZLIB_INCLUDE_DIR})
|
target_include_directories(mysqlclient BEFORE PRIVATE ${ZLIB_INCLUDE_DIR})
|
||||||
|
if(OPENSSL_INCLUDE_DIR)
|
||||||
target_include_directories(mysqlclient BEFORE PRIVATE ${OPENSSL_INCLUDE_DIR})
|
target_include_directories(mysqlclient BEFORE PRIVATE ${OPENSSL_INCLUDE_DIR})
|
||||||
|
endif()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (USE_INTERNAL_RDKAFKA_LIBRARY)
|
if (USE_INTERNAL_RDKAFKA_LIBRARY)
|
||||||
add_subdirectory (librdkafka-cmake)
|
add_subdirectory (librdkafka-cmake)
|
||||||
target_include_directories(rdkafka BEFORE PRIVATE ${ZLIB_INCLUDE_DIR})
|
target_include_directories(rdkafka BEFORE PRIVATE ${ZLIB_INCLUDE_DIR})
|
||||||
|
if(OPENSSL_INCLUDE_DIR)
|
||||||
target_include_directories(rdkafka BEFORE PRIVATE ${OPENSSL_INCLUDE_DIR})
|
target_include_directories(rdkafka BEFORE PRIVATE ${OPENSSL_INCLUDE_DIR})
|
||||||
|
endif()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (USE_RDKAFKA)
|
if (USE_RDKAFKA)
|
||||||
|
@ -208,7 +208,8 @@ target_link_libraries(hdfs3 ${LIBXML2_LIBRARY})
|
|||||||
# inherit from parent cmake
|
# inherit from parent cmake
|
||||||
target_include_directories(hdfs3 PRIVATE ${Boost_INCLUDE_DIRS})
|
target_include_directories(hdfs3 PRIVATE ${Boost_INCLUDE_DIRS})
|
||||||
target_include_directories(hdfs3 PRIVATE ${Protobuf_INCLUDE_DIR})
|
target_include_directories(hdfs3 PRIVATE ${Protobuf_INCLUDE_DIR})
|
||||||
target_include_directories(hdfs3 PRIVATE ${OPENSSL_INCLUDE_DIR})
|
|
||||||
|
|
||||||
target_link_libraries(hdfs3 ${Protobuf_LIBRARY})
|
target_link_libraries(hdfs3 ${Protobuf_LIBRARY})
|
||||||
target_link_libraries(hdfs3 ${OPENSSL_LIBRARIES})
|
if(OPENSSL_INCLUDE_DIR AND OPENSSL_LIBRARIES)
|
||||||
|
target_include_directories(hdfs3 PRIVATE ${OPENSSL_INCLUDE_DIR})
|
||||||
|
target_link_libraries(hdfs3 ${OPENSSL_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
@ -58,4 +58,7 @@ add_library(rdkafka ${LINK_MODE} ${SRCS})
|
|||||||
target_include_directories(rdkafka SYSTEM PUBLIC include)
|
target_include_directories(rdkafka SYSTEM PUBLIC include)
|
||||||
target_include_directories(rdkafka SYSTEM PUBLIC ${RDKAFKA_SOURCE_DIR}) # Because weird logic with "include_next" is used.
|
target_include_directories(rdkafka SYSTEM PUBLIC ${RDKAFKA_SOURCE_DIR}) # Because weird logic with "include_next" is used.
|
||||||
target_include_directories(rdkafka SYSTEM PRIVATE ${ZSTD_INCLUDE_DIR}/common) # Because wrong path to "zstd_errors.h" is used.
|
target_include_directories(rdkafka SYSTEM PRIVATE ${ZSTD_INCLUDE_DIR}/common) # Because wrong path to "zstd_errors.h" is used.
|
||||||
target_link_libraries(rdkafka PUBLIC ${ZLIB_LIBRARIES} ${ZSTD_LIBRARY} ${LZ4_LIBRARY} ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY})
|
target_link_libraries(rdkafka PUBLIC ${ZLIB_LIBRARIES} ${ZSTD_LIBRARY} ${LZ4_LIBRARY})
|
||||||
|
if(OPENSSL_SSL_LIBRARY AND OPENSSL_CRYPTO_LIBRARY)
|
||||||
|
target_link_libraries(rdkafka PUBLIC ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY})
|
||||||
|
endif()
|
||||||
|
@ -33,7 +33,6 @@ ${MARIADB_CLIENT_SOURCE_DIR}/libmariadb/ma_time.c
|
|||||||
${MARIADB_CLIENT_SOURCE_DIR}/libmariadb/ma_tls.c
|
${MARIADB_CLIENT_SOURCE_DIR}/libmariadb/ma_tls.c
|
||||||
#${MARIADB_CLIENT_SOURCE_DIR}/libmariadb/secure/gnutls.c
|
#${MARIADB_CLIENT_SOURCE_DIR}/libmariadb/secure/gnutls.c
|
||||||
#${MARIADB_CLIENT_SOURCE_DIR}/libmariadb/secure/ma_schannel.c
|
#${MARIADB_CLIENT_SOURCE_DIR}/libmariadb/secure/ma_schannel.c
|
||||||
${MARIADB_CLIENT_SOURCE_DIR}/libmariadb/secure/openssl.c
|
|
||||||
#${MARIADB_CLIENT_SOURCE_DIR}/libmariadb/secure/schannel.c
|
#${MARIADB_CLIENT_SOURCE_DIR}/libmariadb/secure/schannel.c
|
||||||
#${MARIADB_CLIENT_SOURCE_DIR}/plugins/auth/auth_gssapi_client.c
|
#${MARIADB_CLIENT_SOURCE_DIR}/plugins/auth/auth_gssapi_client.c
|
||||||
#${MARIADB_CLIENT_SOURCE_DIR}/plugins/auth/dialog.c
|
#${MARIADB_CLIENT_SOURCE_DIR}/plugins/auth/dialog.c
|
||||||
@ -55,12 +54,19 @@ ${MARIADB_CLIENT_SOURCE_DIR}/plugins/pvio/pvio_socket.c
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/linux_x86_64/libmariadb/ma_client_plugin.c
|
${CMAKE_CURRENT_SOURCE_DIR}/linux_x86_64/libmariadb/ma_client_plugin.c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(OPENSSL_LIBRARIES)
|
||||||
|
list(APPEND SRCS ${MARIADB_CLIENT_SOURCE_DIR}/libmariadb/secure/openssl.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_library(mysqlclient STATIC ${SRCS})
|
add_library(mysqlclient STATIC ${SRCS})
|
||||||
|
|
||||||
target_link_libraries(mysqlclient ${OPENSSL_LIBRARIES})
|
if(OPENSSL_LIBRARIES)
|
||||||
|
target_link_libraries(mysqlclient ${OPENSSL_LIBRARIES})
|
||||||
|
target_compile_definitions(mysqlclient PRIVATE -D HAVE_OPENSSL -D HAVE_TLS)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_include_directories(mysqlclient PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/linux_x86_64/include)
|
target_include_directories(mysqlclient PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/linux_x86_64/include)
|
||||||
target_include_directories(mysqlclient PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/common/include)
|
target_include_directories(mysqlclient PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/common/include)
|
||||||
target_include_directories(mysqlclient PUBLIC ${MARIADB_CLIENT_SOURCE_DIR}/include)
|
target_include_directories(mysqlclient PUBLIC ${MARIADB_CLIENT_SOURCE_DIR}/include)
|
||||||
|
|
||||||
target_compile_definitions(mysqlclient PRIVATE -D THREAD -D HAVE_OPENSSL -D HAVE_TLS)
|
target_compile_definitions(mysqlclient PRIVATE -D THREAD)
|
||||||
|
1
contrib/ssl
vendored
1
contrib/ssl
vendored
@ -1 +0,0 @@
|
|||||||
Subproject commit ba8de796195ff9d8bb0249ce289b83226b848b77
|
|
@ -309,7 +309,10 @@ if (USE_PARQUET)
|
|||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
target_link_libraries(dbms PRIVATE ${OPENSSL_CRYPTO_LIBRARY} Threads::Threads)
|
if(OPENSSL_CRYPTO_LIBRARY)
|
||||||
|
target_link_libraries(dbms PRIVATE ${OPENSSL_CRYPTO_LIBRARY})
|
||||||
|
endif ()
|
||||||
|
target_link_libraries(dbms PRIVATE Threads::Threads)
|
||||||
|
|
||||||
target_include_directories (dbms SYSTEM BEFORE PRIVATE ${DIVIDE_INCLUDE_DIR})
|
target_include_directories (dbms SYSTEM BEFORE PRIVATE ${DIVIDE_INCLUDE_DIR})
|
||||||
target_include_directories (dbms SYSTEM BEFORE PRIVATE ${SPARCEHASH_INCLUDE_DIR})
|
target_include_directories (dbms SYSTEM BEFORE PRIVATE ${SPARCEHASH_INCLUDE_DIR})
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#cmakedefine01 USE_CPUID
|
#cmakedefine01 USE_CPUID
|
||||||
#cmakedefine01 USE_CPUINFO
|
#cmakedefine01 USE_CPUINFO
|
||||||
#cmakedefine01 USE_BROTLI
|
#cmakedefine01 USE_BROTLI
|
||||||
|
#cmakedefine01 USE_SSL
|
||||||
|
|
||||||
#cmakedefine01 CLICKHOUSE_SPLIT_BINARY
|
#cmakedefine01 CLICKHOUSE_SPLIT_BINARY
|
||||||
#cmakedefine01 LLVM_HAS_RTTI
|
#cmakedefine01 LLVM_HAS_RTTI
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
add_executable (hashes_test hashes_test.cpp)
|
add_executable (hashes_test hashes_test.cpp)
|
||||||
target_link_libraries (hashes_test PRIVATE clickhouse_common_io ${OPENSSL_CRYPTO_LIBRARY} ${CITYHASH_LIBRARIES})
|
target_link_libraries (hashes_test PRIVATE clickhouse_common_io ${CITYHASH_LIBRARIES})
|
||||||
|
if(OPENSSL_CRYPTO_LIBRARY)
|
||||||
|
target_link_libraries (hashes_test PRIVATE ${OPENSSL_CRYPTO_LIBRARY})
|
||||||
|
endif()
|
||||||
|
|
||||||
add_executable (sip_hash sip_hash.cpp)
|
add_executable (sip_hash sip_hash.cpp)
|
||||||
target_link_libraries (sip_hash PRIVATE clickhouse_common_io)
|
target_link_libraries (sip_hash PRIVATE clickhouse_common_io)
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
||||||
#include <city.h>
|
#include <city.h>
|
||||||
#include <openssl/md5.h>
|
|
||||||
|
|
||||||
#include <Common/Stopwatch.h>
|
#include <Common/Stopwatch.h>
|
||||||
|
|
||||||
#include <Common/SipHash.h>
|
#include <Common/SipHash.h>
|
||||||
#include <IO/ReadBufferFromFileDescriptor.h>
|
#include <IO/ReadBufferFromFileDescriptor.h>
|
||||||
#include <IO/ReadHelpers.h>
|
#include <IO/ReadHelpers.h>
|
||||||
|
#include <Common/config.h>
|
||||||
|
#if USE_SSL
|
||||||
|
# include <openssl/md5.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int main(int, char **)
|
int main(int, char **)
|
||||||
@ -108,6 +108,7 @@ int main(int, char **)
|
|||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if USE_SSL
|
||||||
{
|
{
|
||||||
Stopwatch watch;
|
Stopwatch watch;
|
||||||
|
|
||||||
@ -129,6 +130,7 @@ int main(int, char **)
|
|||||||
<< " (" << rows / watch.elapsedSeconds() << " rows/sec., " << bytes / 1000000.0 / watch.elapsedSeconds() << " MB/sec.)"
|
<< " (" << rows / watch.elapsedSeconds() << " rows/sec., " << bytes / 1000000.0 / watch.elapsedSeconds() << " MB/sec.)"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,11 @@ target_link_libraries(clickhouse_functions
|
|||||||
${METROHASH_LIBRARIES}
|
${METROHASH_LIBRARIES}
|
||||||
murmurhash
|
murmurhash
|
||||||
${BASE64_LIBRARY}
|
${BASE64_LIBRARY}
|
||||||
${OPENSSL_CRYPTO_LIBRARY})
|
)
|
||||||
|
|
||||||
|
if (OPENSSL_CRYPTO_LIBRARY)
|
||||||
|
target_link_libraries(clickhouse_functions PUBLIC ${OPENSSL_CRYPTO_LIBRARY})
|
||||||
|
endif()
|
||||||
|
|
||||||
target_include_directories (clickhouse_functions SYSTEM BEFORE PUBLIC ${DIVIDE_INCLUDE_DIR} ${METROHASH_INCLUDE_DIR})
|
target_include_directories (clickhouse_functions SYSTEM BEFORE PUBLIC ${DIVIDE_INCLUDE_DIR} ${METROHASH_INCLUDE_DIR})
|
||||||
|
|
||||||
|
@ -8,11 +8,13 @@ namespace DB
|
|||||||
|
|
||||||
void registerFunctionsHashing(FunctionFactory & factory)
|
void registerFunctionsHashing(FunctionFactory & factory)
|
||||||
{
|
{
|
||||||
|
#if USE_SSL
|
||||||
factory.registerFunction<FunctionHalfMD5>();
|
factory.registerFunction<FunctionHalfMD5>();
|
||||||
factory.registerFunction<FunctionMD5>();
|
factory.registerFunction<FunctionMD5>();
|
||||||
factory.registerFunction<FunctionSHA1>();
|
factory.registerFunction<FunctionSHA1>();
|
||||||
factory.registerFunction<FunctionSHA224>();
|
factory.registerFunction<FunctionSHA224>();
|
||||||
factory.registerFunction<FunctionSHA256>();
|
factory.registerFunction<FunctionSHA256>();
|
||||||
|
#endif
|
||||||
factory.registerFunction<FunctionSipHash64>();
|
factory.registerFunction<FunctionSipHash64>();
|
||||||
factory.registerFunction<FunctionSipHash128>();
|
factory.registerFunction<FunctionSipHash128>();
|
||||||
factory.registerFunction<FunctionCityHash64>();
|
factory.registerFunction<FunctionCityHash64>();
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <openssl/md5.h>
|
|
||||||
#include <openssl/sha.h>
|
|
||||||
#include <city.h>
|
#include <city.h>
|
||||||
#include <farmhash.h>
|
#include <farmhash.h>
|
||||||
#include <metrohash.h>
|
#include <metrohash.h>
|
||||||
@ -14,7 +12,12 @@
|
|||||||
|
|
||||||
#include <Common/config.h>
|
#include <Common/config.h>
|
||||||
#if USE_XXHASH
|
#if USE_XXHASH
|
||||||
#include <xxhash.h> // Y_IGNORE
|
# include <xxhash.h> // Y_IGNORE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if USE_SSL
|
||||||
|
# include <openssl/md5.h>
|
||||||
|
# include <openssl/sha.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <Poco/ByteOrder.h>
|
#include <Poco/ByteOrder.h>
|
||||||
@ -94,7 +97,7 @@ struct IntHash64Impl
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if USE_SSL
|
||||||
struct HalfMD5Impl
|
struct HalfMD5Impl
|
||||||
{
|
{
|
||||||
static constexpr auto name = "halfMD5";
|
static constexpr auto name = "halfMD5";
|
||||||
@ -183,6 +186,7 @@ struct SHA256Impl
|
|||||||
SHA256_Final(out_char_data, &ctx);
|
SHA256_Final(out_char_data, &ctx);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
struct SipHash64Impl
|
struct SipHash64Impl
|
||||||
{
|
{
|
||||||
@ -1076,15 +1080,18 @@ private:
|
|||||||
struct NameIntHash32 { static constexpr auto name = "intHash32"; };
|
struct NameIntHash32 { static constexpr auto name = "intHash32"; };
|
||||||
struct NameIntHash64 { static constexpr auto name = "intHash64"; };
|
struct NameIntHash64 { static constexpr auto name = "intHash64"; };
|
||||||
|
|
||||||
|
#if USE_SSL
|
||||||
using FunctionHalfMD5 = FunctionAnyHash<HalfMD5Impl>;
|
using FunctionHalfMD5 = FunctionAnyHash<HalfMD5Impl>;
|
||||||
|
#endif
|
||||||
using FunctionSipHash64 = FunctionAnyHash<SipHash64Impl>;
|
using FunctionSipHash64 = FunctionAnyHash<SipHash64Impl>;
|
||||||
using FunctionIntHash32 = FunctionIntHash<IntHash32Impl, NameIntHash32>;
|
using FunctionIntHash32 = FunctionIntHash<IntHash32Impl, NameIntHash32>;
|
||||||
using FunctionIntHash64 = FunctionIntHash<IntHash64Impl, NameIntHash64>;
|
using FunctionIntHash64 = FunctionIntHash<IntHash64Impl, NameIntHash64>;
|
||||||
|
#if USE_SSL
|
||||||
using FunctionMD5 = FunctionStringHashFixedString<MD5Impl>;
|
using FunctionMD5 = FunctionStringHashFixedString<MD5Impl>;
|
||||||
using FunctionSHA1 = FunctionStringHashFixedString<SHA1Impl>;
|
using FunctionSHA1 = FunctionStringHashFixedString<SHA1Impl>;
|
||||||
using FunctionSHA224 = FunctionStringHashFixedString<SHA224Impl>;
|
using FunctionSHA224 = FunctionStringHashFixedString<SHA224Impl>;
|
||||||
using FunctionSHA256 = FunctionStringHashFixedString<SHA256Impl>;
|
using FunctionSHA256 = FunctionStringHashFixedString<SHA256Impl>;
|
||||||
|
#endif
|
||||||
using FunctionSipHash128 = FunctionStringHashFixedString<SipHash128Impl>;
|
using FunctionSipHash128 = FunctionStringHashFixedString<SipHash128Impl>;
|
||||||
using FunctionCityHash64 = FunctionAnyHash<ImplCityHash64>;
|
using FunctionCityHash64 = FunctionAnyHash<ImplCityHash64>;
|
||||||
using FunctionFarmHash64 = FunctionAnyHash<ImplFarmHash64>;
|
using FunctionFarmHash64 = FunctionAnyHash<ImplFarmHash64>;
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
#include <Interpreters/SecurityManager.h>
|
#include "SecurityManager.h"
|
||||||
|
|
||||||
#include <Poco/Net/IPAddress.h>
|
#include <Poco/Net/IPAddress.h>
|
||||||
#include <Poco/Util/AbstractConfiguration.h>
|
#include <Poco/Util/AbstractConfiguration.h>
|
||||||
#include <Poco/String.h>
|
#include <Poco/String.h>
|
||||||
|
|
||||||
#include <Common/Exception.h>
|
#include <Common/Exception.h>
|
||||||
#include <IO/HexWriteBuffer.h>
|
#include <IO/HexWriteBuffer.h>
|
||||||
#include <IO/WriteBufferFromString.h>
|
#include <IO/WriteBufferFromString.h>
|
||||||
#include <IO/WriteHelpers.h>
|
#include <IO/WriteHelpers.h>
|
||||||
|
|
||||||
#include <openssl/sha.h>
|
|
||||||
|
|
||||||
#include <common/logger_useful.h>
|
#include <common/logger_useful.h>
|
||||||
|
#include <Common/config.h>
|
||||||
|
#if USE_SSL
|
||||||
|
# include <openssl/sha.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
@ -25,6 +25,7 @@ namespace ErrorCodes
|
|||||||
extern const int WRONG_PASSWORD;
|
extern const int WRONG_PASSWORD;
|
||||||
extern const int IP_ADDRESS_NOT_ALLOWED;
|
extern const int IP_ADDRESS_NOT_ALLOWED;
|
||||||
extern const int BAD_ARGUMENTS;
|
extern const int BAD_ARGUMENTS;
|
||||||
|
extern const int SUPPORT_IS_DISABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
using UserPtr = SecurityManager::UserPtr;
|
using UserPtr = SecurityManager::UserPtr;
|
||||||
@ -68,6 +69,7 @@ UserPtr SecurityManager::authorizeAndGetUser(
|
|||||||
|
|
||||||
if (!it->second->password_sha256_hex.empty())
|
if (!it->second->password_sha256_hex.empty())
|
||||||
{
|
{
|
||||||
|
#if USE_SSL
|
||||||
unsigned char hash[32];
|
unsigned char hash[32];
|
||||||
|
|
||||||
SHA256_CTX ctx;
|
SHA256_CTX ctx;
|
||||||
@ -86,6 +88,9 @@ UserPtr SecurityManager::authorizeAndGetUser(
|
|||||||
|
|
||||||
if (hash_hex != it->second->password_sha256_hex)
|
if (hash_hex != it->second->password_sha256_hex)
|
||||||
on_wrong_password();
|
on_wrong_password();
|
||||||
|
#else
|
||||||
|
throw DB::Exception("Sha256 passwords support is disabled, because ClickHouse was built without SSL library", DB::ErrorCodes::SUPPORT_IS_DISABLED);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (password != it->second->password)
|
else if (password != it->second->password)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <Poco/RegularExpression.h>
|
#include <Poco/RegularExpression.h>
|
||||||
#include <Poco/Net/IPAddress.h>
|
#include <Poco/Net/IPAddress.h>
|
||||||
#include <Poco/Net/SocketAddress.h>
|
#include <Poco/Net/SocketAddress.h>
|
||||||
@ -7,7 +6,6 @@
|
|||||||
#include <Poco/Util/Application.h>
|
#include <Poco/Util/Application.h>
|
||||||
#include <Poco/Util/AbstractConfiguration.h>
|
#include <Poco/Util/AbstractConfiguration.h>
|
||||||
#include <Poco/String.h>
|
#include <Poco/String.h>
|
||||||
|
|
||||||
#include <Common/Exception.h>
|
#include <Common/Exception.h>
|
||||||
#include <IO/ReadHelpers.h>
|
#include <IO/ReadHelpers.h>
|
||||||
#include <IO/HexWriteBuffer.h>
|
#include <IO/HexWriteBuffer.h>
|
||||||
@ -16,12 +14,9 @@
|
|||||||
#include <Common/SimpleCache.h>
|
#include <Common/SimpleCache.h>
|
||||||
#include <Common/StringUtils/StringUtils.h>
|
#include <Common/StringUtils/StringUtils.h>
|
||||||
#include <Interpreters/Users.h>
|
#include <Interpreters/Users.h>
|
||||||
|
|
||||||
#include <openssl/sha.h>
|
|
||||||
|
|
||||||
#include <common/logger_useful.h>
|
#include <common/logger_useful.h>
|
||||||
|
|
||||||
#include <ext/scope_guard.h>
|
#include <ext/scope_guard.h>
|
||||||
|
#include <Common/config.h>
|
||||||
|
|
||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
|
@ -55,6 +55,7 @@ const char * auto_config_build[]
|
|||||||
"USE_PARQUET", "@USE_PARQUET@",
|
"USE_PARQUET", "@USE_PARQUET@",
|
||||||
"USE_PROTOBUF", "@USE_PROTOBUF@",
|
"USE_PROTOBUF", "@USE_PROTOBUF@",
|
||||||
"USE_BROTLI", "@USE_BROTLI@",
|
"USE_BROTLI", "@USE_BROTLI@",
|
||||||
|
"USE_SSL", "@USE_SSL@",
|
||||||
|
|
||||||
nullptr, nullptr
|
nullptr, nullptr
|
||||||
};
|
};
|
||||||
|
@ -46,8 +46,13 @@ else ()
|
|||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
target_link_libraries (mysqlxx common ${Poco_Util_LIBRARY} ${MYSQLCLIENT_LIBRARIES} ${Boost_SYSTEM_LIBRARY} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES} ${PLATFORM_LIBRARIES})
|
target_link_libraries(mysqlxx PUBLIC common ${Poco_Util_LIBRARY} PRIVATE ${MYSQLCLIENT_LIBRARIES} PUBLIC ${Boost_SYSTEM_LIBRARY} PRIVATE ${ZLIB_LIBRARIES})
|
||||||
if (NOT USE_INTERNAL_MYSQL_LIBRARY)
|
if(OPENSSL_LIBRARIES)
|
||||||
|
target_link_libraries(mysqlxx PRIVATE ${OPENSSL_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
target_link_libraries(mysqlxx PRIVATE ${PLATFORM_LIBRARIES})
|
||||||
|
|
||||||
|
if (NOT USE_INTERNAL_MYSQL_LIBRARY AND OPENSSL_INCLUDE_DIR)
|
||||||
target_include_directories (mysqlxx SYSTEM PRIVATE ${OPENSSL_INCLUDE_DIR})
|
target_include_directories (mysqlxx SYSTEM PRIVATE ${OPENSSL_INCLUDE_DIR})
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user