restorecon and symbolic links

Based on a patch by Martin Orr.

Restore the code to compute the realpath of all but the last component
of a symlink, and relabel both the symlink and (if it exists) the target
of the symlink when a symlink is specified to restorecon.

Thus, restorecon -R /etc/init.d will restore both the /etc/init.d symlink
context and the directory tree starting from /etc/rc.d/init.d.

This fixes the restorecon /dev/stdin performed by the Debian udev init
script that was broken by policycoreutils 2.0.70.

[sds: switched use of _realpath suffix for process_one, and dropped warning
on non-existent target]

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
1 file changed