The following commit has been merged in the master branch:
commit 9166393d328f2fe3e1961ca2275d5d39d8eed6b4
Author: Guillem Jover <[email protected]>
Date:   Tue Sep 15 17:21:47 2009 +0200

    Improve secure_unlink comment and move it outside the function

diff --git a/src/help.c b/src/help.c
index cb123cf..8880719 100644
--- a/src/help.c
+++ b/src/help.c
@@ -504,6 +504,15 @@ void oldconffsetflags(const struct conffile *searchconff) {
   }
 }
 
+/*
+ * If the pathname to remove is:
+ *
+ * 1. a sticky or set-id file, or
+ * 2. an unknown object (i.e., not a file, link, directory, fifo or socket)
+ *
+ * we change its mode so that a malicious user cannot use it, even if it's
+ * linked to another file.
+ */
 int
 secure_unlink(const char *pathname)
 {
@@ -520,9 +529,6 @@ secure_unlink_statted(const char *pathname, const struct 
stat *stab)
   if (S_ISREG(stab->st_mode) ? (stab->st_mode & 07000) :
       !(S_ISLNK(stab->st_mode) || S_ISDIR(stab->st_mode) ||
        S_ISFIFO(stab->st_mode) || S_ISSOCK(stab->st_mode))) {
-    /* We chmod it if it is 1. a sticky or set-id file, or 2. an unrecognised
-     * object (ie, not a file, link, directory, fifo or socket)
-     */
     if (chmod(pathname, 0600))
       return -1;
   }

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to