Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[XrdCl] Make xrd.secuid take effect only if euid == 0 #629

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/XrdCl/XrdClUtils.hh
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,13 @@ namespace XrdCl
pPrevFsUid = -1;
pPrevFsGid = -1;

//----------------------------------------------------------------------
//! Do nothing if we aren't root
//----------------------------------------------------------------------
if(!isRoot()) {
return;
}

//----------------------------------------------------------------------
//! Set fsuid
//----------------------------------------------------------------------
Expand Down Expand Up @@ -299,6 +306,17 @@ namespace XrdCl
}

private:
bool isRoot() const {
uid_t ruid, euid, suid;
if(getresuid(&ruid, &euid, &suid) != 0) {
Log *log = DefaultEnv::GetLog();
log->Error(XRootDTransportMsg, "[%s] Could not determine effective uid", pStreamName.c_str());
return true;
}

return (euid == 0);
}

int pFsUid;
int pFsGid;

Expand Down