Skip to content

Commit 38e4376

Browse files
committed
add more logs
1 parent b270737 commit 38e4376

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

cpp/wedpr-storage/ppc-storage/src/hdfs/HDFSStorage.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ HDFSStorage::HDFSStorage(FileStorageConnectionOption::Ptr const& _option)
7070
// init the auth information
7171
if (_option->authConfig)
7272
{
73+
// set auth type to Kerberos
74+
hdfsBuilderConfSetStr(m_builder.get(), "hadoop.security.authentication", "Kerberos");
7375
// init and store the auth information into the cache
7476
auto ctx = std::make_shared<Krb5Context>(_option->authConfig);
7577
ctx->init();

cpp/wedpr-storage/ppc-storage/src/hdfs/auth/Krb5CredLoader.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ void Krb5Context::init()
3737
checkResult(error, "krb5_parse_name");
3838
// init credential
3939
error = krb5_get_init_creds_password(
40-
m_ctx, m_creds, m_principal, m_config->password.c_str(), NULL, NULL, 0, NULL, NULL);
40+
m_ctx, &m_credsObj, m_principal, m_config->password.c_str(), NULL, NULL, 0, NULL, NULL);
4141
checkResult(error, "krb5_get_init_creds_password");
42+
m_creds = &m_credsObj;
4243
// init the ccache
4344
error = krb5_cc_resolve(m_ctx, m_config->ccachePath.c_str(), &m_ccache);
4445
checkResult(error, "krb5_cc_resolve");
@@ -54,6 +55,7 @@ void Krb5Context::checkResult(krb5_error_code const& error, std::string const& m
5455
{
5556
if (!error)
5657
{
58+
HDFS_AUTH_LOG(INFO) << LOG_DESC("init Krb5Context: ") << method << " success";
5759
return;
5860
}
5961
auto msg = krb5_get_error_message(m_ctx, error);

cpp/wedpr-storage/ppc-storage/src/hdfs/auth/Krb5CredLoader.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class Krb5Context
5555
ppc::protocol::Krb5AuthConfig::Ptr m_config;
5656
krb5_context m_ctx = NULL;
5757
krb5_principal m_principal = NULL;
58+
krb5_creds m_credsObj;
5859
krb5_creds* m_creds = NULL;
5960
krb5_ccache m_ccache = NULL;
6061
};

0 commit comments

Comments
 (0)