From d93fd3bd2dcdfec6d1eba790508e393d91858999 Mon Sep 17 00:00:00 2001 From: Roman Vasin Date: Thu, 16 Jun 2022 09:30:40 +0000 Subject: [PATCH] Add complilation support for case when krb5 is not used --- src/Access/KerberosInit.cpp | 2 ++ src/Access/KerberosInit.h | 4 ++++ src/Storages/HDFS/HDFSCommon.cpp | 5 ++++- src/Storages/Kafka/StorageKafka.cpp | 6 ++++-- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/Access/KerberosInit.cpp b/src/Access/KerberosInit.cpp index 304bb69d424..8d4e2339bbf 100644 --- a/src/Access/KerberosInit.cpp +++ b/src/Access/KerberosInit.cpp @@ -4,6 +4,7 @@ #include #include #include +#if USE_KRB5 #include #include @@ -209,3 +210,4 @@ int kerberosInit(const String & keytab_file, const String & principal, const Str KerberosInit k_init; return k_init.init(keytab_file, principal, cache_name); } +#endif // USE_KRB5 diff --git a/src/Access/KerberosInit.h b/src/Access/KerberosInit.h index cfbbfc2e7d8..4731baf706f 100644 --- a/src/Access/KerberosInit.h +++ b/src/Access/KerberosInit.h @@ -4,4 +4,8 @@ #include +#if USE_KRB5 + int kerberosInit(const String & keytab_file, const String & principal, const String & cache_name = ""); + +#endif // USE_KRB5 diff --git a/src/Storages/HDFS/HDFSCommon.cpp b/src/Storages/HDFS/HDFSCommon.cpp index 8134aaf4981..bee8ac21acb 100644 --- a/src/Storages/HDFS/HDFSCommon.cpp +++ b/src/Storages/HDFS/HDFSCommon.cpp @@ -10,8 +10,9 @@ #include #include #include +#if USE_KRB5 #include - +#endif // USE_KRB5 namespace DB { @@ -74,6 +75,7 @@ void HDFSBuilderWrapper::loadFromConfig(const Poco::Util::AbstractConfiguration void HDFSBuilderWrapper::runKinit() { + #if USE_KRB5 LOG_DEBUG(&Poco::Logger::get("HDFSClient"), "Running KerberosInit"); try { @@ -84,6 +86,7 @@ void HDFSBuilderWrapper::runKinit() throw Exception("KerberosInit failure: "+ getExceptionMessage(e, false), ErrorCodes::KERBEROS_ERROR); } LOG_DEBUG(&Poco::Logger::get("HDFSClient"), "Finished KerberosInit"); + #endif // USE_KRB5 } HDFSBuilderWrapper createHDFSBuilder(const String & uri_str, const Poco::Util::AbstractConfiguration & config) diff --git a/src/Storages/Kafka/StorageKafka.cpp b/src/Storages/Kafka/StorageKafka.cpp index b4072cd6c0e..a24630fa3b1 100644 --- a/src/Storages/Kafka/StorageKafka.cpp +++ b/src/Storages/Kafka/StorageKafka.cpp @@ -43,9 +43,9 @@ #include #include - +#if USE_KRB5 #include - +#endif // USE_KRB5 namespace CurrentMetrics { @@ -517,6 +517,7 @@ void StorageKafka::updateConfiguration(cppkafka::Configuration & conf) if (config.has(config_prefix)) loadFromConfig(conf, config, config_prefix); + #if USE_KRB5 if (conf.has_property("sasl.kerberos.kinit.cmd")) LOG_WARNING(log, "sasl.kerberos.kinit.cmd configuration parameter is ignored."); @@ -538,6 +539,7 @@ void StorageKafka::updateConfiguration(cppkafka::Configuration & conf) } LOG_DEBUG(log, "Finished KerberosInit"); } + #endif // USE_KRB5 // Update consumer topic-specific configuration for (const auto & topic : topics)