diff options
author | Jack Lloyd <[email protected]> | 2018-09-27 13:25:56 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-09-27 13:25:56 -0400 |
commit | 9d94c3f3e0cf9f1234497593516bc2776cc89a0b (patch) | |
tree | abc2c7850a07b173a657fd561661fd65fd090e08 /src/lib/utils/os_utils.h | |
parent | 62946a6d82df33fd7c78104f9151a2b6cdc8599e (diff) |
Add OS::running_in_privileged_state
Avoid any getenv toggles or reading /proc if we are setuid/setgid.
It is possible there is or will someday be some file in /proc that
is world-readable, but if read by a privileged user causes some side
effect.
Diffstat (limited to 'src/lib/utils/os_utils.h')
-rw-r--r-- | src/lib/utils/os_utils.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/utils/os_utils.h b/src/lib/utils/os_utils.h index 5210b2523..778ace4e9 100644 --- a/src/lib/utils/os_utils.h +++ b/src/lib/utils/os_utils.h @@ -32,6 +32,12 @@ namespace OS { uint32_t BOTAN_TEST_API get_process_id(); /** +* Test if we are currently running with elevated permissions +* eg setuid, setgid, or with POSIX caps set. +*/ +bool running_in_privileged_state(); + +/** * @return CPU processor clock, if available * * On Windows, calls QueryPerformanceCounter. |