Go to file
Mark Salyzyn 0b034d9d7b libcutils: add android_get_control_file()
Solve one more issue where privilege is required to open a file and
we do not want to grant such to the service. This is the client side
of the picture, init is the server. The file's descriptor was placed
into the environment as "ANDROID_FILE_<path>" where non-alpha and
non-numeric characters in the <path> are replaced with _ and this
function picks the file descriptor up.

Added definition ANDROID_FILE_ENV_PREFIX ("ANDROID_FILE_") and
android_get_control_file() prototype in a new include <cutils/files.h>

android_get_control_file() checks if the resulting file descriptor is
valid, open and matches the name reference, which on purpose will fail
if a symbolic link is in the path rather than using a fully qualified
path.  Add gTest unit test for both.

Test: gTest libcutils_test --gtest_filter=FileTest.android_get_control_file
Bug: 32450474
Change-Id: I2d0310a1727f1e393a00d9fc7e6cf5d028f27905
2016-11-03 13:34:20 -07:00
adb Set file capabilities after writing file data 2016-11-02 16:37:11 -07:00
adf system/core Replace cutils/log.h with android/log.h 2016-09-30 12:47:05 -07:00
base Add StartsWithIgnoreCase/EndsWithIgnoreCase. 2016-10-25 14:56:04 -07:00
bootstat bootstat: drop event_log_list_builder 2016-10-24 11:13:16 -07:00
cpio mkbootfs: Fix the default st_mode for root directory. 2016-10-07 16:14:27 -07:00
debuggerd fix regression from android_lookupEventTag_len() 2016-10-24 13:39:19 -07:00
fastboot Merge "Rely on the platform -std default." 2016-10-14 02:28:38 +00:00
fingerprintd system/core Replace cutils/log.h with android/log.h 2016-09-30 12:47:05 -07:00
fs_mgr Make sure wait for the dm device 2016-10-26 13:40:23 -07:00
gatekeeperd system/core Replace cutils/log.h with android/log.h 2016-09-30 12:47:05 -07:00
healthd Move off std::sto* function which abort on failure. 2016-10-13 15:34:05 -07:00
include libcutils: add android_get_control_file() 2016-11-03 13:34:20 -07:00
init init: Add support for ambient capabilities. 2016-11-01 19:56:14 -04:00
libappfuse Add FuseBridgeLoop to libappfuse. 2016-10-27 15:04:15 +09:00
libbacktrace Make libbacktrace build with LLVM r275480 2016-10-25 22:16:47 -07:00
libbinderwrapper Move libbinderwrapper's headers into libbinderwrapper. 2016-09-16 09:02:47 -07:00
libcrypto_utils Rely on the platform -std default. 2016-10-10 14:31:12 -07:00
libcutils libcutils: add android_get_control_file() 2016-11-03 13:34:20 -07:00
libdiskconfig system/core Replace log/log.h with android/log.h 2016-09-30 12:47:05 -07:00
libion libion: open /dev/ion read-only 2016-10-21 14:29:22 -07:00
liblog liblog: test report pmsg not configured if ENOMEM return 2016-11-03 11:20:59 -07:00
libmemtrack system/core Replace log/log.h with android/log.h 2016-09-30 12:47:05 -07:00
libmemunreachable Rely on the platform -std default. 2016-10-10 14:31:12 -07:00
libnativebridge Upgrade native bridge to version 3 to support namespace 2016-10-25 11:11:38 -07:00
libnativeloader Return nullptr from FindNamespaceByClassLoader for NB-enabled apps. 2016-11-01 14:48:45 -07:00
libnetutils system/core Replace cutils/log.h with android/log.h 2016-09-30 12:47:05 -07:00
libpackagelistparser system/core Replace cutils/log.h with android/log.h 2016-09-30 12:47:05 -07:00
libpixelflinger system/core: preparation to pull back interfaces from android/log.h 2016-10-20 08:11:39 -07:00
libprocessgroup Use readdir instead of readdir_r. 2016-09-28 14:04:12 -07:00
libsparse libsparse: output_file.c, fix large data chunk issue 2016-10-06 09:53:42 -07:00
libsuspend system/core Replace cutils/log.h with android/log.h 2016-09-30 12:47:05 -07:00
libsync Rely on the platform -std default. 2016-10-10 14:31:12 -07:00
libsysutils system/core: preparation to pull back interfaces from android/log.h 2016-10-20 08:11:39 -07:00
libusbhost usb-bulk-transfer: Clarify sign-iy-ness of param 2016-09-21 15:51:35 +00:00
libutils system/core: preparation to pull back interfaces from android/log.h 2016-10-20 08:11:39 -07:00
libziparchive system/core: preparation to pull back interfaces from android/log.h 2016-10-20 08:11:39 -07:00
lmkd system/core: preparation to pull back interfaces from android/log.h 2016-10-20 08:11:39 -07:00
logcat Merge "fix regression from android_lookupEventTag_len()" 2016-10-24 23:08:47 +00:00
logd logd: clear DUMPABLE 2016-11-03 11:20:59 -07:00
logwrapper Rely on the platform -std default. 2016-10-10 14:31:12 -07:00
mkbootimg mkbootimg: use int for os_version and os_patch_level 2016-03-29 16:06:37 -07:00
reboot Convert more Android.mk files to Android.bp 2016-07-13 17:41:45 -07:00
rootdir Merge "give zygote AID_READPROC" 2016-11-03 18:08:55 +00:00
run-as run-as: Use Minijail for privilege dropping. 2016-07-19 11:03:52 -04:00
sdcard Small clean up of fuse code. 2016-10-07 12:16:00 -07:00
toolbox Rely on the platform -std default. 2016-10-10 14:31:12 -07:00
trusty system/core: preparation to pull back interfaces from android/log.h 2016-10-20 08:11:39 -07:00
tzdatacheck Convert more Android.mk files to Android.bp 2016-07-13 17:41:45 -07:00
.gitignore Ignore adb/*.pyc files 2015-08-11 12:59:58 -07:00
Android.mk Remove the simulator target from all makefiles. 2011-07-11 22:12:32 -07:00
CleanSpec.mk init.rc: have hwservicemanager start the HAL class 2016-09-26 00:23:51 -07:00
MODULE_LICENSE_APACHE2 auto import from //depot/cupcake/@135843 2013-07-30 13:56:49 -07:00
NOTICE Fix omission in NOTICE file. 2013-07-30 13:56:55 -07:00