chiark / gitweb /
capability: change capability_bounding_set_drop() to be work without privileges when...
authorLennart Poettering <lennart@poettering.net>
Wed, 9 Aug 2017 13:05:36 +0000 (15:05 +0200)
committerSven Eden <yamakuzure@gmx.net>
Mon, 25 Sep 2017 12:31:16 +0000 (14:31 +0200)
This way daemons which already dropped all caps may use the call to
drop priviliges again, which becomes a non-failing NOP.

src/basic/capability-util.c

index 294dcc8d4aaeccf6a332d20912b23651956df6f7..952bcc2d7d434782c987031a0d7e7d56ea54aee5 100644 (file)
@@ -372,19 +372,4 @@ int drop_capability(cap_value_t cv) {
 
         return 0;
 }
-
-bool ambient_capabilities_supported(void) {
-        static int cache = -1;
-
-        if (cache >= 0)
-                return cache;
-
-        /* If PR_CAP_AMBIENT returns something valid, or an unexpected error code we assume that ambient caps are
-         * available. */
-
-        cache = prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_IS_SET, CAP_KILL, 0, 0) >= 0 ||
-                !IN_SET(errno, EINVAL, EOPNOTSUPP, ENOSYS);
-
-        return cache;
-}
 #endif // 0