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

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