Add complilation support for case when krb5 is not used

This commit is contained in:
Roman Vasin 2022-06-16 09:30:40 +00:00
parent 344fbe8de4
commit d93fd3bd2d
4 changed files with 14 additions and 3 deletions

View File

@ -4,6 +4,7 @@
#include <Poco/Logger.h>
#include <Loggers/Loggers.h>
#include <filesystem>
#if USE_KRB5
#include <krb5.h>
#include <mutex>
@ -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

View File

@ -4,4 +4,8 @@
#include <base/types.h>
#if USE_KRB5
int kerberosInit(const String & keytab_file, const String & principal, const String & cache_name = "");
#endif // USE_KRB5

View File

@ -10,8 +10,9 @@
#include <IO/WriteBufferFromString.h>
#include <IO/Operators.h>
#include <Common/logger_useful.h>
#if USE_KRB5
#include <Access/KerberosInit.h>
#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)

View File

@ -43,9 +43,9 @@
#include <Common/CurrentMetrics.h>
#include <Common/ProfileEvents.h>
#if USE_KRB5
#include <Access/KerberosInit.h>
#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)