Unverified Commit 723935d6 by Christian Brauner Committed by Stéphane Graber

caps: skip file capability checks on android

parent 99e54f04
...@@ -225,6 +225,10 @@ static bool lxc_cap_is_set(cap_t caps, cap_value_t cap, cap_flag_t flag) ...@@ -225,6 +225,10 @@ static bool lxc_cap_is_set(cap_t caps, cap_value_t cap, cap_flag_t flag)
bool lxc_file_cap_is_set(const char *path, cap_value_t cap, cap_flag_t flag) bool lxc_file_cap_is_set(const char *path, cap_value_t cap, cap_flag_t flag)
{ {
/* Android's bionic currently seems to lack support for cap_get_file(). */
#if IS_BIONIC
return true;
#else
bool cap_is_set; bool cap_is_set;
cap_t caps; cap_t caps;
...@@ -243,6 +247,7 @@ bool lxc_file_cap_is_set(const char *path, cap_value_t cap, cap_flag_t flag) ...@@ -243,6 +247,7 @@ bool lxc_file_cap_is_set(const char *path, cap_value_t cap, cap_flag_t flag)
cap_is_set = lxc_cap_is_set(caps, cap, flag); cap_is_set = lxc_cap_is_set(caps, cap, flag);
cap_free(caps); cap_free(caps);
return cap_is_set; return cap_is_set;
#endif
} }
bool lxc_proc_cap_is_set(cap_value_t cap, cap_flag_t flag) bool lxc_proc_cap_is_set(cap_value_t cap, cap_flag_t flag)
......
...@@ -3254,7 +3254,7 @@ static int idmaptool_on_path_and_privileged(const char *binary, cap_value_t cap) ...@@ -3254,7 +3254,7 @@ static int idmaptool_on_path_and_privileged(const char *binary, cap_value_t cap)
goto cleanup; goto cleanup;
} }
#if HAVE_LIBCAP #if HAVE_LIBCAP && !IS_BIONIC
/* Check if it has the CAP_SETUID capability. */ /* Check if it has the CAP_SETUID capability. */
if ((cap & CAP_SETUID) && if ((cap & CAP_SETUID) &&
lxc_file_cap_is_set(path, CAP_SETUID, CAP_EFFECTIVE) && lxc_file_cap_is_set(path, CAP_SETUID, CAP_EFFECTIVE) &&
...@@ -3274,6 +3274,10 @@ static int idmaptool_on_path_and_privileged(const char *binary, cap_value_t cap) ...@@ -3274,6 +3274,10 @@ static int idmaptool_on_path_and_privileged(const char *binary, cap_value_t cap)
fret = 1; fret = 1;
goto cleanup; goto cleanup;
} }
#else
DEBUG("Cannot check for file capabilites as full capability support is "
"missing. Manual intervention needed.");
fret = 1;
#endif #endif
cleanup: cleanup:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment