*/
+#include <unistd.h>
+#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
return -1;
}
+ if (getuid() <= USER_UID_START) {
+ //LCOV_EXCL_START System Error
+ _E("Only apps and user session daemons are allowed "
+ "to use storage_get_compat_internal_path()");
+ return -1;
+ //LCOV_EXCL_STOP
+ }
+
// this API works on place where compat path is bind-mounted
if (!is_compat_bind_mount()) {
//LCOV_EXCL_START System Error
//LCOV_EXCL_STOP
}
- str = tzplatform_getenv(TZ_USER_CONTENT);
+ str = tzplatform_uid_getenv(getuid(), TZ_USER_CONTENT);
str_len = strlen(str);
if (strncmp(origin, str, str_len) != 0) {
_E("Failed to match TZ_USER_CONTENT");
return -1;
}
+ if (getuid() <= USER_UID_START) {
+ //LCOV_EXCL_START System Error
+ _E("Only apps and user session daemons are allowed "
+ "to use storage_get_origin_internal_path()");
+ return -1;
+ //LCOV_EXCL_STOP
+ }
+
// this API works on place where compat path is bind-mounted
if (!is_compat_bind_mount()) {
//LCOV_EXCL_START System Error
return -1;
}
- r = snprintf(origin, len, "%s%s", tzplatform_getenv(TZ_USER_CONTENT), compat + compat_len);
+ r = snprintf(origin, len, "%s%s", tzplatform_uid_getenv(getuid(), TZ_USER_CONTENT), compat + compat_len);
if (r < 0) {
//LCOV_EXCL_START System Error
_E("failed to create new path");