@@ -, +, @@ --- src/rc/checkpath.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/src/rc/checkpath.c +++ a/src/rc/checkpath.c @@ -68,7 +68,7 @@ static int do_check(char *path, uid_t uid, gid_t gid, mode_t mode, int u; memset(&st, 0, sizeof(st)); - if (stat(path, &st) || trunc) { + if (lstat(path, &st) || trunc) { if (type == inode_file) { einfo("%s: creating file", path); if (!mode) /* 664 */ @@ -137,6 +137,10 @@ static int do_check(char *path, uid_t uid, gid_t gid, mode_t mode, eerror("%s: chmod: %s %s", applet, "Too many hard links to", path); return -1; } + if ((type != inode_dir) && (S_ISLNK(st.st_mode))) { + eerror("%s: chmod: %s %s", applet, path, " is a symbolic link"); + return -1; + } einfo("%s: correcting mode", path); if (chmod(path, mode)) { eerror("%s: chmod: %s", applet, strerror(errno)); @@ -149,6 +153,10 @@ static int do_check(char *path, uid_t uid, gid_t gid, mode_t mode, eerror("%s: chown: %s %s", applet, "Too many hard links to", path); return -1; } + if ((type != inode_dir) && (S_ISLNK(st.st_mode))) { + eerror("%s: chown: %s %s", applet, path, " is a symbolic link"); + return -1; + } einfo("%s: correcting owner", path); if (chown(path, uid, gid)) { eerror("%s: chown: %s", applet, strerror(errno)); --