#include <tuple>
#include <errno.h>
#include <string.h>
-#include <tzplatform_config.h>
-const uid_t APP_UID = tzplatform_getuid(TZ_USER_NAME);
-const gid_t APP_GID = tzplatform_getgid(TZ_USER_NAME);
+const uid_t APP_UID = 5000;
+const gid_t APP_GID = 5000;
const uid_t DB_ALARM_UID = 6001;
const gid_t DB_ALARM_GID = 6001;
const std::string TMP_DIR("/tmp");
#include <privilege-control.h>
#include <tests_common.h>
#include <unistd.h>
+#include <tzplatform_config.h>
// How many open file descriptors should ftw() function use?
#define FTW_MAX_FDS 16
#define APPID_DIR "test_APP_ID_dir"
#define GENERATED_APP_ID "User" // TODO to be replaced in the future
+const uid_t TZ_APP_UID = tzplatform_getuid(TZ_USER_NAME);
+const gid_t TZ_APP_GID = tzplatform_getgid(TZ_USER_NAME);
+
#define PERM_TO_REDEFINE "Test::RedefinePermission"
#define PERM_SUB_TO_REDEFINE "Test::RedefinePermission::Sub"
RUNNER_ASSERT_MSG(result == 1, "Permissions not added.");
std::set<unsigned> groups_before;
- read_user_gids(groups_before, APP_UID);
+ read_user_gids(groups_before, TZ_APP_UID);
result = perm_app_set_privilege(app_id, type, app_path);
RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
" Permissions shouldn't be added. Result: " << result);
std::set<unsigned> groups_before;
- read_user_gids(groups_before, APP_UID);
+ read_user_gids(groups_before, TZ_APP_UID);
result = perm_app_set_privilege(app_id, type, app_path);
RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
DB_END
std::set<unsigned> groups_before;
- read_user_gids(groups_before, APP_UID);
+ read_user_gids(groups_before, TZ_APP_UID);
//Set app privileges
result = perm_app_set_privilege(APP_ID, nullptr, APP_SET_PRIV_PATH);
RUNNER_ASSERT_MSG(label == nullptr, "new_label_from_self shouldn't allocate memory for label.");
//Check if DAC privileges really set
- RUNNER_ASSERT_MSG(getuid() == APP_UID, "Wrong UID");
- RUNNER_ASSERT_MSG(getgid() == APP_GID, "Wrong GID");
+ RUNNER_ASSERT_MSG(getuid() == TZ_APP_UID, "Wrong UID");
+ RUNNER_ASSERT_MSG(getgid() == TZ_APP_GID, "Wrong GID");
result = strcmp(getenv("HOME"), APP_HOME_DIR);
RUNNER_ASSERT_MSG(result == 0, "Wrong HOME DIR. Result: " << result);