static gboolean
_set_smack64_attr (
const gchar *path,
- const gchar *key)
+ const gchar *key,
+ gboolean transmute)
{
#if defined(HAVE_LSETXATTR)
GumConfig *config = NULL;
g_object_unref (config);
return FALSE;
}
+
+ if (transmute &&
+ lsetxattr(path, XATTR_NAME_SMACKTRANSMUTE, "TRUE", strlen("TRUE"), 0) != 0) {
+ g_object_unref (config);
+ return FALSE;
+ }
g_object_unref (config);
#endif
return TRUE;
}
if (!_set_smack64_attr (dup_file_path,
- GUM_CONFIG_GENERAL_SMACK64_NEW_FILES)) {
+ GUM_CONFIG_GENERAL_SMACK64_NEW_FILES, FALSE)) {
GUM_SET_ERROR (GUM_ERROR_FILE_ATTRIBUTE,
"Unable to set smack file attributes", error, retval, FALSE);
goto _fail;
gint mode = GUM_PERM & ~umask;
g_mkdir_with_parents (dest_filepath, mode);
stop = !_set_smack64_attr (dest_filepath,
- GUM_CONFIG_GENERAL_SMACK64_USER_FILES);
+ GUM_CONFIG_GENERAL_SMACK64_USER_FILES, FALSE);
if (!stop)
stop = !_copy_dir_recursively (src_filepath, dest_filepath, uid,
gid, umask, NULL);
goto _free_data;
}
stop = !_set_smack64_attr (dest_filepath,
- GUM_CONFIG_GENERAL_SMACK64_USER_FILES);
+ GUM_CONFIG_GENERAL_SMACK64_USER_FILES, FALSE);
}
if (!stop) stop = !_copy_file_attributes (src_filepath, dest_filepath);
if (!stop) stop = (lchown (dest_filepath, uid, gid) < 0);
"Home directory creation failure", error, FALSE);
}
- if (!_set_smack64_attr (home_dir,
- GUM_CONFIG_GENERAL_SMACK64_USER_FILES)) {
+ if (!_copy_file_attributes (skel_dir, home_dir)) {
GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_ATTRIBUTE,
- "Unable to set smack64 home dir attr", error, FALSE);
+ "Unable to get/set dir attributes", error, FALSE);
}
- if (!_copy_file_attributes (skel_dir, home_dir)) {
+ if (!_set_smack64_attr (home_dir,
+ GUM_CONFIG_GENERAL_SMACK64_USER_FILES, TRUE)) {
GUM_RETURN_WITH_ERROR (GUM_ERROR_FILE_ATTRIBUTE,
- "Unable to get/set dir attributes", error, FALSE);
+ "Unable to set smack64 home dir attr", error, FALSE);
}
/* when run in test mode, user may not exist */
retval = _copy_dir_recursively (skel_dir, home_dir, uid, gid, umask,
error);
- }
+ }
- return retval;
+ return retval;
}
/**