Blame SOURCES/cups-CVE-2014-3537.patch

c5086f
diff -up cups-1.6.3/scheduler/client.c.CVE-2014-3537 cups-1.6.3/scheduler/client.c
c5086f
--- cups-1.6.3/scheduler/client.c.CVE-2014-3537	2014-09-02 11:30:50.021384781 +0100
c5086f
+++ cups-1.6.3/scheduler/client.c	2014-09-02 11:31:00.606440125 +0100
c5086f
@@ -3197,7 +3197,7 @@ get_file(cupsd_client_t *con,		/* I  - C
c5086f
     if ((ptr = strchr(filename, '?')) != NULL)
c5086f
       *ptr = '\0';
c5086f
 
c5086f
-    if ((status = stat(filename, filestats)) != 0)
c5086f
+    if ((status = lstat(filename, filestats)) != 0)
c5086f
     {
c5086f
      /*
c5086f
       * Drop the language prefix and try the root directory...
c5086f
@@ -3209,12 +3209,33 @@ get_file(cupsd_client_t *con,		/* I  - C
c5086f
       if ((ptr = strchr(filename, '?')) != NULL)
c5086f
 	*ptr = '\0';
c5086f
 
c5086f
-      status = stat(filename, filestats);
c5086f
+      status = lstat(filename, filestats);
c5086f
     }
c5086f
   }
c5086f
 
c5086f
+  /*
c5086f
+   * If we've found a symlink, 404 the sucker to avoid disclosing information.
c5086f
+   */
c5086f
+ 
c5086f
+  if (!status && S_ISLNK(filestats->st_mode))
c5086f
+  {
c5086f
+    cupsdLogMessage(CUPSD_LOG_INFO, "[Client %d] Symlinks such as \"%s\" are not allowed.", con->http.fd, filename);
c5086f
+    return (NULL);
c5086f
+  }
c5086f
+
c5086f
+ /*
c5086f
+  * Similarly, if the file/directory does not have world read permissions, do
c5086f
+  * not allow access...
c5086f
+  */
c5086f
+
c5086f
+  if (!status && !(filestats->st_mode & S_IROTH))
c5086f
+  {
c5086f
+    cupsdLogMessage(CUPSD_LOG_INFO, "[Client %d] Files/directories such as \"%s\" must be world-readable.", con->http.fd, filename);
c5086f
+    return (NULL);
c5086f
+  }
c5086f
+
c5086f
  /*
c5086f
-  * If we're found a directory, get the index.html file instead...
c5086f
+  * If we've found a directory, get the index.html file instead...
c5086f
   */
c5086f
 
c5086f
   if (!status && S_ISDIR(filestats->st_mode))