deploy: Actually copy xattrs of modified config files

Regression from 7b01bd2e43
where we stopped using g_file_copy() - we lost copying xattrs.

This specifically breaks /etc/shadow SELinux labeling, with the
obvious bad consequences.

https://bugzilla.gnome.org/show_bug.cgi?id=742289
This commit is contained in:
Colin Walters 2015-01-03 12:14:11 -05:00
parent 7727fe84d9
commit 01f6d68c60
1 changed files with 13 additions and 0 deletions

View File

@ -93,6 +93,13 @@ copy_one_file_fsync_at (int src_parent_dfd,
} }
out = g_unix_output_stream_new (dest_fd, TRUE); out = g_unix_output_stream_new (dest_fd, TRUE);
if (src_xattrs != NULL)
{
if (!gs_fd_set_all_xattrs (dest_fd, src_xattrs,
cancellable, error))
goto out;
}
if (g_output_stream_splice (out, in, 0, cancellable, error) < 0) if (g_output_stream_splice (out, in, 0, cancellable, error) < 0)
goto out; goto out;
@ -134,6 +141,12 @@ copy_one_file_fsync_at (int src_parent_dfd,
gs_set_error_from_errno (error, errno); gs_set_error_from_errno (error, errno);
goto out; goto out;
} }
if (src_xattrs != NULL)
{
if (!gs_dfd_and_name_set_all_xattrs (dest_parent_dfd, name, src_xattrs,
cancellable, error))
goto out;
}
if (fchownat (dest_parent_dfd, name, if (fchownat (dest_parent_dfd, name,
stbuf->st_uid, stbuf->st_gid, stbuf->st_uid, stbuf->st_gid,
AT_SYMLINK_NOFOLLOW) != 0) AT_SYMLINK_NOFOLLOW) != 0)