| Line |
Branch |
Exec |
Source |
| 1 |
|
|
/** |
| 2 |
|
|
* This file is part of the CernVM File System. |
| 3 |
|
|
*/ |
| 4 |
|
|
|
| 5 |
|
|
|
| 6 |
|
|
#include "publish/except.h" |
| 7 |
|
|
#include "repository.h" |
| 8 |
|
|
#include "util/capabilities.h" |
| 9 |
|
|
#include "util/platform.h" |
| 10 |
|
|
#include "util/posix.h" |
| 11 |
|
|
|
| 12 |
|
|
namespace publish { |
| 13 |
|
|
|
| 14 |
|
✗ |
void Env::DropCapabilities() { |
| 15 |
|
|
// Because the process has file capabilities, its dumpable state is set to |
| 16 |
|
|
// false, which in turn makes the /proc/self/... files owned by root. We |
| 17 |
|
|
// need to reset this to have them owned by the effective UID in order to |
| 18 |
|
|
// set, e.g., uid_map/gid_map of user namespaces. |
| 19 |
|
✗ |
if (!platform_set_dumpable()) |
| 20 |
|
✗ |
throw EPublish("cannot set dumpable state"); |
| 21 |
|
|
|
| 22 |
|
✗ |
const std::vector<cap_value_t> nocaps; |
| 23 |
|
✗ |
if (!ClearPermittedCapabilities(nocaps, nocaps)) |
| 24 |
|
✗ |
throw EPublish("cannot clear process capabilities"); |
| 25 |
|
|
} |
| 26 |
|
|
|
| 27 |
|
|
|
| 28 |
|
✗ |
std::string Env::GetEnterSessionDir() { |
| 29 |
|
✗ |
if (SymlinkExists("/.cvmfsenter")) |
| 30 |
|
✗ |
return ResolvePath("/.cvmfsenter"); |
| 31 |
|
✗ |
return ""; |
| 32 |
|
|
} |
| 33 |
|
|
|
| 34 |
|
|
} // namespace publish |
| 35 |
|
|
|