Skip to content

Commit

Permalink
Client library: implement client.euser and client.egroup configuratio…
Browse files Browse the repository at this point in the history
…n parameters to allow to set effective user and group ids in "non authenticated" mode.
  • Loading branch information
mikeov committed Nov 14, 2017
1 parent 13017be commit 155aadc
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/cc/libclient/KfsClient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1667,6 +1667,8 @@ int KfsClientImpl::Init(const string& metaServerHost, int metaServerPort,
}
}
const char* const kAuthParamPrefix = KfsClient::GetClientAuthParamsPrefix();
kfsUid_t euser = mEUser;
kfsGid_t egroup = mEGroup;
if (properties) {
string errMsg;
int err;
Expand Down Expand Up @@ -1722,6 +1724,14 @@ int KfsClientImpl::Init(const string& metaServerHost, int metaServerPort,
mDefaultMetaOpTimeout = GetOpTimeout(properties->getValue(
"client.defaultMetaOpTimeout", mDefaultMetaOpTimeout));
mConfig.clear();
euser = properties->getValue("client.euser", euser);
egroup = properties->getValue("client.egroup", egroup);
if (kKfsUserNone == euser) {
euser = mEUser;
}
if (kKfsGroupNone == egroup) {
egroup = mEGroup;
}
properties->copyWithPrefix("client.", mConfig);
}
KFS_LOG_STREAM_DEBUG <<
Expand All @@ -1736,6 +1746,9 @@ int KfsClientImpl::Init(const string& metaServerHost, int metaServerPort,
KFS_LOG_EOM;
return -EINVAL;
}
if (euser != mEUser || egroup != mEGroup) {
SetEUserAndEGroup(euser, egroup, 0, 0);
}
const int ret = InitUserAndGroupMode();
mIsInitialized = ret == 0;
if (! mIsInitialized) {
Expand Down

0 comments on commit 155aadc

Please sign in to comment.