Revision: 1998
Author: ssmalley
Date: 2006-08-24 09:14:17 -0700 (Thu, 24 Aug 2006)
ViewCVS: http://svn.sourceforge.net/selinux/?rev=1998&view=rev
Log Message:
-----------
Author: Erich Schubert
Email: er...@de...
Subject: Bug in restorecon for symlinks in root dir
Date: Tue, 22 Aug 2006 02:17:21 +0200
restorecon has a bug for symlinks in the root directory, such as
/vmlinuz or the /lib64 -> /lib symlink found on all debian amd64
systems.
The bug arises in the way the containing directories "realpath" is
found for symlinks. Basically, the directory name is split by
overwriting the last / character with a \0 char; then calling
realpath(3) on the first component, then joining them again. For
obvious reasons, this doesn't work for filenames such as /lib64; but
it only affects symlinks (thats why "restorecon /etc" works fine).
Signed-off-by: Stephen Smalley <sd...@ty...>
Modified Paths:
--------------
trunk/policycoreutils/restorecon/restorecon.c
Modified: trunk/policycoreutils/restorecon/restorecon.c
===================================================================
--- trunk/policycoreutils/restorecon/restorecon.c 2006-08-24 16:13:19 UTC (rev 1997)
+++ trunk/policycoreutils/restorecon/restorecon.c 2006-08-24 16:14:17 UTC (rev 1998)
@@ -178,7 +178,10 @@
return 1;
}
file_sep = strrchr(tmp_path, '/');
- if (file_sep) {
+ if (file_sep == tmp_path) {
+ file_sep++;
+ p = strcpy(path, "");
+ } else if (file_sep) {
*file_sep = 0;
file_sep++;
p = realpath(tmp_path, path);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|