#define APP_SET_PRIV "test_APP"
#define APP_SET_PRIV_PATH "/etc/smack/test_privilege_control_DIR/test_set_app_privilege/test_APP"
+#define APP_SET_PRIV_PATH_REAL "/etc/smack/test_privilege_control_DIR/test_set_app_privilege/test_APP_REAL"
const char *PRIVS[] = { "WRT", "test_privilege_control_rules", NULL };
{
int result;
char* labelApp = "test_pc_label";
+ char* labelAppSymlink = "test_pc_label_symlink";
// Preset exec label
- smack_setlabel(APP_SET_PRIV_PATH,labelApp, SMACK_LABEL_EXEC);
+ smack_lsetlabel(APP_SET_PRIV_PATH_REAL, labelApp, SMACK_LABEL_EXEC);
+ smack_lsetlabel(APP_SET_PRIV_PATH, labelAppSymlink, SMACK_LABEL_EXEC);
// Set APP privileges
result = set_app_privilege(APP_SET_PRIV, NULL, APP_SET_PRIV_PATH);
// Check if SMACK label really set
char * label;
result = smack_new_label_from_self(&label);
- RUNNER_ASSERT_MSG(result == 0, "Error setting label for exec" << result);
+ RUNNER_ASSERT_MSG(result == 0, "Error getting current process label");
+ RUNNER_ASSERT_MSG(label != NULL, "Process label is not set");
result = strcmp(labelApp, label);
- RUNNER_ASSERT_MSG(result == 0, "Label NOT set");
+ RUNNER_ASSERT_MSG(result == 0, "Process label " << label << " is incorrect");
// Check if DAC privileges really set
RUNNER_ASSERT_MSG(getuid() == APP_UID, "Wrong UID");